Newbie has some questions


Results 1 to 40 of 44

Threaded View

  1. #29
    Join Date
    Nov 2004
    Location
    Saskatchewan Canada
    Posts
    189


    Did you find this post helpful? Yes | No

    Default

    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.
    Last edited by bartman; - 9th November 2004 at 03:49.

Similar Threads

  1. Olympic Timer
    By Melanie in forum Code Examples
    Replies: 47
    Last Post: - 17th September 2008, 19:46
  2. Analog port newbie questions
    By rngd in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 10th March 2008, 11:38
  3. Newbie: Temperature measurements
    By Budda in forum General
    Replies: 10
    Last Post: - 30th March 2007, 09:56
  4. Hi Everyone! Some newbie questions :-)
    By guest_05 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 28th October 2006, 22:24
  5. NEWBIE: Some basic questions using interrupts
    By JackPollack in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th March 2006, 02:59

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts