这是基于MSP430的rc522射频卡程序,希望对大家有帮助~~~
完整源码下载:
MSP430F149读卡号参考例程.rar
MSP430F149源程序:
- //
- //===========================================================================//
- #include "msp430x14x.h"
- #include "PIN_DEF.H"
- #include "RC522.H"
- #include "UART0_Func.c"
- #include "ctype.h"
- #include "BoardConfig.h"
- unsigned char writeData[16]={1, 2, 3, 4, 0};
- unsigned char str[16];
- unsigned char UID[4],Temp[4] ;
- unsigned char RF_Buffer[18] ;
- unsigned char Password_Buffer[6]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF} ; // Mifare One 缺省密码
- char MBRX[30] ;
- char MBKeyTP[30] ;
- char Event ;
- unsigned char DISP_MODE,i ; // 编辑控件显示模式
- unsigned char des_on = 0 ; // DES加密标志
- void Key_TP_Task(void) ;
- //***************************************************************************//
- // //
- // 初始化主时钟: MCLK = XT1×(FLL_FACTOR+1) //
- // //
- //***************************************************************************//
- void Init_CLK(void)
- {
- unsigned int qq;
- WDTCTL = WDTPW + WDTHOLD ; // 关看门狗
- BCSCTL1 &= ~XT2OFF; //打开XT2高速晶体振荡器
- do
- {
- IFG1 &= ~OFIFG; //Clear oscFault flag清除振荡器失效标志
- for(qq=0xff;qq>0;qq--);
- }while((IFG1&OFIFG)); //oscFault flag still set
- BCSCTL2 |= SELM_2; //MCLK=XT2
- //BCSCTL2 |= DIVM_0; //控制MCLK不分频,默认
- BCSCTL2 |= SELS; //SMCLK=XT2
- //BCSCTL2 |= DIVS_0; //控制SMCLK不分频,默认
- }
- void Delay(unsigned int time)
- {
- unsigned int i,k ;
- for(i=0;i<255;i++)
- for(k=0;k
|
0
|
|
|
|