PDA

View Full Version : Write Read And Words



Rob Martin
- 30th March 2004, 17:24
I'm running out of code space so.... (16F628)

What is the most efficient way to read & write a WORD using the READ, WRITE commands.

I have a VAR WORD which holds the VAR 1234
I need to write this and then read it at start up.

Is it possible to write the whole word in one instructions as it is 2 bytes.

I was hoping to do something like write [0,1],VAR
then read [0,1],VAR

But how do i get the whole WORD?
Any suggestions

Rob

Melanie
- 30th March 2004, 23:26
You can only READ and WRITE a BYTE at a time. So your WORD must be split and handled in two steps...

WRITE 0,MyWord.LowByte
WRITE 1,MyWord.HighByte

and similarly to Read and assemble back into a WORD...

READ 0,MyWord.LowByte
READ 1,MyWord,HighByte

The PBP manual is quite explicit on the usage.

Melanie

Rob Martin
- 31st March 2004, 00:27
Hi Melanie

I did read though the manual several time and didn't notice the byte0 command.
Again searching though the archives didn't show anything till I found the byte0 command.
It was only when I found the command I then found numerous postings.
Please don't think I'm being lazy I spent 4hrs looking though the archives and didn't find anything under eeprom, word etc.

Thanks for your helps once again

Rob