BS2p to TPA81
legoman132
Posts: 87
I am having trouble with my BS2p and a TPA81. 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. We are using two 1K resistors in series on the clock and data lines to give a value of 2K, just above what is recommended in the TPA81 manual (1.8K).
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.
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.
Comments
http://www.robot-electronics.co.uk/acatalog/tpa81bs2p.htm
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen