I am trying to interface the TMP141(Datasheet,in PDF) temperature sensor that uses a 1 wire protocol,(quite similar,_not_ identical though.. to the one from Dallas Semi.) with the PSoC 3.(030)
So I wrote code to do 8-bit reads,and 16-bit reads.Heres the funny part.
While I can read 8bit registers flawlessly(i.e the expected defaults are read in consistently),the 16bit registers are giving me a headache.
If I do a 16bit read,on register address 0x01(Manufacturer ID- Expected 0x104C),all I get is 0x004C.Similarly,if I do a 16bit read on register address 0x08(Temp. Capabilities - Expected 0x014A),what I get is 0x004A.Where is half my data going?
But wait,there is more.If I do an 8bit read on a 16 bit register,like on register address 0x01(Manufacturer ID- Expected 0x104C),I do get the elusive 0x10.
It cant be an issue of the wrong drive mode(currently is Hi-Z),or pull-up resistor,since the 8bit reads come in with no issues at all.Also,since the 16bit and 8bit read functions use the same underlying Bit Read/Write functions,they cant be bad either.So whats going wrong? I am not able to locate the fault.
I'm attaching my code,but note that I use breakpoints to debug,so the main() has nothing much really.I usually place a breakpoint on the TMP141_Read16()'s return line,and watch the local register values.