1641 views|0 replies
- Last login
- 2026-3-21
- Online Time
- 686 hours
- Prestige
- 9530 points
- Points
- 9009 points
|
Source code for reading and writing RC522 RFID module with MSP430F149
[Copy link]
The microcontroller source program is as follows: // //================================== ==========================================// #include "msp430x14x.h " #include "PIN_DEF.H" #include "RC522.H" #include "UART0_Func.c" #include "ctype.h" #include "BoardConfig.h" unsigned char UID[5],Temp[4] ; unsigned char RF_Buffer[18] ; unsigned char Password_Buffer[6]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; // Mifare One default password char MBRX[30] ; char MBKeyTP[30] ; char Event ; unsigned char DISP_MODE,i ; // Edit control display mode unsigned char des_on = 0 ; // DES encryption flag void Key_TP_Task(void) ; / /******************************************************** **************************// // // // Initialize the main clock: MCLK = XT1×(FLL_FACTOR+1) // / / // //************************************************* ******************************// void Init_CLK(void) { unsigned int qq; WDTCTL = WDTPW + WDTHOLD; // Turn off watchdog BCSCTL1 &= ~XT2OFF; //Turn on XT2 high speed crystal oscillator do { IFG1 &= ~OFIFG; //Clear oscFault flag clear oscillator failure flag for(qq=0xff;qq>0;qq--); }while((IFG1&OFIFG)); //oscFault flag still set BCSCTL2 |= SELM_2; //MCLK=XT2 //BCSCTL2 |= DIVM_0; //Control MCLK without frequency division, default BCSCTL2 |= SELS; //SMCLK=XT2 //BCSCTL2 |= DIVS_0; //Control SMCLK without frequency division, default} void Delay(unsigned int time) { unsigned int i, k ; for(i=0;i<255;i++) for(k=0;k
|
|