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

pic16f1787 i2c init problem[solved]

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



Joined: 12 Dec 2016
Posts: 2

View user's profile Send private message

pic16f1787 i2c init problem[solved]
PostPosted: Mon Dec 12, 2016 4:44 am     Reply with quote

Hello, i am trying just to get i2c initialization on pic16f1787. I use mplab 8.92 ide and ccs v.4 c compiler. Here is my short init code:

Code:
#include <16F1787.h>
#device PIC16F1787
 
 
#use i2c(MASTER, SDA=PIN_C4, SCL=PIN_C3, FAST=1000000) 

 
#use delay(clock=20000000)

 int8 a;


void main()   {


set_tris_c(0b00011000);

while(1)
{
a=3;
}


}


than i run mplab sim debugger, and look to - Watch window in mplab, i can see only:

ssp1add = 0x00
ssp1con1 = 0x00
ssp1con2 = 0x00
ssp1con3 = 0x00

so i think that by some reason i2c initialization dont work.


Last edited by kosopet on Mon Dec 12, 2016 5:04 am; edited 1 time in total
kosopet



Joined: 12 Dec 2016
Posts: 2

View user's profile Send private message

i2c init
PostPosted: Mon Dec 12, 2016 5:04 am     Reply with quote

just solved it was needed FORCE_HW )
Ttelmah



Joined: 11 Mar 2010
Posts: 19260

View user's profile Send private message

PostPosted: Mon Dec 12, 2016 5:48 am     Reply with quote

Or. use:


#use i2c(MASTER, I2C1, FAST=1000000)

This selects the hardware pins, and generates FORCE_HW as well.
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