diff --git a/2-1/main.c b/2-1/main.c index 3d0e1fa..e66979a 100644 --- a/2-1/main.c +++ b/2-1/main.c @@ -1,4 +1,4 @@ -// receiver +// sender #include "STC15F2K60S2.H" #include "sys.h" #include "uart2.h" diff --git a/3-2/3-2.uvopt b/3-2/3-2.uvopt new file mode 100644 index 0000000..ddd7689 --- /dev/null +++ b/3-2/3-2.uvopt @@ -0,0 +1,197 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + Target 1 + 0x0 + MCS-51 + + 35000000 + + 1 + 1 + 1 + 0 + 0 + + + 0 + 65535 + 0 + 0 + 0 + + + 120 + 65 + 8 + .\Listings\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 1 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + -1 + + + + + + + + + + + + + + + 0 + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + Source Group 1 + 0 + 0 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + .\main.c + main.c + 0 + 0 + + + 1 + 2 + 4 + 0 + 0 + 0 + .\STCBSP_V3.6.LIB + STCBSP_V3.6.LIB + 0 + 0 + + + +
diff --git a/3-2/3-2.uvproj b/3-2/3-2.uvproj index e69de29..6cc9ae8 100644 --- a/3-2/3-2.uvproj +++ b/3-2/3-2.uvproj @@ -0,0 +1,395 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + Target 1 + 0x0 + MCS-51 + 0 + + + STC15F2K60S2 Series + STC + IRAM(0-0xFF) XRAM(0-0x6FF) IROM(0-0xEFF8) CLOCK(35000000) MODP2 + + "LIB\STARTUP.A51" ("Standard 8051 Startup Code") + + 62472 + STC15F2K60S2.H + + + + + + + + + + + 0 + 0 + + + + STC\ + STC\ + + 0 + 0 + 0 + 0 + 1 + + .\Objects\ + 3-2 + 1 + 0 + 1 + 1 + 1 + .\Listings\ + 0 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + 65535 + + + S8051.DLL + + DP51.DLL + -pDP8051 + S8051.DLL + + TP51.DLL + -p51 + + + + 0 + 0 + 0 + 0 + 16 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + + + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + + 0 + -1 + + + + + + + + + + + + + + + + + + + 0 + 0 + 0 + 0 + 0 + -1 + + 0 + + + + + + + 0 + + + + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0xffff + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0xeff9 + + + 0 + 0x0 + 0x100 + + + 0 + 0x0 + 0x700 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + 0 + 0 + 1 + 0 + 1 + 3 + 8 + 2 + 1 + 1 + 0 + 0 + + + + + ..\inc + + + + 0 + 1 + 0 + 0 + + + + + + + + + 0 + 0 + 1 + 0 + 2 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Source Group 1 + + + main.c + 1 + .\main.c + + + STCBSP_V3.6.LIB + 4 + .\STCBSP_V3.6.LIB + + + + + + + +
diff --git a/3-2/main.c b/3-2/main.c index 8244068..b840499 100644 --- a/3-2/main.c +++ b/3-2/main.c @@ -1,30 +1,35 @@ -// receiver +// sender #include "STC15F2K60S2.H" -#include "displayer.h" #include "sys.h" -#include "uart2.h" +#include "IR.h" code unsigned long SysClock = 11059200; //必须。定义系统工作时钟频率(Hz),用户必须修改成与实际工作频率(下载时选择的)一致 -char buffer[10], *match; -int sum; +char num[5]={0x01,0x03,0x05,0x07,0x09}; +int countdown=3; -void sendBack() +void sendData() { int i; - for (i = 0; i < 5; i++) + if(countdown) { - sum += buffer[i]; + countdown--; + } + countdown=10; + IrPrint(num,5); + for(i=0;i<5;i++) + { + num[i]++; + if(num[i]>0x09) + { + num[i]=0x01; + } } - // print least 8 bits - LedPrint(sum & 0xFF); } void main() { - Uart2Init(1200, Uart2Usedfor485); //初始化串口2,波特率为2400 - DisplayerInit(); - SetUart2Rxd(buffer, 5, match, 0); //设置串口2接收缓冲区,接收5个字节,匹配0个字节 - SetEventCallBack(enumEventUart2Rxd, sendBack); + IrInit(NEC_R05d); + SetEventCallBack(enumEventSys1S,sendData); MySTC_Init(); while (1) {