久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

標題: 一款基于錦銳單片機遙控接收1527碼的軟解碼程序 [打印本頁]

作者: libodianzi    時間: 2024-3-25 16:08
標題: 一款基于錦銳單片機遙控接收1527碼的軟解碼程序
一款基于錦銳單片機遙控接收1527碼的軟解碼程序

  1. #ifndef _MAIN_C_
  2. #define _MAIN_C_
  3. /*********************************************************************************************************************/
  4. #include "ca51f_config.h"
  5. #include "includes\ca51f3sfr.h"
  6. #include "includes\ca51f3xsfr.h"
  7. #include "includes\gpiodef_f3.h"

  8. #include "Library\includes\delay.h"
  9. #include "Library\includes\uart.h"
  10. #include "Library\includes\system_clock.h"
  11. #include "Library\Includes\rtc.h"       
  12. #include "Library\Includes\pwm.h"       
  13. #include "includes\system.h"
  14. #include "Library\includes\adc.h"
  15. #include "Library\includes\wdt.h"

  16. /*********************************************************************************************************************/
  17. #include "TS_Lib\Includes\ts_configuration.h"
  18. #include "TS_Lib\Includes\ts_def.h"
  19. #include "TS_Lib\Includes\ts_api.h"
  20. #include "TS_Lib\Includes\ts_service.h"
  21. /*********************************************************************************************************************/       
  22. #include "tm1628.h"
  23. #include "time.h"
  24. //#include "74hc595.h"

  25. unsigned char read_inner_trim(void)                               
  26. {
  27.         unsigned char value;
  28.         FSCMD = 0x80;       
  29.         PTSH = 0x00;                               
  30.         PTSL = 0x24;      
  31.         FSCMD = 0x81;                                               
  32.         value = FSDAT;
  33.         FSCMD = 0;
  34.         return value;
  35. }
  36. void SystemInit(void)
  37. {
  38. #ifdef LVD_RST_ENABLE
  39.         LVDCON = 0xE1;        //設置LVD復位電壓為2V
  40. #endif
  41. #if (SYSCLK_SRC == PLL)
  42.         Sys_Clk_Set_PLL(PLL_Multiple);       
  43. #endif
  44. #ifdef UART0_EN
  45.         Uart0_Initial(UART0_BAUTRATE);
  46. #endif
  47. #ifdef UART1_EN
  48.         Uart1_Initial(UART1_BAUTRATE);
  49. #endif

  50. #if (RTC_CLK_SELECT == IRCL)
  51. //看門狗時鐘源為IRCL
  52.         CKCON |= ILCKE;                                                                                                                                         //使能IRCL
  53.         WDCON  = WDTS(WDTS_IRCL) | WDRE(WDRE_reset);           //設置看門狗時鐘源為ILCKE,模式為復位模式
  54. #elif (RTC_CLK_SELECT == XOSCL)       
  55.         CKCON |= XLCKE;
  56.         while(!(CKCON & XLSTA));
  57.         WDCON  = WDTS(WDTS_XOSCL) | WDRE(WDRE_reset);   //設置看門狗時鐘源為XOSCL,模式為復位模式
  58. #endif
  59.         WDVTHH = 0;                                                                                                                                                         //看門狗復位閾值高八位設置 當前值為5s       
  60.         WDVTHL = 75;                                                                                                                                                 //看門狗復位閾值低八位設置
  61.         WDFLG = 0xA5;       
  62.        
  63.        
  64.         ADCFGH = (ADCFGH&0xC0) | VTRIM(read_inner_trim());        //加載ADC內部基準校準值
  65. }

  66. void main(void)
  67. {       
  68.         unsigned char i;
  69.         SystemInit();       
  70.         EA = 1;
  71.         TS_init();
  72.         Timer1_mode2_Init();
  73. //        Uart0_PutChar(0xab);
  74.   user_EEprom_init();
  75.         Read_Buff();
  76.         Out0=0;
  77.         Out1=0;
  78.         Out2=0;
  79.         Out3=0;
  80.         while(1)
  81.         {
  82.                 TS_Action();
  83.                 Study_Key();
  84.                 Study_RF();
  85.                 if(rf_Ok&&(!Study_flag))                 //非學習狀態
  86.                 {
  87.                         rf_Ok = 0;
  88.                         KeyTo1527();                                 //轉換數據
  89.                         for(i=0;i<KEY_num;i++)
  90.                         {
  91.                                 if((RfBuff[0]==key_number[i*3+1])&&(RfBuff[1]==key_number[i*3+2])&&(RfBuff[2]==key_number[i*3+3]))
  92.                                 {
  93. //                                        VT = 1;       
  94.                                         Hold_Time = 0;
  95.                                         if(!LM)                                                                                                //點動
  96.                                         {
  97.                                                 if((RfBuff[3]&0x10) == 0x10) Out0 = 0;
  98.                                                 if((RfBuff[3]&0x20) == 0x20) Out1 = 0;
  99.                                                 if((RfBuff[3]&0x40) == 0x40) Out2 = 0;
  100.                                                 if((RfBuff[3]&0x80) == 0x80) Out3 = 0;
  101.                                                 Uart0_PutChar(RfBuff[3]);                                               
  102.                                         }
  103.                                         else if(LM&&!Decod_Ok)                                                                //自鎖
  104.                                         {
  105.                                                 if((RfBuff[3]&0x10) == 0x10) Out0 = !Out0;
  106.                                                 if((RfBuff[3]&0x20) == 0x20) Out1 = !Out1;
  107.                                                 if((RfBuff[3]&0x40) == 0x40) Out2 = !Out2;
  108.                                                 if((RfBuff[3]&0x80) == 0x80) Out3 = !Out3;
  109. //            Uart0_PutChar(RfBuff[3]);                                                       
  110.                                         }
  111.                                         Decod_Ok = 1;
  112.                                         break;       
  113.                                 }       
  114.                         }                       
  115.                 }       

  116.         }
  117.        
  118. }
  119. #endif
復制代碼

原理圖: 無
仿真: 無
代碼: CA51F3_1527解碼程序.7z (97.79 KB, 下載次數: 18)

作者: fj51hei    時間: 2024-3-25 21:42
樓主,調試命令放在那個文件?




歡迎光臨 (http://www.zg4o1577.cn/bbs/) Powered by Discuz! X3.1
主站蜘蛛池模板: 久久香蕉网 | 特一级毛片 | 日本国产欧美 | 久草在线免费资源 | 精品一区二区三区四区 | 国产精品久久久久免费 | 超碰日本 | 91网站在线观看视频 | 欧美高清视频在线观看 | 欧美精品一区二区三区在线 | 亚洲精品欧洲 | 一区二区三区在线 | 成人在线视频网站 | 精品真实国产乱文在线 | 日本精品在线观看 | 久久天堂 | 欧美日韩在线观看视频网站 | 91精品导航 | 人人射人人 | 成人av一区| 欧美一级黄色片 | 日本a v在线播放 | 久草在线影 | 久久久精品一区二区 | 欧美一区二区三区在线 | 精品国产一区二区三区久久久久久 | 日韩有码一区二区三区 | 大学生a级毛片免费视频 | 国产精品国产亚洲精品看不卡15 | 久久国产精品一区二区三区 | 精品国产91| 欧美福利 | 国产玖玖 | 国产精品夜夜春夜夜爽久久电影 | 国产一区二区三区在线视频 | 成人精品一区二区 | 国产精品久久久久久久久久软件 | 黄色片免费看视频 | 成人国产精品久久 | 欧美一区二区三区视频 | 蜜臀网|