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

正文內(nèi)容

基于單片機(jī)的實(shí)用電子稱的設(shè)計(jì)-課程設(shè)計(jì)-畢業(yè)設(shè)計(jì)-資料下載頁

2025-08-10 14:48本頁面
  

【正文】 CC=1。 } }uchar outputbyte() //實(shí)時(shí)時(shí)鐘讀取一字節(jié)(內(nèi)部函數(shù)){ uchar i。 for(i=8。 i0。 i) { ACC=ACC1。 //相當(dāng)于匯編中的 RRC ACC7=DIO。 SCLK=1。 SCLK=0。 } return(ACC)。 }void write_1302(uchar add,uchar dat) //ucAddr: DS1302地址, ucData: 要寫的數(shù)據(jù){ CE=0。 SCLK=0。 CE=1。 inputbyte(add)。 // 地址,命令 inputbyte(dat)。 // 寫1Byte數(shù)據(jù) CE=0。} uchar read_1302(uchar add) //讀取DS1302某地址的數(shù)據(jù){ uchar dat。 CE=0。 SCLK=0。 CE=1。 inputbyte(add)。 // 地址,命令 dat=outputbyte()。 // 讀1Byte數(shù)據(jù) CE=0。 return(dat)。} */void setprotect(bit flag){ if(flag) write_1302(0x8e,0x80)。 else write_1302(0x8e,0x00)。}void settime_1302(uchar add,uchar dat){ setprotect(0)。 write_1302(add,((dat/10)4)|(dat%10))。}void gettime_1302(){ sec=read_1302(0x81)。 min=read_1302(0x83)。 hour=read_1302(0x85)。 day=read_1302(0x87)。 mon=read_1302(0x89)。 week=read_1302(0x8b)。 year=read_1302(0x8d)。}void init_1302(){ uchar second=read_1302(0x81)。 if(secondamp。0x80) settime_1302(0x80,0)。}/********************************************************************************void BurstWrite1302(unsigned char *pWClock) //往DS1302寫入時(shí)鐘數(shù)據(jù)(多字節(jié)方式){ unsigned char i。 Write1302(0x8e,0x00)。 // 控制命令,WP=0,寫操作? DS1302_RST = 0。 DS1302_CLK = 0。 DS1302_RST = 1。 DS1302InputByte(0xbe)。 // 0xbe:時(shí)鐘多字節(jié)寫命令 for (i = 8。 i0。 i) //8Byte = 7Byte 時(shí)鐘數(shù)據(jù) + 1Byte 控制 { DS1302InputByte(*pWClock)。 // 寫1Byte數(shù)據(jù) pWClock++。 } DS1302_CLK = 1。 DS1302_RST = 0。} void BurstRead1302(unsigned char *pRClock) //讀取DS1302時(shí)鐘數(shù)據(jù)(時(shí)鐘多字節(jié)方式){ unsigned char i。 DS1302_RST = 0。 DS1302_CLK = 0。 DS1302_RST = 1。 DS1302InputByte(0xbf)。 // 0xbf:時(shí)鐘多字節(jié)讀命令 for (i=8。 i0。 i) { *pRClock = DS1302OutputByte()。 // 讀1Byte數(shù)據(jù) pRClock++。 } DS1302_CLK = 1。 DS1302_RST = 0。}void DS1302_TimeStop(bit flag) // 是否將時(shí)鐘停止{ unsigned char Data。 Data=Read1302(DS1302_SECOND)。 DS1302_SetProtect(0)。 if(flag) Write1302(DS1302_SECOND, Data|0x80)。 else Write1302(DS1302_SECOND, Dataamp。0x7F)。}********************************************************************************/endifincludedefine uchar unsigned chardefine uint unsigned intdefine DATA_PORT P0sbit HALT=P2^0。 sbit FS1=P2^1。 //字體模式選擇sbit MD2=P2^2。 //方式選擇sbit RST=P2^3。 //復(fù)位sbit CD=P2^4。 //數(shù)據(jù)(L)/命令(H)選擇sbit WRIT=P2^5。 //寫,低電平有效sbit CE=P2^6。 //使能,低電平有效void delay_lcd(uchar t){for(。t!=0。 t)。}// 寫數(shù)據(jù)函數(shù)//void write_data(char dat){CD=0。 //數(shù)據(jù)CE=0。 //LCD使能WRIT=0。 //寫DATA_PORT=dat。 //把數(shù)據(jù)送到P口delay_lcd(1)。 //當(dāng)晶振較高時(shí)加延時(shí)WRIT=1。 //關(guān)寫CE=1。 //關(guān)使能}//// 寫命令函數(shù)//void write_(char ){CD=1。 //命令CE=0。WRIT=0。DATA_PORT=。delay_lcd(1)。 //當(dāng)晶振較高時(shí)加延時(shí)WRIT=1。CE=1。}//// LM4229初始化函數(shù) txt zifu//void lcd_init(){write_data(0)。 write_data(0)。write_(0x40)。 //set text home addresswrite_data(30)。 write_data(0)。write_(0x41)。 //set text area。write_(0x84)。 //text attribute modewrite_(0x94)。 //text on graphic off}/*//asc 轉(zhuǎn)換及字符串輸 出 、、地址自動加一int asc(int asc){uint r。r=asc32。return r。} */void onetxtout(char a)//用的時(shí)候注意a要先轉(zhuǎn)換為asc碼{write_(0xb0)。 //設(shè)置數(shù)據(jù)自動寫a=a32。write_data(a)。 write_(0xb2)。 /* //自動復(fù)位 地址自動加一 */} // 每行32個(gè)字符031 3263 6495 。。void location(int place) //place直接取這些值{write_data(placeamp。0xff)。 //寫地址低8位write_data(place/256)。 //寫地址高8位write_(0x24)。 //設(shè)置地址} /*void string(char* str){int i。int ch。for(i=0。str[i]!=0。i++){ch=asc(str[i])。onetxtout(ch)。}} *///定義一個(gè)指定位置寫入制定字符串void write_lcd(int place,char *str){ int i。 write_data(placeamp。0xff)。 //寫地址低8位write_data(place/256)。 //寫地址高8位write_(0x24)。 //設(shè)置地址 for(i=0。str[i]!=0。i++){onetxtout(str[i])。}}void clr_lcd(){ write_lcd(0, )。 write_lcd(30, )。 write_lcd(60, )。 write_lcd(90, )。 write_lcd(120, )。 write_lcd(150, )。 write_lcd(180, )。 write_lcd(210, )。}/*//定義一個(gè)寫float型數(shù)據(jù)的函數(shù)void write_float1(float t) //小數(shù)點(diǎn)前一位數(shù){ uchar ds[4]。 uint tt。 tt=(t*100+)。 ds[0]=tt/100+0x30。 ds[1]=46。 ds[2]=tt%100/10+0x30。 ds[3]=tt%10+0x30。 onetxtout(ds[0])。 onetxtout(ds[1])。 onetxtout(ds[2])。 onetxtout(ds[3])。} */void write_float2(float t) //小數(shù)點(diǎn)前2位數(shù){ uchar ds[5]。 uint tt。 tt=(t*100+)。 ds[0]=tt/1000+0x30。 ds[1]=tt%1000/100+0x30。 ds[2]=46。 ds[3]=tt%1000%100/10+0x30。 ds[4]=tt%10+0x30。 onetxtout(ds[0])。 onetxtout(ds[1])。 onetxtout(ds[2])。 onetxtout(ds[3])。 onetxtout(ds[4])。}
點(diǎn)擊復(fù)制文檔內(nèi)容
規(guī)章制度相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1