Shop OBEX P1 Docs P2 Docs Learn Events
How to write ''WRITE''? — Parallax Forums

How to write ''WRITE''?

ArchiverArchiver Posts: 46,084
edited 2003-01-08 19:13 in General Discussion
>Log_Data:
>GOSUB ReadRTCBurst
>=Write Location, [noparse][[/noparse]Seconds,Minutes,Hours,Date,Month,Day,Year]
>=Write¡K
>GOTO Recheck

You need to use a for-next loop to write each group of 8 bytes. The
following assumes that the bytes are in memory in order from
seconds..year. That allows the program to address the 8 bytes as an
array. I'm not sure what you mean by writeiK


for i=0 to 6
write location+i,seconds(i)
write location+7,iK
next
location=location+8 ' start of next record

The value of variable "location" will be rezeroed when your Stamp is
reset. So you may need to store that value in eeprom or in your
clock RAM (if it has some) each time you log data, or you could tag
the data file itself so that you can scan for the next "free" record
during program initialization.

-- Tracy
Sign In or Register to comment.