PDA

View Full Version : Adventures in I2C Communications...



SmugWimp
- 5th February 2009, 04:42
Folks,

I guess I have a hard time wrapping my head around the intricacies of I2C programming. I just cannot get it to work, and cannot seem to get any positive feedback from my Application to see where I am going wrong with this...

I am working on a different project (http://www.picbasic.co.uk/forum/showthread.php?t=10346) and cannot seem to get it working. Should be simple but...

I am trying to communicate with another chip (NS73M Radio Transmitter) via I2C.

I am using a 16F84A PIC as my master. the NS73M is the slave.

What makes me think that I am not doing it correctly (or just dont understand it) is I have my Clock going to a PIN (B.2), and Data going to a Pin (B.1).

In PBP, the manual states the syntax for I2CWRITE is:

I2CWrite DataPin,ClockPin,ControlAddress,DestAddress,[Dest Value](,optional label)

I tried using the optional label ("If the optional Label is included, this label will be jumped to if an acknowledge is not received from the I2C device.")

But I can remove the clock connection, and it does not jump. I can remove the data connection, and it does not jump. I can remove BOTH clock AND data connections, and it does not jump.

In fact, it will ONLY use the jump label IF I swap the data/clock connections. in other words, swap pins so PIC data out is connected to the NS73 Clock Input, and the PIC Clock is connected to the NS73 data input.

Somehow, something isnt working right... at least , that is the impression I get.

Can someone explain a little better what I should be looking for, so I can troubleshoot this a bit more competently?

I am pretty much at a loss for this... Any assistance would be appreciated!!

Cheers!

SmugWimp

Archangel
- 5th February 2009, 06:46
Just curious, do you have pullup resistors on the I²C lines?

SmugWimp
- 5th February 2009, 13:16
Yes, 1K on each; Data and Clock, to +3.3v