Hello all,
I have a PIC16F88 setup with the bootloader from www.sparkfun.com (Screamer/bloader). I have been using it with no problems at all until I needed to use a serial EEPROM with one of my new projects. I used Microchip App Note AN976 for the circuit diagram and substituted my 'F88 for the 'F877A. I connected the SDA and SCL lines on the 'F88 to the correct pins on the 24LC256.
Here is my code:
-----------CODE-----------
DEFINE LOADER_USED 1
DEFINE OSC 8
' Set Baud Rate
DEFINE HSER_BAUD 9600
' Clear UART overflow error
DEFINE HSER_CLROERR 1
' Enable transmit and receive
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 20h
' I2CREAD and I2WRITE Commands
'
' Write to the first 16 locations of an external serial EEPROM
' Read first 16 locations back and send to serial out repeatedly
' Note: for EEPROMS with byte-sized address
'INCLUDE "modedefs.bas" ' Include serial modes
DPIN VAR PORTB.1 ' I2C data pin
CPIN VAR PORTB.4 ' I2C clock pin
B0 VAR BYTE
B1 VAR BYTE
B2 VAR BYTE
For B0 = 0 TO 15 ' Loop 16 times
I2CWrite DPIN,CPIN,$A0,B0,[B0] ' Write each location's address to itself
Pause 10 ' Delay 10ms after each write
Next B0
loop:
For B0 = 0 TO 15 STEP 2 ' Loop 8 times
I2CRead DPIN,CPIN,$A0,B0,[B1,B2] ' Read 2 locations in a row
HSerout [#B1," ",#B2," "] ' Print 2 locations
Next B0
HSerout [10,13] ' Print linefeed
GoTo loop
-----------CODE-----------
When I have the I2C(Read/Write) lines in my bootloader complains that the proper jump is not in the code. When I comment them out the program loads fine. Either way it compiles just fine. No errors.
This is my first attempt at using any of the 24LC256 EEPROMS. I have checked the PIC and it is okay. I have my trusty Blinky program I load up on new devices to check them.
Has anyone seen this before? Have I discovered a bug?
Thanks in advance!
Xavier
Bookmarks