This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi all,
Ok I realise the memory is split into n segments each 512bytes wide. Now I am recording sensor data(2) every 2.30 mins and every 4mins for second sensor. Each recording is also made up of time so every write to flash requires 10bytes (8 for time and two for the sensor reading).
This means 51 readings fill up a segment. In addition I am using one segment to save data before each write to flash and from that segment I am copying the old and new data into the original segment.
Now I require data to be saved over a long period of time which can then be downloaded for analysis.
The problem is how do I know the specific address for each n segment as I will need toknow this. From the data sheet the only thing that is clear is the entire main memory flashrange from 0xffff to 0xC000. Can anyone help me out here or provide a resource where I could find out?
Calvin McGowan said:The problem is how do I know the specific address for each n segment as I will need toknow this. From the data sheet the only thing that is clear is the entire main memory flashrange from 0xffff to 0xC000. Can anyone help me out here or provide a resource where I could find out?
Simple math: one segment covers all memory with the same upper address bits while the lower 9 bits (for 512 bytes) are don’t care.
But why do you need 8 bytes for time? In seconds, this would be 6^11 years. In microseconds (1MHz resolution) this still would be ~600.000 years. Does your timestamp cover the full range from the big bang to the end of the universe?
The typical Unix timestamp requires 4 bytes only. (a long value, covering 136 years in seconds, either starting with 1970 or 1900)
TeraTerm doesn’t read the MSP memory directly. So you can convert the 4-byte timestamp when reading it from memory and sending it to TeraTerm. No need to store more data than required. After all, you’re filling more than one sector per hour, so your memory will overflow soon. Saving space will likely become vital when the project matures from a lab proof of concept to a real device.
Yes don't waste Flash, my program uses 3bytes to store 2bit data plus time.
I only use 2bits for year,as I can tell that the year can not be in the future and 4 years of data is enough.
Sure unix time of seconds from 1970 probably would be easier and maybe use less
byte 1 : xx_yy_mmmm
byte 2 : ddddd_hhh
byte 3 : hh_mmmmmm
TimetStamp Structure (a 24bit value MSB listed first)
______________________________________________________
Bits 23 and 22 for data
Year bits 21 and 20
2 bits 0-99 ( &11b 0-3 possible )
Month bits 19 to 16
4 bits 1-12 ( 0-16 possible )
Day bits 15-11
5 bits 1-31 ( 0-31 possible )
Hour bits 10-6
5 bits 0-23 ( 0-31 possible )
Minute bits 5-0
6 bits 0-59 ( 0-63 possible )
**Attention** This is a public forum