00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "asuro.h"
00014 #include <stdlib.h>
00015
00016 static unsigned char ocr2 = 0x91;
00017
00018 void InitIRDetect(void)
00019 {
00020 UCSRB = 0;
00021 DDRD |= (1 << DDD1);
00022 PORTD &= ~(1 << PD1);
00023 OCR2 = ocr2;
00024 }
00025
00026 void InitUart(void)
00027 {
00028 OCR2 = 0x91;
00029 }
00030
00031 int main(void)
00032 {
00033
00034 unsigned char sw;
00035
00036 Init();
00037
00038 DDRD |= (1 << DDD1);
00039 PORTD &= ~(1 << PD1);
00040
00041
00042 while (1)
00043 {
00044 UCSRB = 0;
00045 OCR2 = 0xFE;
00046
00047 if (PIND & (1 << PD0))
00048 StatusLED(GREEN);
00049 else
00050 StatusLED(RED);
00051
00052 sw = PollSwitch();
00053 if (sw & 0x01)
00054 ocr2 = 0xFE;
00055 if (sw & 0x02)
00056 ocr2 = 0xFD;
00057 if (sw & 0x04)
00058 ocr2 = 0xFB;
00059 if (sw & 0x08)
00060 ocr2 = 0xF7;
00061 if (sw & 0x10)
00062 ocr2 = 0xEF;
00063 if (sw & 0x20)
00064 ocr2 = 0x90;
00065
00066 if (sw)
00067 {
00068 OCR2 = 0x91;
00069 PrintInt(sw);
00070 SerPrint(" ");
00071 PrintInt(ocr2);
00072 SerPrint("\r\n");
00073 }
00074
00075 }
00076 return 0;
00077 }