CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Does version 3.203 support HW I2C for 16F88?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
croc4



Joined: 02 Sep 2005
Posts: 10

View user's profile Send private message

Does version 3.203 support HW I2C for 16F88?
PostPosted: Fri Sep 02, 2005 5:33 pm     Reply with quote

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
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Sep 02, 2005 6:20 pm     Reply with quote

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.
croc4



Joined: 02 Sep 2005
Posts: 10

View user's profile Send private message

PostPosted: Fri Sep 02, 2005 7:32 pm     Reply with quote

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?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Sep 02, 2005 8:03 pm     Reply with quote

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.
croc4



Joined: 02 Sep 2005
Posts: 10

View user's profile Send private message

PostPosted: Fri Sep 02, 2005 8:31 pm     Reply with quote

Just checked it and it was marked as "true" for I2C slave....
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Sep 03, 2005 12:38 am     Reply with quote

OK, then because you're using PCWH, you should read this thread
about setup_spi() and Hardware i2c. Could this be the problem ?
http://www.ccsinfo.com/forum/viewtopic.php?t=19225
croc4



Joined: 02 Sep 2005
Posts: 10

View user's profile Send private message

PostPosted: Sat Sep 03, 2005 12:25 pm     Reply with quote

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
croc4



Joined: 02 Sep 2005
Posts: 10

View user's profile Send private message

PostPosted: Tue Sep 06, 2005 9:51 pm     Reply with quote

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 ;-/
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group