View previous topic :: View next topic |
Author |
Message |
croc4
Joined: 02 Sep 2005 Posts: 10
|
Does version 3.203 support HW I2C for 16F88? |
Posted: Fri Sep 02, 2005 5:33 pm |
|
|
anybody know, I don't want to upgrade if I don't have to and at the moment
my code for talking to a slave 16F88 is not working, the slave is not acking the address, pretty basic problem I know, but I "think" the code is correct so I'm starting to question my compiler version |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Sep 02, 2005 6:20 pm |
|
|
Do you have PCW or PCWH ? If so, read this thread
which talks about checking to see if H/W i2c is enabled
for Slave i2c, by using the Device Editor. See the post
that's a little bit below the half-way point in thread.
http://www.ccsinfo.com/forum/viewtopic.php?t=23792
If that's not the problem, or if you just have the plain PCM compiler
then post the code for the function in which you see the problem.
Also indicate the line of code within the function that's causing
the problem. |
|
![](templates/subSilver/images/spacer.gif) |
croc4
Joined: 02 Sep 2005 Posts: 10
|
|
Posted: Fri Sep 02, 2005 7:32 pm |
|
|
I have PCWH I believe (no near my dev system at the moment), I can't point to a part of the code that is failing, I don't think that it even gets that far. Here is how I understand it, and I could be totaly wrong.
I have set the device up in slave mode (#use I2C scl=PIN_B4, sda=PIN_B1, address=0xA4, force_hw) (typing from memory, but you get the jist)
and have a while loop in the main function just looping, not shouldn't the device 'ack' the address I gave it?, I would think it would, this is what I'm calling a failure, I do not see the device ack the data line when it is addressed on the bus, this (the 'ack') should be totally separate from SW correct? |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Sep 02, 2005 8:03 pm |
|
|
The 16F88 data sheet says:
Quote: | When an address is matched, or the data transfer after
an address match is received, the hardware automatically
will generate the Acknowledge (ACK) pulse and
then load the SSPBUF register with the received value
currently in the SSPSR register. |
When you get back into your office, you should check
if H/W i2c slave is enabled for the 16F88 with your version
of the compiler. It may not be, and that would cause the
problem. Use the Device Editor in PCWH to check for
this, and to fix it if necessary. |
|
![](templates/subSilver/images/spacer.gif) |
croc4
Joined: 02 Sep 2005 Posts: 10
|
|
Posted: Fri Sep 02, 2005 8:31 pm |
|
|
Just checked it and it was marked as "true" for I2C slave.... |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
![](templates/subSilver/images/spacer.gif) |
croc4
Joined: 02 Sep 2005 Posts: 10
|
|
Posted: Sat Sep 03, 2005 12:25 pm |
|
|
thanks for that thread, but I'm not using the setup_spi() routine, so that can't be it, well it seems that the tools that I am using should support HW I2C so maybe I have mad a bone head mistake, I'll go over every thing again to see if I may have missed something, Thanks for your help PCM pro, I'll also continue to go through this forum, that lots of good stuff here |
|
![](templates/subSilver/images/spacer.gif) |
croc4
Joined: 02 Sep 2005 Posts: 10
|
|
Posted: Tue Sep 06, 2005 9:51 pm |
|
|
found the problem, brain fart!!!!! I was using 7 bit addressing and not eight, duh!
I set the device up as addr 0x52, and sending in 0xA4 (which translates to 0x52 on the bus), once I set it to 0xA4 and sent in 0xA4 the part ack'd as it is supposed to.
Thanks for the help and sorry for the trouble ;-/ |
|
![](templates/subSilver/images/spacer.gif) |
|