/*----------------------------------------------- 24C02a Read/Write With LPT(Printer Port) Page Size=8 Oscilator:12Mhz ------------------------------------------------*/
#include <Virtual51.h> #define uint unsigned int #define uchar unsigned char
uchar bdata Msec,Sec,Min,Hour,Day,Week,Month,Year,Count=0,Flags=0; uchar xdata Buf[0x4000];
sbit To_5ms=Flags^0; sbit GF=Flags^1; sbit AF=Flags^2;
#define PWR LPT_Pin16 #define SDI LPT_Pin15 #define SDO LPT_Pin01 #define SCL LPT_Pin14
uchar code PIC[]= { 0x00,0x00,0x00,0x00,0x10,0x08,0x08,0x88,0x70,0x00,0x00,0x00,0xC0,0x30,0xF8,0x00, 0x00,0x00,0xE0,0x10,0x08,0x08,0x08,0x10,0x20,0x00,0x00,0xF0,0x08,0x08,0x08,0xF0, 0x00,0x00,0x10,0x08,0x08,0x88,0x70,0x00,0x00,0x40,0x20,0x20,0x20,0xC0,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x08,0x0C,0x0A,0x09,0x08,0x00,0x00,0x03,0x02,0x02,0x0F,0x02, 0x00,0x00,0x03,0x04,0x08,0x08,0x08,0x04,0x02,0x00,0x00,0x07,0x08,0x08,0x08,0x07, 0x00,0x00,0x08,0x0C,0x0A,0x09,0x08,0x00,0x00,0x06,0x09,0x09,0x05,0x0F,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0xC0,0xB8,0x84,0xB8,0xC0,0x00,0x00,0xE0,0x10,0x10,0x20,0x00, 0x00,0xE0,0x10,0x10,0x20,0x00,0x00,0xE0,0x90,0x90,0x90,0xE0,0x00,0x00,0x60,0x90, 0x90,0x90,0x20,0x00,0x00,0x60,0x90,0x90,0x90,0x20,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x1C,0xE0,0x00,0xC0,0x38,0x04,0x38,0xC0,0x00,0xF0,0x0C,0x00,0xF4,0x00,0x10, 0xFC,0x10,0x00,0xFC,0x20,0x10,0x10,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x44,0x44,0x44,0x44,0x38,0x00,0x04,0x04, 0x04,0xFC,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x06,0x01,0x00,0x00,0x00,0x01,0x06,0x00,0x03,0x04,0x04,0x02,0x00, 0x00,0x03,0x04,0x04,0x02,0x00,0x00,0x03,0x04,0x04,0x04,0x02,0x00,0x00,0x02,0x04, 0x04,0x04,0x03,0x00,0x00,0x02,0x04,0x04,0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x01,0x06,0x01,0x00,0x00,0x00,0x01,0x06,0x01,0x00,0x00,0x07,0x00,0x00, 0x07,0x04,0x00,0x07,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x07,0x04,0x04,0x04,0x04,0x04,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0xFE,0x22,0x22,0x22,0x02,0x00,0x00,0x08,0x04,0xFE,0x00,0x00, 0x00,0x00,0x08,0x00,0x00,0xFE,0x22,0x22,0x22,0x62,0xA2,0x1C,0x00,0x00,0xF0,0x48, 0x48,0x48,0x70,0x00,0x00,0x90,0x48,0x48,0x48,0xF0,0x00,0x00,0xF0,0x08,0x08,0x10, 0xFE,0x00,0x00,0x00,0x00,0x00,0xFE,0x22,0x22,0x22,0x02,0x00,0x00,0x04,0x02,0x82, 0x62,0x1C,0x00,0x00,0x08,0x00,0x0E,0xF0,0x00,0xE0,0x1C,0x02,0x1C,0xE0,0x00,0xF8, 0x06,0x00,0xF8,0x10,0x08,0x00,0xFA,0x00,0x08,0xFE,0x08,0x00,0xF0,0x48,0x48,0x48, 0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00, 0x00,0x00,0x02,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x01,0x02,0x00,0x00,0x01,0x02, 0x02,0x02,0x01,0x00,0x00,0x01,0x02,0x02,0x01,0x03,0x00,0x00,0x01,0x02,0x02,0x02, 0x03,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x03,0x02, 0x02,0x02,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x03,0x00, 0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x03,0x02,0x00,0x01,0x02,0x02,0x02, 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
uchar code Hint[]= { //OK! 0x00,0x00,0x00,0x00,0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x08,0xF8,0x08,0x80, 0x60,0x18,0x08,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x03,0x04,0x08,0x08,0x08,0x04,0x03,0x00,0x08,0x0F,0x09,0x01, 0x02,0x0C,0x08,0x00,0x00,0x00,0x00,0x0B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //Failed! 0x00,0x00,0x00,0x00,0x00,0x00,0x10,0xF0,0x10,0x10,0x90,0x10,0x30,0x00,0x00,0x80, 0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x80,0x80,0x90,0x00,0x00,0x00,0x00,0x00,0x00, 0x10,0xF0,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x80, 0x80,0x80,0x90,0xF0,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x1F,0x11,0x11,0x03,0x00,0x00,0x00,0x0C,0x12, 0x12,0x12,0x12,0x0F,0x10,0x00,0x00,0x10,0x10,0x1F,0x10,0x10,0x00,0x00,0x00,0x10, 0x10,0x1F,0x10,0x10,0x00,0x00,0x0F,0x12,0x12,0x12,0x12,0x12,0x0B,0x00,0x0F,0x10, 0x10,0x10,0x10,0x1F,0x10,0x00,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //Reading... 0x00,0x00,0x00,0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0xC0,0xA0,0xA0,0xA0,0xA0, 0xC0,0x00,0x00,0x40,0xA0,0xA0,0xA0,0xA0,0xC0,0x00,0x00,0xC0,0x20,0x20,0x20,0x44, 0xFC,0x00,0x00,0x00,0x20,0x20,0xE8,0x00,0x00,0x00,0x00,0x20,0xE0,0x40,0x20,0x20, 0xC0,0x00,0x00,0xC0,0x20,0x20,0x20,0x40,0xE0,0x20,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x04,0x07,0x04,0x00,0x01,0x02,0x04,0x00,0x03,0x04,0x04,0x04,0x04, 0x04,0x00,0x00,0x03,0x04,0x04,0x04,0x02,0x07,0x04,0x00,0x03,0x04,0x04,0x04,0x04, 0x07,0x04,0x00,0x04,0x04,0x04,0x07,0x04,0x04,0x04,0x00,0x04,0x07,0x04,0x00,0x04, 0x07,0x04,0x00,0x03,0x24,0x24,0x24,0x22,0x1F,0x00,0x00,0x00,0x00,0x06,0x06,0x00, 0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //Writing... 0x00,0x00,0x00,0x00,0x00,0x08,0xF8,0x08,0x80,0x60,0x80,0x08,0xF8,0x00,0x20,0xE0, 0x40,0x20,0x20,0x20,0x00,0x00,0x00,0x20,0x20,0xE8,0x00,0x00,0x00,0x00,0x20,0xF8, 0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x20,0x20,0xE8,0x00,0x00,0x00,0x00,0x20,0xE0, 0x40,0x20,0x20,0xC0,0x00,0x00,0xC0,0x20,0x20,0x20,0x40,0xE0,0x20,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x04,0x07, 0x04,0x04,0x04,0x00,0x00,0x00,0x04,0x04,0x04,0x07,0x04,0x04,0x04,0x00,0x00,0x03, 0x04,0x04,0x04,0x02,0x00,0x00,0x04,0x04,0x04,0x07,0x04,0x04,0x04,0x00,0x04,0x07, 0x04,0x00,0x04,0x07,0x04,0x00,0x03,0x24,0x24,0x24,0x22,0x1F,0x00,0x00,0x00,0x00, 0x06,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x00,0x00,0x00,0x00,0x00,0x00, 0x06,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
void delay() { uchar n=0; while (n<16) //延时 n*0.1 us { GF=SDI;//延时大约为 0.1-0.2 us,不能用NOP n++; } }
void Start_I2c() { SDO=1; SCL=1; delay(); SDO=0; delay(); SCL=0; delay(); }
void Stop_I2c() { SDO=0; SCL=1; delay(); SDO=1; delay(); SCL=0; delay(); }
bit SendByte(uchar Dat) { uchar Cnt;
for(Cnt=0;Cnt<8;Cnt++) { if (Dat&0x80) SDO=1; else SDO=0; Dat<<=1; SCL=1; delay(); SCL=0; delay(); } SDO=1; SCL=1; delay(); AF=SDI; SCL=0; delay(); return(AF); } uchar LoadByte() { uchar Cnt,Dat=0; SDO=1; for(Cnt=0;Cnt<8;Cnt++) { SCL=1; delay(); Dat=(Dat<<1)| SDI; SCL=0; delay(); } return(Dat); }
void Ack_I2c() { SDO=0; SCL=1; delay(); SCL=0; delay(); }
void ShowPICture(uchar byPICID) { uchar col,pg; uchar code *pC; pC = PIC + (byPICID&0x03)*128*8; for(pg = 0; pg < 8; pg++) { LCDCMR = SET_PAGE | pg; LCDCMR = SET_COL | 0; for(col = 0; col < 128; col++) LCDDR = *pC++; } }
void ShowHint(uchar aNo) { uchar col,pg; uchar code *pC; pC = Hint + (aNo&0x03)*32*8; for(pg = 6; pg < 8; pg++) { LCDCMR = SET_PAGE | pg; LCDCMR = SET_COL | 0; for(col = 0; col < 128; col++) LCDDR = *pC++; } }
void Beep() { uchar n; TGCON=0x88; for (n=0;n<20;n++) { while (~To_5ms) {} To_5ms=0; } TGCON=0x80; for (n=0;n<20;n++) { while (~To_5ms) {} To_5ms=0; } TGCON=0x88; for (n=0;n<20;n++) { while (~To_5ms) {} To_5ms=0; } TGCON=0x80; }
void main() { uint i; uchar n; TMOD=0x01; LCDCMR=Cls; LCDCMR=LCD_on; LCDCMR=INC_enb; EA=1;ET0=1;TR0=1; LPTCTR=0x00; LPTDTR=0xff; ShowPICture(0); while(1) { while (KEYPAD==0) {}; switch(KEYPAD) { case 0x70://Read LPTCTR=0x04; //打开电源 ShowHint(2); for(i=0;i<256;i++) { if ((i&7)==0) { Start_I2c(); if (SendByte(0xA0)) break; if (SendByte(i)) break; Stop_I2c(); Start_I2c(); if (SendByte(0xA1)) break; } Buf=LoadByte(); if ((i&7)==7) Stop_I2c(); else Ack_I2c(); n=i; } Beep(); LPTCTR=0x00; //关闭电源 if (n!=0xff) ShowHint(1); else ShowHint(0); break; case 0x71://Write LPTCTR=0x04; //打开电源 ShowHint(3); for(i=0;i<256;i++) { if ((i&7)==0) { Start_I2c(); if (SendByte(0xA0)) break; if (SendByte(i)) break; } if (SendByte(Buf)) break; if ((i&7)==7) { Stop_I2c(); for(n=0;n<4;n++) //Wait 15-20ms { while(~To_5ms){} To_5ms=0; } } n=i; } Beep(); LPTCTR=0x00; //关闭电源 if (n!=0xff) ShowHint(1); else ShowHint(0); break; case 0x72://Clear Buffer for(i=0;i<256;i++) Buf=0; break; default:; } while (KEYPAD) {}; } }
void timer0() interrupt 1 { TL0=0x7B; //5ms Interval,XTAL=12Mhz TH0=0xEC; To_5ms=1; if (++Count>49) { RTCON=Msec_BCD; Msec=RTCON; RTCON=Sec_BCD; Sec=RTCON; RTCON=Min_BCD; Min=RTCON; RTCON=Hou_BCD; Hour=RTCON; RTCON=Day_BCD; Day=RTCON; RTCON=Week_BCD; Week=RTCON; RTCON=Mon_BCD; Month=RTCON; RTCON=Year_BCD; Year=RTCON; Count=0; } } |