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

 找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 1781|回復(fù): 1
打印 上一主題 下一主題
收起左側(cè)

一款基于錦銳單片機(jī)遙控接收1527碼的軟解碼程序

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:66086 發(fā)表于 2024-3-25 16:08 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
一款基于錦銳單片機(jī)遙控接收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;        //設(shè)置LVD復(fù)位電壓為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. //看門(mén)狗時(shí)鐘源為IRCL
  52.         CKCON |= ILCKE;                                                                                                                                         //使能IRCL
  53.         WDCON  = WDTS(WDTS_IRCL) | WDRE(WDRE_reset);           //設(shè)置看門(mén)狗時(shí)鐘源為ILCKE,模式為復(fù)位模式
  54. #elif (RTC_CLK_SELECT == XOSCL)       
  55.         CKCON |= XLCKE;
  56.         while(!(CKCON & XLSTA));
  57.         WDCON  = WDTS(WDTS_XOSCL) | WDRE(WDRE_reset);   //設(shè)置看門(mén)狗時(shí)鐘源為XOSCL,模式為復(fù)位模式
  58. #endif
  59.         WDVTHH = 0;                                                                                                                                                         //看門(mén)狗復(fù)位閾值高八位設(shè)置 當(dāng)前值為5s       
  60.         WDVTHL = 75;                                                                                                                                                 //看門(mén)狗復(fù)位閾值低八位設(shè)置
  61.         WDFLG = 0xA5;       
  62.        
  63.        
  64.         ADCFGH = (ADCFGH&0xC0) | VTRIM(read_inner_trim());        //加載ADC內(nèi)部基準(zhǔn)校準(zhǔn)值
  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))                 //非學(xué)習(xí)狀態(tài)
  86.                 {
  87.                         rf_Ok = 0;
  88.                         KeyTo1527();                                 //轉(zhuǎn)換數(shù)據(jù)
  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)                                                                                                //點(diǎn)動(dòng)
  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
復(fù)制代碼

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

評(píng)分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎(jiǎng)勵(lì)!

查看全部評(píng)分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏1 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

沙發(fā)
ID:712493 發(fā)表于 2024-3-25 21:42 | 只看該作者
樓主,調(diào)試命令放在那個(gè)文件?
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表
主站蜘蛛池模板: 欧美精品中文字幕久久二区 | 日韩在线 | 精品国产91 | 久久国产精品视频 | 在线观看av中文字幕 | 色婷婷一区二区三区四区 | 国产一区二区三区四区 | 亚洲视频在线观看 | 亚洲人成人一区二区在线观看 | 久久久久网站 | 国产精品久久久久久久岛一牛影视 | 久久亚洲综合 | 亚洲精品第一国产综合野 | 久久久国产网站 | 亚洲www.| 91网站视频在线观看 | 国产ts人妖另类 | 国产精品久久久久久久久久免费 | 精品国产免费人成在线观看 | 波多野结衣一区二区三区在线观看 | 亚洲一区免费视频 | 在线观看涩涩视频 | 国产网站在线播放 | 九九久久精品 | 亚洲一区播放 | 一级a性色生活片久久毛片波多野 | 天天操欧美 | 9191在线观看 | 久久久久黄色 | 国产精品亚洲第一区在线暖暖韩国 | 北条麻妃一区二区三区在线观看 | 免费激情 | 国产精品免费一区二区三区四区 | 男人天堂色 | 精品国产99 | 亚洲精品久久久一区二区三区 | 91精品国产美女在线观看 | 国产一区二区三区在线 | 久久免费视频在线 | 日韩美香港a一级毛片免费 国产综合av | 国产91久久久久 |