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 14:12 in General Discussion
READ and WRITE both work with a single location:

READ location, data_byte
WRITE location, data_byte

In PBASIC 2.5 (due to be released at the end of the month), you can READ and
WRITE 16-bit variables like this:

READ location, Word data_word
WRITE location, Word data_Word

In the latter case, data is read and written Little-Endian (low byte, high
byte).

-- Jon Williams
-- Parallax


In a message dated 1/8/2003 1:49:02 AM Central Standard Time,
800205015763@n... writes:

> ¡¥
> ¡¥Description:write date &time to EEPROM when micro-switch is
> ' triggered, using BS2 &Real Time Clock DS1302
> ¡¥
> ¡¥
> ¡¥Program Code
> ¡¥
> Input 4
> Input 5
>
> Recheck: ¡¥a label
> if in4=0 OR in5=0 then Log_Data ¡¥check if P4 or P5 is a ¡§0¡¨,
> if yes then go Log_Data
> goto Recheck ¡¥if P4 or P5 was a ¡§1¡¨, then go back &check again
>
> Log_Data:
> GOSUB ReadRTCBurst
> =Write Location, [noparse][[/noparse]Seconds,Minutes,Hours,Date,Month,Day,Year]
> =Write¡K
> GOTO Recheck
>
> ReadRTCBurst:
> HIGH RTCReset
> SHIFTOUT DTA, Clk, LSBFIRST, [noparse][[/noparse]%1\1,BrstReg\5,%10\2]
> SHIFTIN DTA, Clk, LSBPRE, [noparse][[/noparse]Seconds,Minutes,Hours,Date,Month,Day,Year]
> LOW RTCReset
> RETURN



[noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.