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

I2C hardware module issue

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



Joined: 15 Sep 2008
Posts: 8

View user's profile Send private message

I2C hardware module issue
PostPosted: Mon Sep 15, 2008 4:29 am     Reply with quote

Hi,

Does anyone know why my program hangs when using the I2C harware functions on a PIC18F6722?

When I try to do an I2C start the program just hangs.

Here is the code
Code:

#use delay(clock=3684000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,stream=GUI,errors)
#use i2c(master, sda=PIN_C4, scl=PIN_C3, stream=ONE, FORCE_HW)
#use i2c(master, sda=PIN_D5, scl=PIN_D6, stream=OTHER, FORCE_HW)

void initialise_ADC()
{
   i2c_start(ONE);//initiate a start condition
   output_low(PIN_C0);
   i2c_write(ADC_WRITE_ADDR);//send device write address
   i2c_write(ADC_SET_CONVERT);//set ADC configuration
   i2c_stop();//terminate comms
}
Ttelmah
Guest







PostPosted: Mon Sep 15, 2008 7:21 am     Reply with quote

If using streams, the write, and stop commands also need to use the stream identifier.
What happens if you just setup one port, and don't use stream identifiers at all?. Prove the hardware works.
Set the speed in the I2C setup as well.
What compiler version?.

Best Wishes
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