1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
| #include "display.h"
unsigned char smgw[] = {0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80}; unsigned char smgd[] = {0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F,0x00,0x40}; char smgbuf[8],num = 0,point_flag = 0;
void display() { num++; if(num >= 8) num = 0; P0 = 0xff; select_channel(7); P0 = smgw[num]; select_channel(6); if(point_flag&&num == 1) P0 = ~(smgd[smgbuf[num]] | 0x80); else P0 = ~smgd[smgbuf[num]]; select_channel(7); }
void display_temp() { int temp; point_flag = 1; if(temp_count >= 50) { temp = read_temp(); } smgbuf[0] = temp / 1000; smgbuf[1] = temp % 1000 / 100; smgbuf[2] = temp % 100 / 10; smgbuf[3] = temp % 10; }
void display_AData() { unsigned char dat; point_flag = 0; if(ADCount >= 50) { ADCount = 0; dat = ADConvert(0x03); } smgbuf[0] = dat / 100; smgbuf[1] = dat % 100 / 10; smgbuf[2] = dat % 10; }
void display_ds1302() { point_flag = 0; smgbuf[0] = Read_Ds1302(0x85) / 16; smgbuf[1] = Read_Ds1302(0x85) % 16; smgbuf[2] = 11; smgbuf[3] = Read_Ds1302(0x83) / 16; smgbuf[4] = Read_Ds1302(0x83) % 16; smgbuf[5] = 11; smgbuf[6] = Read_Ds1302(0x81) / 16; smgbuf[7] = Read_Ds1302(0x81) % 16; }
|