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 CCS Technical Support

why my I2C register don't change

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



Joined: 20 Apr 2014
Posts: 4

View user's profile Send private message

why my I2C register don't change
PostPosted: Mon Apr 21, 2014 7:29 pm     Reply with quote

Now I use function i2c, but when I debug program for check register value the register SSPCON SSPCON2 SSPSTAT value is 0x00 don't change value.
Why the register don't change value?

This is my code
Code:

#include <16F886.h>
#use    I2C(master,sda=pin_c4,scl=pin_c3)
void main()
{
   i2c_start();
   i2c_write(0xD0);
   i2c_write(0xff);
   i2c_stop();

}


thank a lot
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Apr 21, 2014 8:20 pm     Reply with quote

Quote:
#use I2C(master,sda=pin_c4,scl=pin_c3)
SSPCON SSPCON2 SSPSTAT value is 0x00 don't change value.

Download the CCS manual and read the #use i2c() section:
https://www.ccsinfo.com/downloads/ccs_c_manual.pdf
It says:
Quote:
Software functions are generated unless FORCE_HW is specified.
sanshiroo



Joined: 20 Apr 2014
Posts: 4

View user's profile Send private message

PostPosted: Mon Apr 21, 2014 8:59 pm     Reply with quote

PCM programmer wrote:
Quote:
#use I2C(master,sda=pin_c4,scl=pin_c3)
SSPCON SSPCON2 SSPSTAT value is 0x00 don't change value.

Download the CCS manual and read the #use i2c() section:
https://www.ccsinfo.com/downloads/ccs_c_manual.pdf
It says:
Quote:
Software functions are generated unless FORCE_HW is specified.


thank a lot

And what is the difference of use FORCE_HW and don't use
Ttelmah



Joined: 11 Mar 2010
Posts: 19499

View user's profile Send private message

PostPosted: Tue Apr 22, 2014 12:28 am     Reply with quote

Because it doesn't use the hardware (so no registers changing...).

It generates extra code, to produce a software I2C emulation driver. Slower, bulkier, can only do 'master', but has the advantage it can be used on any pins, and on the PIC's that don't have hardware - hence the reason this is the default.
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