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

can i use the #USE i2c directive inside a function ?

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







can i use the #USE i2c directive inside a function ?
PostPosted: Fri Apr 16, 2004 3:22 pm     Reply with quote

can i use a preprocessor #USE i2c inside a function ?

im trying to make a 16f876 work in both MASTER and SLAVE mode , depending on which function is called. the following functin resumes SLAVE status , but it doesnt seem to work properly ..

Code:

void i2c_tx(BYTE i2c_addr,BYTE i2c_data){
#use I2C(MASTER,sda=PIN_C4,scl=PIN_C3,FAST)
delay_cycles(10);
    i2c_start();
     i2c_write(i2c_addr);
     i2c_write(i2c_data);
     i2c_stop();

#use I2C(SLAVE,sda=PIN_C4,scl=PIN_C3,address=0xa0,FORCE_HW)

     }



what is it that im doing wrong?
Coder
Guest







PostPosted: Fri Apr 16, 2004 3:53 pm     Reply with quote

hmm ok .. you can use the directive inside a function ..

problem solved. it was another function not being initialized
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