Home  |  Contents 

Microcontroller and PC projects
  Forum Index : Microcontroller and PC projects         Section
Subject Topic: uM2(+): data logging - cheap fast & easy Post ReplyPost New Topic
<< Prev Page of 9 Next >>
Author
Message << Prev Topic | Next Topic >>
centrex
Guru
Guru
Avatar

Joined: 13 November 2011
Location: Australia
Online Status: Offline
Posts: 320
Posted: 18 June 2016 at 1:24am | IP Logged Quote centrex

Hi Matherp

Is it possible to have an 'APPEND' function added to the logging functions.

My reason for this if I am logging at long time intervals say 5mins I would lose a lot of data if it failed before I was able to load a page of data.

If the Function could write the date time immediately and then write a block of data wait for the next block of data to write find the next empty location then write until the page is full and the move to the next page.

Perhaps it can already do this but I cant see how.


__________________
Cliff


Back to Top View centrex's Profile Search for other posts by centrex Visit centrex's Homepage
 
Phil23
Guru
Guru


Joined: 27 March 2016
Location: Australia
Online Status: Offline
Posts: 1510
Posted: 18 June 2016 at 4:27am | IP Logged Quote Phil23

Grogster wrote:
EDIT: @ Phil23 - I can put together an example. How many variables are you wanting to save so I know how many to cater for in the example?


Sorry Grog,

I only just saw the mention with the example offering.

I'd say only a dozen would do as a start.

Just want to record & save daily maximums & minimums for various temp sensors when I get back to that bit of code.

Too much plumbing, wiring & Dupont pin crimping lately, so didn't see updates to this thread.


Thanks

Phil.
Back to Top View Phil23's Profile Search for other posts by Phil23
 
matherp
Guru
Guru


Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 2340
Posted: 18 June 2016 at 7:18am | IP Logged Quote matherp

Quote:
Is it possible to have an 'APPEND' function added to the logging functions.


Not sure what you are asking for.

The original logging functions ONLY support append. No data can be lost as nothing is buffered. When you call writelog it appends the new record immediately.
Back to Top View matherp's Profile Search for other posts by matherp
 
centrex
Guru
Guru
Avatar

Joined: 13 November 2011
Location: Australia
Online Status: Offline
Posts: 320
Posted: 18 June 2016 at 8:45am | IP Logged Quote centrex

Hi Peter
As I understand the write page it will write up to 256bytes of data. If I write a string that is only 10bytes long and then another string only 10bytes long these will go on separate pages. To me this means we have lost a large area that could have contained data.

If I am logging with a long delay between readings I could loose a lot of data if I have to wait until the string is 256bytes long should something fail during the logging.

Am I making sense?

__________________
Cliff
Back to Top View centrex's Profile Search for other posts by centrex Visit centrex's Homepage
 
matherp
Guru
Guru


Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 2340
Posted: 18 June 2016 at 8:57am | IP Logged Quote matherp

Cliff forget the stuff I did for Grogster and go back to the original posts on the first page. This code packs the strings so there is no loss of space and does not buffer. It relies on the fact that you can always change a 1 to a zero. So in your example I write the first 10 bytes, but the next 246 on the page are still all 1s. I can therefore write another string any time after the first by reading that page, updating the next sequence of bytes whilst leaving the first 10 alone and then re-writing it. The code also caters for the write spanning blocks and deals with this as well with no wastage of space.

The writelog function has a few comments to explain how it works

Edited by matherp on 18 June 2016 at 9:05am
Back to Top View matherp's Profile Search for other posts by matherp
 
centrex
Guru
Guru
Avatar

Joined: 13 November 2011
Location: Australia
Online Status: Offline
Posts: 320
Posted: 18 June 2016 at 9:07am | IP Logged Quote centrex

Peter
Thanks I will give it a try, I am using the logging functions.



__________________
Cliff
Back to Top View centrex's Profile Search for other posts by centrex Visit centrex's Homepage
 
centrex
Guru
Guru
Avatar

Joined: 13 November 2011
Location: Australia
Online Status: Offline
Posts: 320
Posted: 18 June 2016 at 9:34am | IP Logged Quote centrex

Peter
I have loaded 9 readings as well as the time and date one reading every 5 minutes to a total of 50 bytes ,this is what I get when I readlog()




