newbie I2C questions/help
Robert@HCC
Posts: 80
I have been reading through the NV articles and posts (w/search) on I2C and find myself still with questions ..... mostly because much of this is new to me. However, I have an undying thirst for new knowledge, which while often leading to large headaches, must be quenched
Any help is greatly appreciated!
I happen to have a few Microchip TC77 temp sensors laying around, and decided to investigate I2C - partly because it may come in handy for my CanSat project, and partly because I just_gotta_ know.
Datasheets and printed NV articles at hand , this is where I am at:
I am using a BS2.
All I would like to do is read the temp from the temp register on the TC77
According to the data sheet, the read byte format is:
1)Start condition - which I understand how to do.
2) Transmit the 8-bit address byte ( the 7-bit w/devicetype and address, plus WR bit (0)) which I have. (set to WR during first phae of any transfer to indicate command byte is being written)
3) ACK (from slave)
4) Send 8-bit command byte ( selects which register I am reading from).
5) ACK (from slave)
6) Repeat Start condition and resend slave address with 8-bit set for RD (1) ( repeated due to change in dataflow direction.)
7) ACK (from slave)
8) Slave reads from register set by command byte .
9) NACK (from host)
10) Stop condition - which I understand how to do.
Then I have to handle the Recieve Byte routine to read the data from the register commanded by the last Read Byte transmission . (If I understand correctly)
questions:
1)I am unclear on the definition of Word Address, and addrLen. The TC77 has two registers - the temp register ( stores the converted temp reading as a 8-bit digital word) and a config register. So does register = Word Address , and would that make the addrLen =2? Or am I lost again....
2)The command byte is listed in the data sheet like so:
Command : RTR
Code: 00h
Function : Read Temperature (TEMP)
Can someone head me in the right direction as to how I use this to select the Temp Register?
3)Do I need to define a device number if there is only one device on the bus? (sorry if this sounds like a silly question)
Ok thats the things that have me stuck the most atm - thank you for any replies!
I am sure I will have further questions
Aloha,
Robert
Post Edited (Robert@HCC) : 12/18/2005 11:17:11 AM GMT
Any help is greatly appreciated!
I happen to have a few Microchip TC77 temp sensors laying around, and decided to investigate I2C - partly because it may come in handy for my CanSat project, and partly because I just_gotta_ know.
Datasheets and printed NV articles at hand , this is where I am at:
I am using a BS2.
All I would like to do is read the temp from the temp register on the TC77
According to the data sheet, the read byte format is:
1)Start condition - which I understand how to do.
2) Transmit the 8-bit address byte ( the 7-bit w/devicetype and address, plus WR bit (0)) which I have. (set to WR during first phae of any transfer to indicate command byte is being written)
3) ACK (from slave)
4) Send 8-bit command byte ( selects which register I am reading from).
5) ACK (from slave)
6) Repeat Start condition and resend slave address with 8-bit set for RD (1) ( repeated due to change in dataflow direction.)
7) ACK (from slave)
8) Slave reads from register set by command byte .
9) NACK (from host)
10) Stop condition - which I understand how to do.
Then I have to handle the Recieve Byte routine to read the data from the register commanded by the last Read Byte transmission . (If I understand correctly)
questions:
1)I am unclear on the definition of Word Address, and addrLen. The TC77 has two registers - the temp register ( stores the converted temp reading as a 8-bit digital word) and a config register. So does register = Word Address , and would that make the addrLen =2? Or am I lost again....
2)The command byte is listed in the data sheet like so:
Command : RTR
Code: 00h
Function : Read Temperature (TEMP)
Can someone head me in the right direction as to how I use this to select the Temp Register?
3)Do I need to define a device number if there is only one device on the bus? (sorry if this sounds like a silly question)
Ok thats the things that have me stuck the most atm - thank you for any replies!
I am sure I will have further questions
Aloha,
Robert
Post Edited (Robert@HCC) : 12/18/2005 11:17:11 AM GMT
Comments
"13-bit two's compliment digital word"
So, it seems that your doing everything right except that your 'host' might not be reading the data right and is 'freeking out' at the '13-bit two's compliment digital word' that the TC77 is sending back and doesn't know what to do with it. So you need to write your code to be able to handle the 13-bit two's complement "Word" that it will send back after you've requested the data in your step 8 or 9. I don't know exactly what they mean by that but it would seem like the TC77 will send 2 bytes of information to your 'host'; although it could be one 'transmission' of 13 bits.
Hope this helps a bit[noparse]:)[/noparse]· Maybe someone else knows more, or maybe ask Microchip