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

正文內(nèi)容

智能酒駕檢測(cè)系統(tǒng)概述-閱讀頁(yè)

2025-07-14 03:08本頁(yè)面
  

【正文】 晶寫(xiě)入指令函數(shù){ rs=0。 //送入指令 delayms(1)。//拉高使能端 delayms(1)。//完成高脈沖}/******************液晶寫(xiě)入數(shù)據(jù)函數(shù)************************/void write_1602dat(uchar dat){ rs=1。 //送入數(shù)據(jù) delayms(1)。 delayms(1)。}/******************液晶寫(xiě)入字符函數(shù)************************/void LCD_Write_Char(uchar x,uchar y,uchar Data) { if (y == 0) { write_1602(0x80 + x)。 } write_1602dat( Data)。 s ++。 } } void LCD_Clear(void) //液晶清屏函數(shù) { write_1602(0x01)。 }/******************液晶初始化函數(shù)************************/void lcd_init()//液晶初始化函數(shù){ wr=0。 //設(shè)置液晶工作模式 16x2顯示, 5x7點(diǎn)陣,8位數(shù)據(jù)接口 write_1602(0x0c)。 //整屏不移動(dòng),指針加一 write_1602(0x01)。 //定義變量 bai=dat/100。 //取十位 gw=dat%10。 //設(shè)置寫(xiě)入數(shù)據(jù)地址 write_1602dat(0x30+bai)。 write_1602dat(0x30+gw)。amp。 sbit RESET = P1^1。 sbit SCK = P1^3。 sbit DRDY = P1^5。t surport Hard SPI Interface modeendif/* 通信寄存器bit定義 */enum{ /* 寄存器選擇 RS2 RS1 RS0 */ REG_COMM = 0x00, /* 通信寄存器 */ REG_SETUP = 0x10, /* 設(shè)置寄存器 */ REG_CLOCK = 0x20, /* 時(shí)鐘寄存器 */ REG_DATA = 0x30, /* 數(shù)據(jù)寄存器 */ REG_ZERO_CH1 = 0x60, /* CH1 偏移寄存器 */ REG_FULL_CH1 = 0x70, /* CH1 滿量程寄存器 */ REG_ZERO_CH2 = 0x61, /* CH2 偏移寄存器 */ REG_FULL_CH2 = 0x71, /* CH2 滿量程寄存器 */ /* 讀寫(xiě)操作 */ WRITE = 0x00, /* 寫(xiě)操作 */ READ = 0x08, /* 讀操作 */ /* 通道 */ CH_1 = 0, /* AIN1+ AIN1 */ CH_2 = 1, /* AIN2+ AIN2 */ CH_3 = 2, /* AIN1 AIN1 */ CH_4 = 3 /* AIN1 AIN2 */}。/* 時(shí)鐘寄存器bit定義 */enum{ CLKDIS_0 = 0x00, /* 時(shí)鐘輸出使能 (當(dāng)外接晶振時(shí),必須使能才能振蕩) */ CLKDIS_1 = 0x10, /* 時(shí)鐘禁止 (當(dāng)外部提供時(shí)鐘時(shí),設(shè)置該位可以禁止MCK_OUT引腳輸出時(shí)鐘以省電 */ /* (CLKDIV=0 )或?yàn)? (CLKDIV=1 ),CLK 應(yīng)置 “0”。當(dāng)使用主時(shí)鐘為 1MHz 時(shí),強(qiáng)烈建議將時(shí)鐘寄存器設(shè)為80H, 此時(shí)數(shù)據(jù)輸出更新率為4Hz, 輸出一個(gè)新數(shù)據(jù) */ ZERO_0 = 0x00, ZERO_1 = 0x80}。static void TM7705_Send8Bit(uint8_t _data)。static void TM7705_WriteByte(uint8_t _data)。static uint8_t TM7705_ReadByte(void)。static uint32_t TM7705_Read3Byte(void)。static void TM7705_ResetHard(void)。/*********************************************************************************************************** 函 數(shù) 名: bsp_InitTM7705* 功能說(shuō)明: 配置STM32的GPIO和SPI接口,用于連接 TM7705* 形 參: 無(wú)* 返 回 值: 無(wú)**********************************************************************************************************/void bsp_InitTM7705(void){ifdef SOFT_SPI /* 軟件SPI */ /* 配置REST口線為推挽輸出,缺省輸出高電平 */ /* 配置CS口線為推挽輸出,缺省輸出高電平 */ /* 配置SCK口線為推挽輸出,缺省輸出高電平 */ /* 配置DIN口線為推挽輸出,缺省輸出高電平 */ /* 配置DOUT口線為輸入浮空模式 */ /* 配置DOUT口線為輸入上拉模式 */endif bsp_DelayMS(10)。 /* 硬件復(fù)位 */ /* 在接口序列丟失的情況下,如果在DIN 高電平的寫(xiě)操作持續(xù)了足夠長(zhǎng)的時(shí)間(至少 32個(gè)串行時(shí)鐘周期), TM7705 將會(huì)回到默認(rèn)狀態(tài)。 TM7705_SyncSPI()。 /* 配置時(shí)鐘寄存器 */ TM7705_WriteByte(REG_CLOCK | WRITE | CH_1)。 /* 刷新速率50Hz */ //TM7705_WriteByte(CLKDIS_0 | CLK_4_9152M | FS_500HZ)。 /* 內(nèi)部自校準(zhǔn) CH1 */ bsp_DelayMS(5)。 //for (i = 0。 i++)。 bsp_DelayMS(1)。 bsp_DelayMS(2)。 bsp_DelayMS(1)。復(fù)位后要延時(shí)500us再訪問(wèn) */ CS_0()。 TM7705_Send8Bit(0xFF)。 TM7705_Send8Bit(0xFF)。}/*********************************************************************************************************** 函 數(shù) 名: TM7705_Send8Bit* 功能說(shuō)明: 向SPI總線發(fā)送8個(gè)bit數(shù)據(jù)。* 形 參: _data : 數(shù)據(jù)* 返 回 值: 無(wú)**********************************************************************************************************/static void TM7705_Send8Bit(uint8_t _data){ uint8_t i。 i 8。 0x80) { DI_1()。 } SCK_0()。 TM7705_Delay()。 TM7705_Delay()。 不帶CS控制。 uint8_t read = 0。 i 8。 TM7705_Delay()。 if (DO_IS_HIGH()) { read++。 TM7705_Delay()。}/*********************************************************************************************************** 函 數(shù) 名: TM7705_WriteByte* 功能說(shuō)明: 寫(xiě)入1個(gè)字節(jié)。 TM7705_Send8Bit(_data)。}/*********************************************************************************************************** 函 數(shù) 名: TM7705_Write3Byte* 功能說(shuō)明: 寫(xiě)入3個(gè)字節(jié)。 TM7705_Send8Bit((_data 16) amp。 TM7705_Send8Bit((_data 8) amp。 TM7705_Send8Bit(_data)。}/*********************************************************************************************************** 函 數(shù) 名: TM7705_ReadByte* 功能說(shuō)明: 從AD芯片讀取一個(gè)字(16位)* 形 參: 無(wú)* 返 回 值: 讀取的字(16位)**********************************************************************************************************/static uint8_t TM7705_ReadByte(void){ uint8_t read。 read = TM7705_Recive8Bit()。 return read。 CS_0()。 read = 8。 CS_1()。}/*********************************************************************************************************** 函 數(shù) 名: TM7705_Read3Byte* 功能說(shuō)明: 讀3字節(jié)數(shù)據(jù)* 形 參: 無(wú)* 返 回 值: 讀取到的數(shù)據(jù)(24bit) 高8位固定為0.**********************************************************************************************************/static uint32_t TM7705_Read3Byte(void){ uint32_t read。 read = TM7705_Recive8Bit()。 read += TM7705_Recive8Bit()。 read += TM7705_Recive8Bit()。 return read。 自校準(zhǔn)時(shí)間較長(zhǎng),需要等待。 for (i = 0。 i++) { if (DRDY_IS_LOW()) { break。 /* 調(diào)試語(yǔ)句. 用語(yǔ)排錯(cuò) */ // printf(重新同步SPI接口時(shí)序\r\n)。 /* 同步SPI接口時(shí)序 */ bsp_DelayMS(5)。 對(duì)于8位的寄存器,取32位形參的低8bit* 返 回 值: 無(wú)**********************************************************************************************************/void TM7705_WriteReg(uint8_t _RegID, uint32_t _RegValue){ uint8_t bits。 break。 break。 } TM7705_WriteByte(_RegID | WRITE)。 } else /* 24bit */ { TM7705_Write3Byte(_RegValue)。 對(duì)于8位的寄存器,取32位形參的低8bit* 返 回 值: 讀到的寄存器值。 uint32_t read。 break。 break。 } TM7705_WriteByte(_RegID | READ)。 } else if (bits == 8) { read = TM7705_ReadByte()。 } return read。此函數(shù)執(zhí)行過(guò)程較長(zhǎng),* 實(shí)測(cè)約 180ms* 形 參: _ch : ADC通道,1或2* 返 回 值: 無(wú)**********************************************************************************************************/void TM7705_CalibSelf(uint8_t _ch){ if (_ch == 1) { /* 自校準(zhǔn)CH1 */ TM7705_WriteByte(REG_SETUP | WRITE | CH_1)。/* 啟動(dòng)自校準(zhǔn) */ TM7705_WaitDRDY()。 /* 寫(xiě)通信寄
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評(píng)公示相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1