are you saying that all of these are on one or more pages page.

Edited by centrex on 18 June 2016 at 9:37am


__________________
Cliff
Back to Top View centrex's Profile Search for other posts by centrex Visit centrex's Homepage
 
matherp
Guru
Guru


Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 2340
Posted: 18 June 2016 at 9:52am | IP Logged Quote matherp

Quote:
are you saying that all of these are on one or more pages page.


????

I'm saying each ascii character in a string uses 1 byte + an overhead of 1 byte for each string logged. The logging code takes care of everything else.
Back to Top View matherp's Profile Search for other posts by matherp
 
centrex
Guru
Guru
Avatar

Joined: 13 November 2011
Location: Australia
Online Status: Offline
Posts: 320
Posted: 18 June 2016 at 10:29am | IP Logged Quote centrex

OK Peter thanks for your patience.

__________________
Cliff
Back to Top View centrex's Profile Search for other posts by centrex Visit centrex's Homepage
 
Grogster
Guru
Guru
Avatar

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 6128
Posted: 18 June 2016 at 1:48pm | IP Logged Quote Grogster

matherp wrote:
Cliff forget the stuff I did for Grogster and go back to the original posts on the first page.


Yes, matherp just did that REWRITE routine for me and anyone else who wanted to page-write, and who would take care of making sure the page was 255 bytes before asking for the write. Ignore all my posts, as matherps original code on page one will do EXACTLY what you are wanting, by appending the data for you with no lost space.

...if I may paraphrase matherp for just a moment.......

__________________
Smoke makes things work. When the smoke gets out, it stops!
Back to Top View Grogster's Profile Search for other posts by Grogster Visit Grogster's Homepage
 
Grogster
Guru
Guru
Avatar

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 6128
Posted: 18 June 2016 at 2:07pm | IP Logged Quote Grogster

Phil23 wrote:
Grogster wrote:
EDIT: @ Phil23 - I can put together an example. How many variables are you wanting to save so I know how many to cater for in the example?


Sorry Grog,

I only just saw the mention with the example offering.

I'd say only a dozen would do as a start.

Just want to record & save daily maximums & minimums for various temp sensors when I get back to that bit of code.

Too much plumbing, wiring & Dupont pin crimping lately, so didn't see updates to this thread.


Thanks

Phil.


Hey Phil.

The first thing you will need to know, is if you need to use multi-byte words to store the variables, and what kind of data it is. If ALL your variables are going to be numerical and less-then or equal to 256, then it is easy, but if you have larger numbers, you will need to split the value up into multiple 8-bit bytes.

As the SPI memory is an 8-bit device, you cannot store a value greater then 256 in any ONE address, and all addresses will only accept integer values.

If you need to store fractions such as 24.73 degrees or something similar, you can store two bytes for each value. The first is the whole-number degrees, and the second byte is the fraction. Two bytes like that would allow you to record up to 256.256, which would be more then you are ever gonna need for temperature sensors.

Out of interest, and before I get too involved in this idea, is there any reason you cannot use the MM's built-in VAR SAVE command? This will do everything for you, including saving of fractions if you want.

I will need to re-read this thread if you had a reason for NOT using VAR SAVE.

__________________
Smoke makes things work. When the smoke gets out, it stops!
Back to Top View Grogster's Profile Search for other posts by Grogster Visit Grogster's Homepage
 
centrex
Guru
Guru
Avatar

Joined: 13 November 2011
Location: Australia
Online Status: Offline
Posts: 320
Posted: 18 June 2016 at 8:53pm | IP Logged Quote centrex

Hi Grogster
Just to put things straight I was never using the functions that Matherp wrote for you it has always been the logging function.
It is when you do a readlog() that puzzles me because it prints out on separate lines (see the screen dump a couple of posts ago) I am expecting one long comma delimited file or at least a file that is 256 bytes long followed by another similar file.


More reading of how the readlog() works required

__________________
Cliff
Back to Top View centrex's Profile Search for other posts by centrex Visit centrex's Homepage
 


<< Prev Page of 9 Next >>
In the news...
 
Post ReplyPost New Topic
Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

Powered by Web Wiz Forums version 7.8
Copyright ©2001-2004 Web Wiz Guide

This page was generated in 0.1250 seconds.
Privacy Policy     Process times : 0, 0, 0, 0.12