Coder Guest
|
can i use the #USE i2c directive inside a function ? |
Posted: Fri Apr 16, 2004 3:22 pm |
|
|
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? |
|