STM8-RC522-IC卡修改密碼程序_第1頁(yè)
STM8-RC522-IC卡修改密碼程序_第2頁(yè)
STM8-RC522-IC卡修改密碼程序_第3頁(yè)
全文預(yù)覽已結(jié)束

下載本文檔

版權(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ì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論