| Electronic Components Datasheet Search |
|
AN1045 Datasheet(PDF) 12 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN1045 Datasheet(HTML) 12 Page - STMicroelectronics |
|
12 / 16 page ![]() 12/16 ST7 S/W IMPLEMENTATION OF I2C BUS MASTER { count=0; I2C_SR1=0; I2C_SR2=0; I2C_DR=0; err_status=0; t_count_err=0; r_count_err=0; SetBit(I2C_SR1,M_SL); /* Master mode: M_SL=1 */ } /*-------------------------------------------------------------------------- ROUTINE NAME : I2Cm_TxData INPUT/OUTPUT : data byte to be transfered(MSB first) / None. DESCRIPTION : Transmits a data bit. COMMENTS : Transfer sequence = DATA, ACK, ... --------------------------------------------------------------------------*/ void I2Cm_TxData (void) { SetBit(PADDR,SCL); /* Low level on SCL */ if (I2C_SR2) /* Check the communication error status */ { err_status++; t_count_err++; if (t_count_err==0) t_count_err++; } else /* If no error */ { if (ValBit(I2C_DR,7)) /* Send data bit per bit, MSB first */ SetBit(PADR,SDA); /* Send a one */ else ClrBit(PADR,SDA); /* Send a zero */ I2C_DR*=2; ClrBit(PADDR,SCL); /* High state on SCL */ delay(10); } } /*-------------------------------------------------------------------------- ROUTINE NAME : I2Cm_RxData INPUT/OUTPUT : Last byte to receive flag (active high) / Received data bit. DESCRIPTION : Receive a data byte. COMMENTS : Transfer sequence = DATA, ACK, EV7... --------------------------------------------------------------------------*/ void I2Cm_RxData (void) |
|
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |