Search This Blog

Thursday, December 16, 2010

I2C Working

    Here's what we have so far.  I got my bootloader working on the 16F876a chips on the first try.  I took the sample code from application note AN976 and got the uCU working with the 32k eeprom.  The next step is to start writing the maze solving code on the Pic.  I'll have plenty of room now that the eeprom chip is working.  I think the cell values want to live on the Pic's built in eeprom.  That way, when it is time to run the maze, I won't need to access the eeprom chip.  I'll store the wall values and a flags ( visited before, destination cell, start cell ) for each cell on the first 256 bytes of the eeprom.  The rest of it can be stack space.  I'll still need a counter word to guard against stack overflow.  Most operations other than init will be single byte reads/writes.
  
    I'll be able to compute "neighbors" by +1 for East, -1 for West, +16 for North, and -16 for South.  If the boundaries cross, it won't be a problem because the walls will let me know not to bother with them.  The initial load of the arrays will pre-fill the outer walls of the maze.

    I'll need to stay aware of what operation I'm doing.  If I try to read or write from the USART, I'll need to make sure and disable the I2C operation first.  Otherwise, I run the risk of errors.

    Order of operations:
    1. take bearings ( walls )
    2. partial flood fill ( update values )
    3. determine next move
    4. virtual move
    5. repeat until destination.

    This will be a fun first exercise!

No comments:

Post a Comment