




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、HD系列關(guān)于接觸式卡編程說(shuō)明作者:技術(shù)支持部 胡富云標(biāo)準(zhǔn)支持及接口介紹HD系列的III型機(jī)與IV型機(jī)支持接觸式IC讀寫(xiě)ICC_memcard_atr() activates the designated Synchronous IC card and waits for itsATR.short ICC_memcard_atr(unsigned char * dbuf,unsigned char * len,unsigned short vol_index) ;1、4428接觸式存儲(chǔ)卡Read_4428_With_PB( )Read data bytes of 4428 and their a
2、ssociated protection bits.short Read_4428_With_PB(unsigned short StartPos,unsigned short NOB,char * Bfr,char * PB_Bfr) ;Read_4428_NO_PBRead data bytes of 4428 card.short Read_4428_NO_PB (unsigned short StartPos,unsigned short NOB,char * Bfr) ;Write_4428( )Write one byte of data and associated protec
3、tion bit (if required) into 4428.short Write_4428 (unsigned short StartPos,char DestByte,char PBSetFlag) ;Verify_4428_PSC( )Verify the 2-byte PSC of 4428short Verify_4428_PSC (char PSC1,char PSC2) ;詳細(xì)介紹請(qǐng)參見(jiàn)基本API說(shuō)明示例:if (ICC_sock_check(ICC_SOCK_MAIN) = ICC_SOCK_CARD_PRESENT)/檢測(cè)到卡片ICC_interface_power(I
4、CC_POWER_ON);/卡座上電ICC_select_sock(ICC_SOCK_MAIN);/選擇主卡座rcode = ICC_memcard_atr(abuff, &alen, ICC_VOLTAGE_5);/存儲(chǔ)卡ATRif (!rcode)if (*(unsigned long *)abuff) = ATR_SLE4428)/4428卡if (Verify_4428_PSC(0xFF, 0xFF)/密碼校驗(yàn)ErrorBeep(0);DispStr_CE(0, 1, "卡片密碼校驗(yàn)錯(cuò)誤", DISP_POSITION | DISP_CLRSCR);goto
5、 Card4428Error;elsememset(crwBuf, 0, 64);Read_4428_With_PB(0x20, 0x30, crwBuf, stmp); /從起始地址20H讀30H字節(jié)到crwBuf中set_console_english();clear_console();move_cursor(0, 0);for (m = 0; m < 6; m+)/顯示讀取的內(nèi)容for (n = 0; n < 8; n+)goto_xy(n * 16, m);printf("%02X", crwBufm * 8 + n);for(m = 0; m <
6、; 48; m +)if(Write_4428(0x20 + m, crwBufm, 0) /單字節(jié)取反回寫(xiě)ErrorBeep(0);DispStr_CE(0, 1, "寫(xiě)卡失敗", DISP_POSITION | DISP_CLRSCR);goto Card4428Error;RightBeep();goto_xy(0, 7);printf("press any to return");goto Card4428OK;elseErrorBeep(0);DispStr_CE(0, 1, "非4428接觸卡", DISP_POSITIO
7、N | DISP_CLRSCR);goto Card4428Error;2、4442接觸式存儲(chǔ)卡Read_4442_NO_PB( )This function reads data bytes of 4442 card without protection bits.short Read_4442_NO_PB (unsigned short StartPos,unsigned short NOB,char * Bfr) ;Read_4442_PB( )Read all the protection bits of 4442.short Read_4442_PB (char * PB_Bfr)
8、;Write_4442( )Write 1 byte data to 4442. If required write protection bit.short Write_4442 (unsigned short StartPos,char DestByte,char PBSetFlag) ;Verify_4442_PSC( )Verify the 3-byte PSC of 4442short Verify_4442_PSC (char PSC1,char PSC2,char PSC3) ;詳細(xì)介紹請(qǐng)參見(jiàn)基本API說(shuō)明,4442卡與4428卡編程類似。3、SAM卡接觸式智能卡ICC_cpuc
9、ard_ATR () activates the designated asynchronous IC card and waits for itsATR.short ICC_cpucard_ATR (unsigned char * dbuf,unsigned char * len,unsigned short clk_index,unsigned short vol_index,unsigned short ATR_FiDi,unsigned short flags) ;ATR CheckThese functions check if the ATR of the card is comp
10、atible with ISO7816-3 & EMV orPBOC (Peoples Bank of China) standards. Card communication parameters are setaccording to the standards if so. This function also checks if the protocol type specified inthe card ATR is available in this version of hardware.short EMV_ISO_atr_check (unsigned char * p
11、Buff,unsigned char len) ;short PBOC_atr_check (unsigned char * pBuff,unsigned char len) ;ICC_CPU_get_param() reads the internal control parameters of the card in currentsocket.typ_cpucard_param * ICC_cpucard_get_param (void) ;short ICC_cpucard_set_param (typ_cpucard_param * pSrc) ;short ICC_cpucard_
12、PTS(unsigned char * pPTS_request,unsigned short len_PTS_request,unsigned char * pPTS_responce,unsigned char * len_PTS_response) ;Data Exchange For T=0ICC_T0_TPDU() is a TPDU exchange subroutine for T=0 CPU card.short ICC_T0_TPDU(short isIn,short CLA,short INS,short P1,short P2,short P3,unsigned char
13、 * databuff,unsigned short * pSW);Data Exchange For T=1ICC_TO_frame() is a frame exchange subroutine for T=1 CPU card.short ICC_T1_frame(unsigned char * pfrm_send,unsigned short len_send,unsigned char * pfrm_rx,unsigned short * len_rx) ;示例9600init_sam_9600(SAM_0015)int rcode, i;unsigned short rc, SW
14、;unsigned char abuff256, tbuff256,alen, ch;typ_cpucard_param tcp;ICC_interface_power(ICC_POWER_ON);ICC_select_sock(ICC_SOCK_SAM);memset(abuff, 0, sizeof(abuff);for(i = 0; i < 5; i+)rcode = ICC_cpucard_ATR(abuff, &alen, ICC_CLOCK_4M, ICC_VOLTAGE_5, 0x11, 1);/ATR,此處為以4M的時(shí)鐘頻率,9600標(biāo)準(zhǔn),電壓5Vif(rcode
15、 = 0)EMV_ISO_atr_check(abuff, alen);/給SAM卡加速break;rc = ICC_T0_TPDU(1, 0, 0xb0, 0x95, 0, 16, tbuff, &SW);/進(jìn)行T=0的通訊if (rc)return 0x00950000;elseif (SW = 0x9000)memset(SAM_0015, 0, 20);memcpy(SAM_0015, tbuff, 16);elsereturn 0x00950000 | SW;38400unsigned char init_sam_38400(SAM_0015)unsigned short r
16、code = 1;unsigned char abuff200;unsigned char alen, ch, i;unsigned short rc, SW;unsigned char tbuff256, bcdBuffer256;typ_long2char tmplc;typ_cpucard_param tcp;ICC_select_sock(ICC_SOCK_MAIN);memset(abuff, 0, sizeof(abuff);for(i = 0; i < 5; i+)rcode = ICC_cpucard_ATR(abuff, &alen, ICC_CLOCK_4M, ICC_VOLTAGE_5, 0x13, ICC_CPUC_ATR_FLAG_LONGATR);/ATR,此處為以4M的時(shí)鐘頻率,38400 標(biāo)準(zhǔn),電壓5Vif(rcode = 0)break;if(rcode != 0)return 1;/以下部分為對(duì)SAM卡進(jìn)行通訊加速ch = PBOC_atr_check(abuff, alen);if(ch=0)return 2;tcp = *ICC_cpucard_get_param();tcp.Fi = 1;tcp.Di
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 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ì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 例會(huì)管理制度
- 大氣匯報(bào)類型模板
- 學(xué)校膳食管理委員會(huì)議探討幼兒膳食營(yíng)養(yǎng)管理飲食健康課件模板
- 上海電子信息職業(yè)技術(shù)學(xué)院《大學(xué)英語(yǔ)B(二)》2023-2024學(xué)年第二學(xué)期期末試卷
- 長(zhǎng)沙環(huán)境保護(hù)職業(yè)技術(shù)學(xué)院《語(yǔ)言學(xué)導(dǎo)論》2023-2024學(xué)年第一學(xué)期期末試卷
- 溫州大學(xué)《首飾材料研究》2023-2024學(xué)年第二學(xué)期期末試卷
- 浙江省麗水市級(jí)名校2025年初三中考適應(yīng)性測(cè)試(一)化學(xué)試題含解析
- 2025年江蘇省普通高中第一次聯(lián)考高三物理試題含解析
- 2025年安徽省蕪湖市重點(diǎn)中學(xué)高三下學(xué)期4月考英語(yǔ)試題理試題含解析
- 2025年甘肅省天水市秦安縣第二中學(xué)高三5月高三調(diào)研測(cè)試歷史試題含解析
- 單片機(jī)恒壓供水系統(tǒng)設(shè)計(jì)
- 《冠心病的中醫(yī)防治》課件
- 數(shù)據(jù)中心建設(shè)項(xiàng)目可行性研究報(bào)告
- 【高新技術(shù)企業(yè)所得稅稅務(wù)籌劃探析案例:以科大訊飛為例13000字(論文)】
- 口中有異味中醫(yī)巧辨治
- 藥品包裝材料和容器變更研究及案例分析匯編
- 中國(guó)地理概況(疆域、行政區(qū)、人口、民族)課件
- 2023氣管插管意外拔管的不良事件分析及改進(jìn)措施
- JCT587-2012 玻璃纖維纏繞增強(qiáng)熱固性樹(shù)脂耐腐蝕立式貯罐
- 個(gè)人養(yǎng)老金涉稅政策
- (初級(jí))心理治療師歷年考試真題匯總整理(含答案)
評(píng)論
0/150
提交評(píng)論