freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

i2c課程設(shè)計--基于arm的i2c接口設(shè)計-資料下載頁

2025-06-06 15:47本頁面
  

【正文】 define STO (14) define STA (15) define I2CEN (16) define lastbyte 1 //I2C 初始化 void I2C_init(uint32 fi2c) { if(fi2c400000) fi2c = 400000。 PINSEL0 = (PINSEL0 amp。 0xffffff0f) | 0x50。 I2SCLH = (Fpclk / fi2c+1) / 2。 I2SCLL = (Fpclk / fi2c) / 2。 I2CONCLR = STA | SI | AA。 I2CONSET = I2CEN。 } //發(fā)送起始信號 void I2C_Start(void) { I2CONSET = STA。 while(I2STAT!=0x08)。 I2CONCLR = STA。 } //發(fā)送停 止信號 void I2C_Stop(void) { I2CONSET = STO。 I2CONCLR = SI。 } //寫一字節(jié)數(shù)據(jù) void WriteByte(uint8 data) { I2DAT = data。 17 I2CONCLR = SI。 } //寫地址 void WriteAddr(uint8 Mode) { WriteByte(Mode)。 if(Mode==Read_C01) { while(I2STAT!=0x40)。 } else { while(I2STAT!=0x18)。 } } //寫數(shù)據(jù) void WriteData(uint8 data) { WriteByte(data)。 while(I2STAT!=0x28)。 } //讀字節(jié)數(shù)據(jù) uint8 ReadByte(uint8 last) { if(last) { I2CONCLR=AA。 I2CONCLR=SI。 while(I2STAT!=0x58)。 } else { I2CONSET=AA。 I2CONCLR=SI。 while(I2STAT!=0x50)。 } return(I2DAT)。 } //寫 24C01 void WriteC01(uint8 StartAddr,uint8 CountByte,uint8 *i2c_buf) { 18 uint8 i=0。 I2C_Start()。 WriteAddr(Write_C01)。 WriteData(StartAddr)。 for(i=0。iCountByte。i++) { WriteData(i2c_buf[i])。 } I2C_Stop()。 } //讀 24C01 void ReadC01(uint8 StartAddr,uint8 CountByte,uint8 *i2c_buf) { uint8 i=0。 //設(shè)置讀指針 I2C_Start()。 WriteAddr(Write_C01)。 WriteData(StartAddr)。 I2C_Stop()。 //開始讀數(shù)據(jù) I2C_Start()。 WriteAddr(Read_C01)。 for(i=0。iCountByte1。i++) { i2c_buf[i]=ReadByte(!lastbyte)。 } i2c_buf[i]=ReadByte(lastbyte)。 I2C_Stop()。 } //延時函數(shù) void DelayMs(uint8 dly) { uint8 i。 for(。 dly0。 dly) for(i=0。 i1000。 i++)。 }
點(diǎn)擊復(fù)制文檔內(nèi)容
畢業(yè)設(shè)計相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1