PDA

View Full Version : I2C configuration



merlinknight
- 5th March 2007, 15:19
since i got the PicBasicPro i have a hard time leaving it. Wanting to learn all i can. I have note left and right since i started.I appreciate the help from everyone but i have another question.

I have searched for I2C config with no results that reallt explains what i want to know.

I am working with the TC74a05 address 1001 101
control = %1001101 <--------Is this declared by PicBasic Pro that i don't have too.
addr = $00 <--------Is this declared by PicBasic Pro that i don't have too.
i2cwrite sda,scl,control,addr,[$00]

I have this device reading the temp. What i want learn is to write to the config area and put it in standby.

The 7 bits of control are really the address of the chip with a r/w bit as the 8 bit but actuall bit0, correct? The addr is what? and the [$00] is the data to write? Do i have to do 2 write commands to do a configure?

The documentation says.

Is this the [$00]?

Command Code Function
RTR 00h Read Temperature (TEMP)
RWCR 01h Read/Write Configuration

Where does this go? In the Addr area?

CONFIGURATION REGISTER
(CONFIG); 8 BITS, READ/
WRITE)
D[7] 0 STANDBY Switch Read/Write
1 = standby,
0 = normal

D[6] 0 Data Ready * Read Only
1 = ready
0 = not ready

D[5]-D[0]
Reserved -
Always
returns zero
when read

BigWumpus
- 5th March 2007, 23:41
You have to shift the I2C-adress to the left by 1 bit.
So you get %10011010 as the adress.

I know, it is only very bad written in the manual, but ...

merlinknight
- 6th March 2007, 18:20
The addr is what? and the [$00] is the data to write? Do i have to do 2 write commands to do a configure?

BigWumpus
- 6th March 2007, 20:57
Sorry,

in your words, the I2C-adress is the control-word.

So you have to change the single line
control = %1001101 <--------Is this declared by PicBasic Pro that i don't have too.

to

control = %10011010 <--------Is this declared by PicBasic Pro that i don't have too.

merlinknight
- 7th March 2007, 15:50
Thank you Big Wumpus for the help and replys.

Merlin Knight