|
以前買過一款建議的開發(fā)板,后來又買了一塊顯示屏和rc522的ic卡讀卡模塊,我有和客戶要過一些資料,然后把資料整合移植到stm32里面去。如果有和我一樣的單片機初學(xué)者需要,可以一起了解學(xué)習(xí)。
單片機源程序如下:
- #include "system.h"
- #include "SysTick.h"
- #include "led.h"
- #include "usart.h"
- #include "tftlcd.h"
- #include "RC522.h"
- #include "stdio.h"
- /*******************************************************************************
- * 函 數(shù) 名 : main
- * 函數(shù)功能 : 主函數(shù)
- * 輸 入 : 無
- * 輸 出 : 無
- *******************************************************************************/
- int main()
- {
- u8 i=0;
- unsigned char status;
- SysTick_Init(72);
- NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); //中斷優(yōu)先級分組 分2組
- LED_Init();
- USART1_Init(9600);
- RC522_Pin_Init();
- TFTLCD_Init(); //LCD初始化
-
- PcdReset();
- PcdAntennaOff();
- PcdAntennaOn();
- // M500PcdConfigISOType('A');
- delay_ms(1000);
- delay_ms(1000);
- FRONT_COLOR=BLACK;
-
-
- // printf("hello world\n");
- LCD_ShowString(10,60,tftlcd_data.width,tftlcd_data.height,24,"12345678");
- LCD_ShowString(10,100,tftlcd_data.width,tftlcd_data.height,16,"Embedded systems engineer");
- LCD_ShowPicture(10,180,200,240,gImage);
-
- while(1)
- {
- i++;
- if(i%20==0)
- {
- led1=!led1;
- }
-
- delay_ms(10);
- status = PcdRequest(PICC_REQALL, g_ucTempbuf);
- if (status != MI_OK)
- {
- continue;
- }
- status = PcdAnticoll(g_ucTempbuf);//
- if (status != MI_OK)
- { continue; }
- // display_cardnum();
- // LCD_ShowString(10,100,tftlcd_data.width,tftlcd_data.height,16,g_ucTempbuf);
- LCD_ChangeString(g_ucTempbuf,showchar);
- LCD_ShowString(10,100,tftlcd_data.width,tftlcd_data.height,16,showchar);
-
- }
- return 0;
- }
復(fù)制代碼
所有資料51hei提供下載:
FSMC和RC522驅(qū)動.zip
(464.5 KB, 下載次數(shù): 25)
2018-5-16 11:56 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
|
|