完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
源程序如下: #include #include "eepom52.h" #define uchar unsigned char #define uint unsigned int //数码管段选定义 0 1 2 3 4 5 6 7 8 9 uchar code smg_du[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90, 0x88,0x83,0xc6,0xa1,0x86,0x8e,0xff}; //断码 //数码管位选定义 uchar code smg_we[]={0xef,0xdf,0xbf,0x7f}; //uchar code smg_we[]={0x7f,0xbf,0xdf,0xef}; uchar dis_smg[8] = {0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8}; uchar smg_i = 3; //显示数码管的个位数 ***it dq = P2^4; //18b20 IO口的定义 ***it beep = P2^5; //蜂鸣器IO口定义 ***it led_moshi = P3^2; uchar a_a; uint temperature ; // bit flag_300ms ; uchar key_can; //按键值的变量 uchar menu_1; //菜单设计的变量 uint t_high = 300,t_low = 100; bit flag_lj_en; //按键连加使能 bit flag_lj_3_en; //按键连3次连加后使能 加的数就越大了 uint key_time,flag_value; //用做连加的中间变量 bit key_500ms ; uchar flag_clock; uchar zd_break_en,zd_break_value; //自动退出设置界面 uchar f_pwm_l = 0; //越小越慢 ***it dianji = P3^3; bit flag_ms; uchar Rx_buf[4],Rxnum=0; void InitUART(void) //这是串口的基本配置,配置他的波特率是9600.这些参数都是标准的。 { TMOD = 0x20; SCON = 0x50; TH1 = 0xFD; TL1 = TH1; PCON = 0x00; EA = 1; ES = 1; TR1 = 1; } /* * UART 发送一字节 */ void UART_send_byte(char dat) { SBUF = dat; while (TI == 0); TI = 0; } /* * UART 发送字符串 */ void UART_send_string(unsigned char *buf) { while (*buf != ' |