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

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 3785|回復: 0
打印 上一主題 下一主題
收起左側

MSP430開發TFR7979讀卡器源程序

[復制鏈接]
跳轉到指定樓層
樓主
3黑幣
親測試可以用。支持14443a、15693、nfc。

單片機源程序如下:
  1. //===============================================================
  2. // Program with hardware USART and paralel communication        ;
  3. // interface with TRF reader chip.                              ;
  4. //                                                              ;
  5. // PORT4.0 - 4.7 - (IO0-IO7) for parallel interface             ;
  6. //                           with reader chip                   ;
  7. // PORT3.0 - PORT3.3 - USCI_B0 ---> SPI interface with reader   ;
  8. // PORT3.4 - PORT3.5 - USCI_A0 ---> USB/UART control signals    ;
  9. // PORT2.1 - IRQ                                                ;
  10. // PORT3.3 - DATA_CLK                                           ;
  11. // PORT1.7 - PORT1.3 - signaling LEDs                           ;
  12. // PORT1.0 - TRF Enable                                         ;
  13. //===============================================================

  14. //#include <MSP430x23x0.h>         // prozessor spezific header
  15. #include <stdlib.h>                        // general purpose standard library
  16. #include <stdio.h>                        // standard input/output header
  17. #include "host.h"
  18. #include "iso14443a.h"
  19. #include "iso14443b.h"
  20. #include "iso15693.h"
  21. #include "felica.h"
  22. #include "mcu.h"
  23. #include "trf797x.h"
  24. #include "types.h"
  25. #include "uart.h"

  26. //===============================================================

  27. u08_t buf[300];

  28. u08_t enable = 0;

  29. u08_t i_reg = 0x01;                                                        // interrupt register

  30. u08_t irq_flag = 0x00;
  31. u08_t rx_error_flag = 0x00;
  32. s08_t rxtx_state = 1;                                                        // used for transmit recieve byte count

  33. s16_t nfc_state;

  34. u08_t remote_flag = 0;
  35. u08_t stand_alone_flag = 1;
  36. u08_t reader_mode = 0x00;                                        // determines how interrups will be handled

  37. //===============================================================
  38. //
  39. //===============================================================

  40. void main (void)        {
  41.        
  42.         // settings
  43.        
  44.         WDTCTL = WDTPW + WDTHOLD;                        // stop watchdog timer
  45.        
  46.         #ifdef ENABLE_HOST
  47.                 UartSetup();                                        // settings for UART
  48.         #endif
  49.        
  50.         ENABLE_SET;                                                        // P1.0 is switched in output direction
  51.        
  52.         TRF_ENABLE;       
  53.        
  54.         McuDelayMillisecond(1);                // wait until system clock started
  55.        
  56.         Trf797xCommunicationSetup();                // settings for communication with TRF
  57.                
  58.         Trf797xInitialSettings();                        // Set MCU Clock Frequency to 6.78 MHz and OOK Modulation
  59.        
  60.         // Now switch from DCO to external 6.78 MHz clock

  61.         McuOscSel(0x00);                       // set the oscillator
  62.         McuDelayMillisecond(10);
  63.        
  64.         // Re-configure the USART with this external clock

  65.         Trf797xReConfig();
  66.             
  67.         ENABLE_INTERRUPTS;                                        // General enable interrupts

  68.         LED_POWER_ON;                                                // board ist powered, green LED
  69.    
  70.         OOK_DIR_IN;                                                        // set OOK port tristate
  71.         enable = 1;                                                        // indicates, that setting are done

  72.         reader_mode = 0x00;
  73.         stand_alone_flag = 1;                                // stand alone mode
  74.         remote_flag = 0;                                        // host is not activ
  75.    
  76.     //        settings done
  77.    
  78.         while(1)                                                        // infinite loop
  79.         {       
  80.                 #if TRIGGER                                                // in Mcu.h
  81.                         LED_OPEN1_ON;
  82.                         McuDelayMillisecond(1);
  83.                         LED_OPEN1_OFF;
  84.                 #endif
  85.                 if(remote_flag == 1)                         // if in remote mode
  86.                 {                                                                // remote mode can be disabled in host.h
  87.                         #ifdef ENABLE_HOST
  88.                                 buf[4] = 0xff;                        // "TRF7960 EVM" message in GUI
  89.                                 HostCommands();                        // device works according host commands
  90.                         #endif
  91.                 }
  92.                 else
  93.                 {       
  94.                         #ifdef ENABLE15693                                // this standard can be disabled in ISO15693.h
  95.                                 Iso15693FindTag();                        // detects ISO15693 in stand-alone mode
  96.                         #endif
  97.                         if(remote_flag == 0)
  98.                         {       
  99.                                 #ifdef ENABLE14443A                        // this standard can be disabled in ISO14443A.h
  100.                                         Iso14443aFindTag();                // detects ISO14443A in stand-alone mode
  101.                                 #endif
  102.                         }
  103.                         if(remote_flag == 0)
  104.                         {
  105.                                 #ifdef ENABLE14443B                        // this standard can be disabled in ISO14443B.h
  106.                                         Iso14443bFindTag();                // detects ISO14443B in stand-alone mode
  107.                                 #endif
  108.                         }
  109.                         if(remote_flag == 0)
  110.                         {
  111.                                 #ifdef ENABLE_FELICA                // this standard can be disabled in felica.h
  112.                                         FindFelica();                        // detects FeliCa in stand-alone mode
  113.                                 #endif
  114.                         }
  115.                 }
  116.         }
  117. }
復制代碼

所有資料51hei提供下載:
下位機程序_原廠_CCS4環境.zip (223.63 KB, 下載次數: 5)


評分

參與人數 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎勵!

查看全部評分

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

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

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

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 91操操操 | 国产在线播 | 久久美女网 | 国产精品视频999 | 久久精品无码一区二区三区 | 日本涩涩网 | 国产91亚洲精品一区二区三区 | 欧美午夜视频 | 欧美中文视频 | 最近日韩中文字幕 | 在线看成人av | 中文字幕一区二区三区四区不卡 | 黄色网络在线观看 | av喷水| 成人av播放| 国产91丝袜在线播放 | 亚洲欧美日韩中文在线 | 日韩中文字幕高清 | 国产一区二区在线免费播放 | 日本在线一区二区三区 | 成人在线精品 | 亚洲国产aⅴ精品一区二区 免费观看av | 欧美中文字幕一区 | 欧美日韩在线一区二区 | 久久性色 | 国产一区二区三区在线 | 成人在线视频免费看 | 国产综合久久 | 国产精品99精品久久免费 | 精品视频在线免费观看 | 91社区在线观看 | 日韩免费在线观看视频 | 黄色片视频免费 | 女同av亚洲女人天堂 | 国产一区二区视频免费在线观看 | 亚洲精品乱码久久久久久久久久 | 日韩三极| 国产激情视频在线 | 午夜视频在线免费观看 | 成人av色| www日韩欧美|