Hello all,
I did a search but didn't find anything that quite explains my problem, so here it goes:
I'm attempting to do I2C communications with another (slaved) microcontroller. The other microcontroller is a purchased product so I have little control over the code loaded on it. The device ID (device address?) is $10, I'm attempting to read a 16bit word on the microcontroller that is stored at $22 and $23 on the microcontroller. The microcontroller uses I2C communications at 400Khz, but for some reason my clock is at 122Khz (PIC16f676, 20MHz crystal). I'm not 100% sure I'm using the I2C read command correctly :P. Here is my code thus far:
define OSC 20
'lines to use i2cread
SDA var PORTA.0
SCK var PortA.1
'end lines to use i2cread
'LCDOUT DEFINES
define LCD_DREG PORTC
define LCD_DBIT 0
define LCD_RSREG PORTC
define LCD_RSBIT 4
define LCD_EREG PORTC
DEFINE LCD_EBIT 5 'Register enable bit on portc.5
define lcd_lines 4
'END LCDOUT DEFINES
Scntrl var byte
sadd var byte
Scntrl = $10
sadd = $22
myvar var word
pause 2000
main:
lcdout $fe,1,"Dubugging..."
i2cread PortA.0, PortA.1, Scntrl,sadd,[myvar.lowbyte, myvar.highbyte],fail
'last:
lcdout $fe,$c0,"Success!!!"
lcdout $fe,$94, "myvar = ", #myvar
goto done
fail:
LCDOUT $fe,$c0,"READ FAILED!!!"
done:
end
NOTE: THE LCD Works fine.