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

正文內(nèi)容

基于單片機的電子鐘課程畢業(yè)設(shè)計論文-資料下載頁

2025-06-27 20:19本頁面
  

【正文】 w()。void write_byte(uchar Clock_Add,uchar Clock_Data)。uchar read_byte(uchar)。void write_clock_burst()。void ds1302_init()。void ds1302_task()。void lcd_disp_time1()。void dis_WD()。void ds18b20()。void alarm_clock(void)。void delay(unsigned int time) //10ms延時{ unsigned char a,b,c。 for(a=0。atime。a++) for(b=0。b10。b++) for(c=0。c120。c++)。 }void main() //主程序;{ ds1302_init()。 //初始化DS1302; beeper=1。 //初始化鬧鈴管腳;while(1) //循環(huán); { key_task()。 //掃描鍵盤子程序; ds1302_task()。 //DS1302子程序;ds18b20()。 //DS18B20子程序; alarm_clock()。 //鬧鈴子程序; disp_time()。 //時間顯示子程序; delay(55)。 //延時; beeper=1。 //鬧鈴管腳置1; }} 電子時鐘程序//主要是對時鐘芯片DS1302初始化;include include include include include void reset_3w()。void wbyte_3w(uchar)。uchar rbyte_3w()。void write_byte(uchar Clock_Add,uchar Clock_Data)。uchar read_byte(uchar)。void write_clock_burst()。void ds1302_init()。void ds1302_task()。define uint unsigned intdefine uchar unsigned char/*定義初始化時間*/uchar sec=00。 uchar min=25。uchar hour=14。uchar date=12。 uchar month=5。 uchar year=8。uchar day_of_week。 uchar clk_hour=14。 uchar clk_min=28。 //14:28 /*定義寄存器地址*/ define READ_SEC_ADD 0x81 //讀秒寄存器define READ_MIN_ADD 0x83 //讀分寄存器define READ_HOUR_ADD 0x85 //讀時寄存器define READ_DATE_ADD 0x87 //讀日寄存器define READ_MONTH_ADD 0x89 //讀月寄存器define READ_DOW_ADD 0x8B //讀周寄存器define READ_YEAR_ADD 0x8D //年寄存器define WRITE_SEC_ADD 0x80 //寫秒寄存器define WRITE_MIN_ADD 0x82 //寫分寄存器define WRITE_HOUR_ADD 0x84 //寫時寄存器define WRITE_DATE_ADD 0x86 //寫日寄存器define WRITE_MONTH_ADD 0x88 //寫月寄存器define WRITE_DOW_ADD 0x8A //寫周寄存器define WRITE_YEAR_ADD 0x8C //寫年寄存器define CLOCK_BURST_ADD 0xBE //時鐘多字節(jié)傳送模式extern void write_clock_burst()。extern void write_byte (uchar Clock_Add,uchar Clock_Data)。void sendbyte()。void reset_3w()。void wbyte_3w(uchar)。uchar rbyte_3w()。void write_byte(uchar Clock_Add,uchar Clock_Data)。uchar read_byte(uchar)。void write_clock_burst()。void ds1302_init()。void ds1302_task()。sbit SCLK = P3^5。 //定義管腳SCLKsbit IO = P3^6。 //定義管腳I/Osbit RST = P3^7。 //定義管腳RSTuchar sec,min,hour,date,month,year。uchar code hex2bcd[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, /* 0009 */ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, /* 1019 */ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, /* 2029 */ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 3039 */ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, /* 4049 */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, /* 5059 */ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, /* 6069 */ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, /* 7079 */ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, /* 8089 */ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, /* 9099 */}。uchar code bcd2hex[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, /* 0009 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, 0, 0, 0, 0, 0, /* 1019 */ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 0, 0, 0, 0, 0, 0, /* 2029 */ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 0, 0, 0, 0, 0, 0, /* 3039 */ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 0, 0, 0, 0, 0, 0, /* 4049 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 0, 0, 0, 0, 0, 0, /* 5059 */ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 0, 0, 0, 0, 0, 0, /* 6069 */ 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 0, 0, 0, 0, 0, 0, /* 7079 */ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 0, 0, 0, 0, 0, 0, /* 8089 */ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 0, 0, 0, 0, 0, /* 9099 */}。void reset_3w() / /復(fù)位子程序{ SCLK = 0。 RST = 0。 //復(fù)位DS1302,中止數(shù)據(jù)傳送 RST = 1。 //啟動數(shù)據(jù)傳送}void wbyte_3w(uchar W_Byte) //寫字節(jié)子程序{ uchar i。 for(i = 0。 i 8。 ++i) { IO = 0。 if(W_Byte amp。 0x01) { IO = 1。 } SCLK = 0。 SCLK = 1。 W_Byte = 1。 }}uchar rbyte_3w() //讀字節(jié)子程序{ uchar i。 uchar R_Byte。 uchar TmpByte。 R_Byte = 0x00。 IO = 1。 for(i = 0。 i 8。 i++) { SCLK = 1。 SCLK = 0。 TmpByte = (uchar)IO。 TmpByte = 7。 R_Byte = 1。 R_Byte |= TmpByte。 } return R_Byte。 }void write_byte(uchar Clock_Add,uchar Clock_Data) { reset_3w()。 wbyte_3w(Clock_Add)。 wbyte_3w(Clock_Data)。 reset_3w()。 }void write_clock_burst(){ reset_3w()。 //復(fù)位 wbyte_3w(CLOCK_BURST_ADD)。 //寫多字節(jié)傳送模式寄存器 wbyte_3w(hex2bcd[sec])。 //寫入初始化時間 wbyte_3w(hex2bcd[min])。 wbyte_3w(hex2bcd[hour])。 wbyte_3w(hex2bcd[date])。 wbyte_3w(hex2bcd[month])。 wbyte_3w(hex2bcd[day_of_week])。 wbyte_3w(hex2bcd[year])。 wbyte_3w(0)。 /* must write control register in burst mode */ reset_3w()。}uchar read_byte(uchar Clock_Add) // 從DS1302讀一個字節(jié){ uchar Clock_Data。 reset_3w()。 wbyte_3w(Clock_Add)。 Clock_Data = rbyte_3w()。 reset_3w()。 return(Clock_Data)。 }void ds1302_init() /* initialize time amp。 date for default value */{ reset_3w()。 wbyte_3w(0x8e)。 // 寫保護(hù)寄存器 wbyte_3w(0)。 //去保護(hù) reset_3w()。 wbyte_3w(0x90)。 // 寫涓流充電
點擊復(fù)制文檔內(nèi)容
規(guī)章制度相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1