#include #include #include #include #include #define RELAY1 P12 #define RELAY2 P15 #define RED P01 #define GREEN P04 #define BLUE P03 #define PWM_GREEN PWM3L #define PWM_BLUE PWM5L #define PWM_RED PWM4L #define BUTTON1 P00 #define BUTTON2 P10 #define MAXCMD 64 __sbit BIT_TMP; __sbit S1; __sbit S2; unsigned char crc; unsigned char getchar1(void) { UINT8 c; while (!RI); c = SBUF; RI = 0; return (c); } int putchar1 (unsigned char c) { crc += c; TI = 0; SBUF = c; while(TI==0); return 0; } void sendpkt(unsigned char cmd, unsigned int len, unsigned char *buffer) { unsigned int i; crc = 0; putchar1(0x55); putchar1(0xAA); putchar1(0x03); putchar1(cmd); putchar1(len >> 8); putchar1(len & 0xFF); for (i=0; i