| 전자부품 데이터시트 검색엔진 |
|
AN1045 데이터시트(PDF) 14 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN1045 데이터시트(HTML) 14 Page - STMicroelectronics |
|
14 / 16 page ![]() 14/16 ST7 S/W IMPLEMENTATION OF I2C BUS MASTER SetBit(PADDR,SDA); delay(10); ClrBit(PADDR,SCL); /* Waits the master takes the control of SDA */ delay(10); SetBit(PADDR,SCL); delay(5); ClrBit(PADDR,SDA); /* The master releases the SDA line */ SetBit(I2C_SR1,ACK); /* ACK=1: Acknowledge sent by the master */ } /*-------------------------------------------------------------------------- ROUTINE NAME : I2Cm_Tx INPUT/OUTPUT : send_tab and n, the number of data to transmit (with 2 addresses) / None. DESCRIPTION : Transmit data buffer. COMMENTS : Most significant bytes first. --------------------------------------------------------------------------*/ void I2Cm_Tx (char * buffout,char nb) { SetBit(PADDR,SDA); /* Configure SDA as an output to send data */ for (j=nb;j!=0xFF;j--) { /* 2 addresses and 3 data to send: from X=n downto X=0 */ flag=0; if ((j==(nb-2))&&(ValBit(I2C_SR1,RCPT))) { I2Cm_Start(); /* Start condition */ j=nb; /* EEPROM @ with the LSB at 1 to send */ flag=1; } count=1; I2C_DR=buffout[j]; if (flag==1) I2C_DR=I2C_DR|1; /* If master receiver, the address to send is A1 */ do { I2Cm_TxData(); /* Sending of data bit per bit, MSB first */ count*=2; }while(count!=0); wait_Ack(); /* Wait ACK from the slave */ if(!ValBit(I2C_SR1,ACK)) SetBit(I2C_SR2,AF); |
|
|
링크 URL |
| ALLDATASHEET 가 귀하에 도움이 되셨나요? [ DONATE ] |
Alldatasheet는? | 광고문의 | 운영자에게 연락하기 | 개인정보취급방침 | 링크 투 데이터시트 | 링크교환 | 제조사별 검색 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 |