TPA81 troubles
legoman132
Posts: 87
I am having trouble with a TPA81 and my BS2p. The TPA81 is a sensor that can read ambient temperature and 8 pixels of infrared non-contact temperature. Communication is done through an I2C interface. The BS2p can read registers 0 and 1 of the TPA81 (firmware revision and ambient temperature). However, registers 2 through 9 (the infrared temperature pixels of the sensor) read as 0.
Code:
This code reads all nine registers and writes to the first, which sets the position of a servo connected to the TPA81's servo port (meant for a panning head). You cannot read the position of the servo back.
Instruction manual:
www.robot-electronics.co.uk/htm/tpa81tech.htm
sample code:
www.robot-electronics.co.uk/acatalog/tpa81bs2p.htm
I tried using 4 1K resistors (the closest i had to 2 1.8k, in groups of 2 in series, recommended in TPA81 manual) and 2 4.7K resistors (as recommended in help files in PBASIC editor) to the +5v on my boe with servo power off and good batteries for pull up resistors.
Post Edited (legoman132) : 3/20/2010 1:01:01 AM GMT
Code:
' {$STAMP BS2p} ' {$PBASIC 2.5} temp VAR Byte cnt VAR Byte 'DEBUG "hello" , CR I2COUT 0, $D0, 1, [noparse][[/noparse]80] DO cnt = cnt + 1 'increment cnt DEBUG HOME, DEC cnt, CR I2CIN 0, $D0, 0, [noparse][[/noparse]temp] 'read register 0 DEBUG DEC temp, CR PAUSE 125 I2CIN 0, $D0, 1, [noparse][[/noparse]temp] DEBUG DEC temp, CR PAUSE 125 I2CIN 0, $D0, 2, [noparse][[/noparse]temp] DEBUG DEC temp, CR PAUSE 125 I2CIN 0, $D0, 3, [noparse][[/noparse]temp] DEBUG DEC temp, CR PAUSE 125 I2CIN 0, $D0, 4, [noparse][[/noparse]temp] DEBUG DEC temp, CR PAUSE 125 I2CIN 0, $D0, 5, [noparse][[/noparse]temp] DEBUG DEC temp, CR PAUSE 125 I2CIN 0, $D0, 6, [noparse][[/noparse]temp] DEBUG DEC temp, CR PAUSE 125 I2CIN 0, $D0, 7, [noparse][[/noparse]temp] PAUSE 125 DEBUG DEC temp, CR PAUSE 125 I2CIN 0, $D0, 8, [noparse][[/noparse]temp] DEBUG DEC temp, CR PAUSE 125 I2CIN 0, $D0, 9, [noparse][[/noparse]temp] DEBUG DEC temp, CR PAUSE 125 I2COUT 0, $D0, 0, [noparse][[/noparse]cnt] LOOP
This code reads all nine registers and writes to the first, which sets the position of a servo connected to the TPA81's servo port (meant for a panning head). You cannot read the position of the servo back.
Instruction manual:
www.robot-electronics.co.uk/htm/tpa81tech.htm
sample code:
www.robot-electronics.co.uk/acatalog/tpa81bs2p.htm
I tried using 4 1K resistors (the closest i had to 2 1.8k, in groups of 2 in series, recommended in TPA81 manual) and 2 4.7K resistors (as recommended in help files in PBASIC editor) to the +5v on my boe with servo power off and good batteries for pull up resistors.
Post Edited (legoman132) : 3/20/2010 1:01:01 AM GMT
Comments
1 how does the chip know what regester you are trying to read ?
2 you don't need to write to a location first asking for info from a register?
3 with your program how do you expect to get the correct data into your variable
The I2CIN command handles I2c communication.
No, the processor on the TPA81 writes the data to them (temperature and firmware revision)
The I2CIN command copies the register value into the variable
The TPA81 has a built in temp sensor and we get valid readings from that. If you heat it up with your breath it increases the value read just like you'd expect. However, we get nothing but 0 back from any of the pixel registers. If we remove the data line the values all go to 255, also like you'd expect for a floating bus pin.
I guess I am looking for someone who has used the TPA81 before and maybe had this same problem and solved it????
Post Edited (legoman132) : 3/20/2010 1:12:47 AM GMT