freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于51單片機(jī)的ic卡讀寫(xiě)系統(tǒng)設(shè)計(jì)-閱讀頁(yè)

2024-10-28 03:01本頁(yè)面
  

【正文】 (1) { if(IsCard==0) { delay()。 ResetCard()。 Card_num[3]=(rec[0]amp。039。0x0f) + 39。 Card_num[5]=(rec[2]amp。039。0x0f) + 39。 Card_num[7]=(rec[4]amp。039。0x0f) + 39。 Card_num[9]=(rec[6]amp。039。0x0f) + 39。 Print(0,0,)。 read_cm(addr_money,2,rec)。 Money_num[6]=((money/10000)%10)+39。 Money_num[7]=((money/1000)%10)+39。 Money_num[8]=((money/100)%10)+39。 Money_num[9]=((money/10)%10)+39。 Money_num[11]=(money%10)+39。 Print(0,1,)。 } else { LCD_Clear_ALL()。 while(IsCard==0) { LED=~LED。 delay()。 delay()。 delay()。 //讀取鍵盤(pán) if(keynum!=0xff) if (keynum==12) { reckey(2,input_buf)。 25 Write_buf[0]=money/256。 if( checkpsw(psw) == 1 ) //如果密碼正確,就直接寫(xiě)入數(shù)據(jù) { for(i=0。 i++) { write_cm(32+i, input_buf[i])。 } BreakOperate()。 money=(input_buf[0]*256+input_buf[1])。 Write_buf[1]=money%256。 i=1。 //從 32 開(kāi)始 寫(xiě)入 8 個(gè)字節(jié) delay_ms(5)。 //IIC STOP } //從 money 地址開(kāi)始寫(xiě)入 2 個(gè)字節(jié)的數(shù)據(jù) } else if(keynum==14) ES=1。 //等待撥出 IC 卡 LED=1。 Print(0,1,)。 } } } 串口程序: 26 void rxdata(void) interrupt 4 using 0 { unsigned char i,j。 //函數(shù)返回值 unsigned char rdbuf[20]。 //讀取串口數(shù)據(jù)緩沖 unsigned char Write_Buf[20]。 //密碼 unsigned char money_temp。 for(i=0。i++) //讀取命令 ,第一個(gè)字節(jié)為命令字節(jié) ,第二個(gè)字節(jié)為在第二個(gè)字節(jié)之后還有多少個(gè)字節(jié) { //第 37 個(gè)字節(jié)為卡號(hào), 89 個(gè)字節(jié)為金額, 1012 個(gè)字節(jié)為舊密碼, 1315 個(gè)字節(jié)為新密碼 while(!RI)。 rxbuf[i]=SBUF。irxbuf[1]。 RI=0。 } } for(i=0。i++) { psw[i]=rxbuf[i+9]。//從主存儲(chǔ)器 0x32 地址讀 8 個(gè)字節(jié)放到讀取緩存中 :讀取卡號(hào) read_cm(addr_money,2,rdbuf+5)。 //發(fā)送讀卡命令返回 PC while(!TI)。 for(j=0。j++) //發(fā)送卡數(shù)據(jù)返回 PC { SBUF=rdbuf[j]。 27 TI=0。i=4。 } for(i=0。 i++) { write_cm(32+i, Write_Buf[i])。 } BreakOperate()。 //加錢 { money=rdbuf[0]*256+rdbuf[1]。 money+=(rxbuf[7]*256+rxbuf[8])。 Write_Buf[1]=money%256。 i=1。 //從 addr_money 開(kāi)始 寫(xiě)入 2 個(gè)字節(jié) delay_ms(5)。 //IIC STOP /從 money 地址開(kāi)始寫(xiě)入 2 個(gè)字節(jié)的數(shù)據(jù) } } else if (rxbuf==_dec) { read_cm(addr_money,2,rdbuf) 。 } 28 money_temp=money。 Write_Buf[0]=money/256。 if(money=0) { for(i=0。 i++) { write_cm(addr_money+i, Write_Buf[i])。 } BreakOperate()。 SBUF=FLAG_NO_MONEY。 TI=0。 } } SLE4442 卡操作函數(shù): include include include /******************************************************************** 函 數(shù) 名 : read_cm() 功 能 : 讀 ic 卡主存 入口參數(shù) : IC 卡地址 (32 255),指向內(nèi)部 RAM 的指針 ,字節(jié)數(shù) 出口參數(shù):指向內(nèi)部 RAM 的指針 *pt ********************************************************************/ void read_cm(unsigned char addr,unsigned char count,unsigned char *pt) { ResetCard()。 ReadMode(pt,count)。 } /******************************************************************** 函 數(shù) 名 : write_cm() 功 能 : 寫(xiě) IC 卡主存 ,一次 1Byte 29 入口參數(shù) : addr: IC 卡地址 (32 255), pt: 指向數(shù)據(jù)區(qū)的指針 i:字節(jié)數(shù) 出口參數(shù):無(wú) 返 回 值 : 無(wú) ********************************************************************/ void write_cm(unsigned char addr, unsigned char dat) { ResetCard()。 //寫(xiě)主存的命令字 ,地址 ,數(shù)據(jù) ProcessMode()。 } /******************************************************************** 函 數(shù) 名 : read_pm() 功 能 : 讀保護(hù)存儲(chǔ)器 入口參數(shù) : 指向直接尋址數(shù)據(jù)區(qū)的指針 出口參數(shù):無(wú) 返 回 值 : 無(wú) ********************************************************************/ /*void read_pm(unsigned char *pt) { ResetCard()。 //讀保護(hù)存儲(chǔ)器的命令字 ,后兩個(gè)參數(shù)忽略 ReadMode(pt,4)。 } */ /******************************************************************** 函 數(shù) 名 : ProtectByte() 功 能 : 保護(hù)一字節(jié) ,注意待保護(hù)的字節(jié)是已經(jīng)寫(xiě)入過(guò)的 ,地址只能在保護(hù)存儲(chǔ)區(qū)內(nèi) 入口參數(shù) : IC 卡地址 ,指向直接尋址數(shù)據(jù)區(qū) 的指針 出口參數(shù):無(wú) 返 回 值 : 無(wú) ******************************************************************** void ProtectByte(unsigned char addr,unsigned char *pt) { ResetCard()。 //寫(xiě)保護(hù)存儲(chǔ)區(qū)的命令字 ,地址 ,數(shù)據(jù) ProcessMode()。 }*/ /******************************************************************** 函 數(shù) 名 : SendComm() 功 能 : 發(fā)送命令 說(shuō) 明 : 調(diào) 用 : 全局變量 : 30 入口參數(shù) : a: 命令字 , b: 地址 , c: 數(shù)據(jù) 出口參數(shù):無(wú) 返 回 值 : 無(wú) ********************************************************************/ void SendComm(unsigned char a,unsigned char b,unsigned char c) { StartComm()。 //a: 發(fā)命令字 WriteByte(b)。 //c: 發(fā)數(shù)據(jù) StopComm()。 CARD_DATA = 1。 CARD_CLK = 1。 CARD_DATA = 0。 } /******************************************************************** 函 數(shù) 名 : StopComm() 功 能 : 結(jié)束命令模式 說(shuō) 明 : (內(nèi)部函數(shù) ) 返 回 值 : 無(wú) *******************************************************************/ void StopComm(void) { CARD_CLK = 0。 Delay5us()。 //CLK: H Delay5us()。 //IO : H Delay10us()。 Delay5us()。 CARD_CLK = 0。 Delay5us()。 Delay5us()。 Delay10us()。 Delay10us()。 CARD_CLK = 0。 CARD_RST = 0。 //復(fù)位和復(fù)位應(yīng)答時(shí)序 temp = ReadByte()。 temp = ReadByte()。 CARD_CLK = 0。 CARD_DATA = 1。 CARD_CLK = 0。 } /******************************************************************** 函 數(shù) 名 : BreakOperate() 功 能 : SLE/4442 IC 卡操作中止 說(shuō) 明 : (內(nèi)部函數(shù) ) ********************************************************************/ void BreakOperate(void) { CARD_CLK = 0。 CARD_DATA = 0。 CARD_RST = 1。 Delay5us()。 Delay5us()。 ch = 0。 i 0。 ch = ch 1。 Delay5us()。 Delay5us()
點(diǎn)擊復(fù)制文檔內(nèi)容
黨政相關(guān)相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1