


下載本文檔
版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、/* Includes -*/* Includes -*/#include stm8s.h#include stm8s_clk.h#include intrinsics.h#include stm8s_uart1.h#include uart.h#include rc522.h#include string.hvoid Delay(u32 nCount);extern u8 RxBufferRxBufferSize;extern u8 UART_RX_NUM;unsigned char CT2;/卡類(lèi)型unsigned char SN4; /卡號(hào)unsigned char write16 =
2、0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10;unsigned char read16 = 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00;unsigned char key6 = 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF;/* Private macro -*/#define countof(a) (sizeof(a) / sizeof(*(a)#de
3、fine BufferSize (countof(Tx_Buffer)-1)/* Private variables -*/u8 Tx_Buffer = STM8S RFID TEST;u8 Rx_BufferBufferSize;u32 FLASH_ID ;/* Private defines -*/* Private function prototypes -*/* Private functions -*/#define ReadWriteAddr 11 /讀寫(xiě)扇區(qū)void main(void) unsigned char status; /* Infinite loop */ /*設(shè)置
4、內(nèi)部時(shí)鐘16M為主時(shí)鐘*/ CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1); /*!Set High speed internal clock */ status = memcmp(read,write,16); Uart_Init(); GPIO_Init( GPIOA, GPIO_PIN_3, GPIO_MODE_OUT_PP_HIGH_FAST); InitRc522(); UART1_SendString(Tx_Buffer,BufferSize); while(1) status = PcdRequest(PICC_REQALL,CT);
5、/*掃描卡*/ status = PcdAnticoll(SN); /*防沖撞*/ if (status=MI_OK) GPIO_LOW(GPIOA, GPIO_PIN_3); /尋卡成功 UART1_SendString(scan IC card successn,21); status = PcdSelect(SN); /選擇要操作的卡 if (status=MI_OK) if( MI_OK = PcdAuthState(0x60,ReadWriteAddr,key,SN) ) /驗(yàn)證A密碼 status = PcdRead(ReadWriteAddr,read); if(MI_OK =
6、status) read0 = 0x01; read1 = 0x02; read2 = 0x03; read3 = 0x04; read4 = 0x05; read5 = 0x06; status = PcdWrite(ReadWriteAddr,read); UART1_SendString(sucess n,9); else GPIO_HIGH(GPIOA, GPIO_PIN_3); Reset_RC522(); void Delay(u32 nCount) /* Decrement nCount value */ while (nCount != 0) nCount-; #ifdef U
7、SE_FULL_ASSERT/* * brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * param file: pointer to the source file name * param line: assert_param error line source number * retval : None */void assert_failed(u8* file, u32 line) /* User can add his own implementation to report the file name and line num
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 品牌形象與營(yíng)銷(xiāo)策略匹配度評(píng)估表
- 醫(yī)藥冷鏈運(yùn)輸國(guó)際
- 能源企業(yè)社會(huì)責(zé)任報(bào)告編制指南
- 季度項(xiàng)目進(jìn)展及成果匯報(bào)會(huì)議紀(jì)實(shí)
- 血液腫瘤練習(xí)試題及答案
- 保育師初級(jí)復(fù)習(xí)試題有答案
- 物流配送中心庫(kù)存管理優(yōu)化方案
- 新品市場(chǎng)推廣策略與操作手冊(cè)
- 股份制辦公環(huán)境改善方案
- 病理學(xué)與病理生理學(xué)作業(yè)指導(dǎo)書(shū)
- 25種全球最流行的管理工具
- 道德與法治-五年級(jí)(下冊(cè))-《建立良好的公共秩序》教學(xué)課件
- 小學(xué)班主任工作經(jīng)驗(yàn)交流ppt
- 初中英語(yǔ)教學(xué)設(shè)計(jì)Its-time-to-watch-a-cartoon
- 2022年安徽高校教師崗前培訓(xùn)結(jié)業(yè)統(tǒng)考試題及參考答案
- 城市社區(qū)建設(shè)概論資料
- 水利監(jiān)理規(guī)劃(水利部)
- 數(shù)學(xué)-九宮數(shù)獨(dú)100題(附答案)
- 蘇教版四年級(jí)下冊(cè)科學(xué)全冊(cè)知識(shí)點(diǎn)總結(jié)
- 第三方單位考核管理辦法
- 造粒塔外壁清洗施工方案
評(píng)論
0/150
提交評(píng)論