| Electronic Components Datasheet Search |
|
AN1045 Datasheet(PDF) 11 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN1045 Datasheet(HTML) 11 Page - STMicroelectronics |
|
11 / 16 page ![]() 11/16 ST7 S/W IMPLEMENTATION OF I2C BUS MASTER SetBit(I2C_SR2,AF); ClrBit(I2C_SR1,ACK); return; } delay(1); if (ValBit(PADR,SDA)) /* Test of SDA level, if high -> pb */ { SetBit(I2C_SR2,AF); ClrBit(I2C_SR1,ACK); return; } delay(1); SetBit(PADDR,SCL); /* End of the clock pulse */ SetBit(I2C_SR1,ACK); delay(1); ClrBit (PADR,SDA); SetBit(PADDR,SDA); /* Reconfigure SDA as output to proceed at the next transmission */ } /*-------------------------------------------------------------------------- ROUTINE NAME : I2C_nAck INPUT/OUTPUT : None. DESCRIPTION : Non acknoledge generation from now. COMMENTS : Transfer sequence = DATA, NACK. --------------------------------------------------------------------------*/ void I2C_nAck (void) { ClrBit(I2C_SR2,ACK); /* Non acknoledge when the master is receiver */ SetBit(PADR,SDA); /* The master pulls the SDA line high */ SetBit(PADDR,SCL); /* Output open drain to have a low level */ delay(10); ClrBit(PADDR,SCL); /* The master generates a clock pulse */ delay(10); SetBit(PADDR,SCL); /* Clock pulse complete */ ClrBit(PADR,SDA); /* The master pulls the SDA line high */ delay(3); } /*-------------------------------------------------------------------------- ROUTINE NAME : I2Cm_Init INPUT/OUTPUT : None. DESCRIPTION : I2C peripheral initialisation routine. COMMENTS : Contains inline assembler instructions in C like mode ! --------------------------------------------------------------------------*/ void I2Cm_Init (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 |