Okay, I've taken the code sample that was based on PBC and wrote out how I see the bits being used at a line by line level. I came up with this:
* Program starts for the evening for the first time ever:
<b>Read 0,B0</b>
(B0 now contains %00000000 as it has not had anything wrote to it yet)
<b>W0=W0+23</b>
(W0 now contains %0000000000010111 as W0 is a 16 bit WORD and 23 was added to, basically, zero)
<b>Write 0,B0</b>
(B0 now contains %00000000 as B0 just saves the first 8 bits of the 16 bit WORD to eeprom)
<b>Loop:
RANDOM W0</b>
(W0 is a new RANDOM 16 bit WORD seeded with %0000000000010111 as W0 has not been reset yet with a power down and I have to assume the 16 bit value is stored somewhere other than eeprom for general operations)
<b>B2=W0 & $000F
Gosub BlinkyLight
Goto Loop</b>
(Not addressed in this example since I'm only interested in the eeprom seed value.)
As I see this, each time the chip starts up it is only reading and writing a ZERO back to the eeprom for the next seed. Perhaps if B1 was used instead of B0 or even both?
So, what am I missing here with the bits and writing out what is happening at a BIT level?
Bart
PS. hold the phone. I think I answered this myself. The bit count starts on the right and moves left, not on the left and moving right. Am I right? If I do have my example backward here then B0 is still correct and it would save something different each time.
I'm still working on the odd and even issue though.
Bookmarks