PDA

View Full Version : PIC16F88, Bootloader & I2C Memory



digilord
- 29th December 2005, 13:53
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

Bruce
- 29th December 2005, 16:05
LCDOUT & I2C(Read/Write) will cause problems with this loader. See this thread for the fix.

http://www.picbasic.co.uk/forum/showthread.php?t=1318&highlight=screamer

digilord
- 29th December 2005, 16:28
I just ordered the MicroCode Studio Pro package with their bootloader. Do you know if it has the same issues?

I am behind on this project now. I really don't want to change the lib files on every dev station here.

Thanks!

Xavier

Bruce
- 29th December 2005, 16:35
MicroCode loader does not have the same issue.

mister_e
- 30th December 2005, 15:36
I'll second Bruce on that, Mecanique MicroCode Bootloader is the way to go. Since i use this one, no big problem. Worth every $$$ you invest in.

Thanks Mecanique (David Barker) for that high quality product.