So this is fun. I can successfully read any register from the sensor. ONCE. Any attempt to read the same or another register jumps to the error label. Wait, it gets better. If I read once, then RESET the ABB, it errors on the first read. A SECOND reset and the read is successful. That is, every other read works, and a RESET does not affect this.
A power off/power on is always successful on the first read. Can anyone explain whats going on (No, I havenāt been drinkingā¦)
I have had some similar things in the past (both with the ABB as well as on on ATMega32 system. Sometimes a device gets confused or the timings get out of wack and it holds the CLK line either high or low. Rebooting the processor did not help only power cycling. The worst device I had for this was an LCD that did I2C.
I also have had some fun trying to get it to consistently work with an SRF10 (or SRF08) sensor. I did get the code work resonably consistently, but I did have problems doing very many reads quickly. For example in my ping code:
[code]rfLightVal Var Byte ā Light sensor
srfAdr var Byte
srfRange Var Word ā 16 bit variable for Range
SRFPing[srfAdr]
I2COut SDA, SCL, SRFPFail, srfAdr, SRFCmdReg, [80] ; do a ping in inchesā¦
srfRange = 0
SRFP2
#if 0
pause 1
i2cin SDA, SCL, SRFCmdReg,[srfLightVal]
if srfLightVal = 0xff then
srfRange = srfRange + 1
if srfRange > 150 then
goto SRFPFail
endif
goto SRFP2
endif
#else
pause 67
#endif
; lets try to wait until the Ping completes
i2cin SDA, SCL, srfAdr, SRFRangeReg, [srfRange.HighByte, srfRange.LowByte]
return srfRange
SRFPFail
return 0xffff
[/code]
I gave up trying to query the device to see if it was ready and instead had to rely on a pause.
Good Luck
Hi all,
I assume that you are using the Atom 28/Pro?
I have gotten the TPA81 to work with a Parallax BS2p and it will track me (I have implemented in PBASIC a modified version of Steve Norrisā PIC C code that appeared in Robot mag issue 7) as I walk around infront of it as I have implemented the servo control function in the TPA81.
I assume that you have installed the 10K pull up resistors on the data and clock lines?
Just a thought.
Regards,
TCIII
Sorry, yep. Atom Pro 28. Iām using 3.8k resistors, which should be fine.
removed the error lablel in the i2c command and it worksā¦
That rings a bell