寫卡的步驟如下:
1. Create a Connection between Smart Card Reader and Computer via COM port
2. Verify the Introduction area for find the card (檢查讀寫器的感應區是否有可感應的 IC Card)
3. 調用防卡衝突的函式, 讓讀寫器一次只寫一張卡.
4. 設定 Smart Card Reader Sector N 的 Key 為“FFFFFFFFFFFF”, 讓其和卡的出廠預設值相同.
5. 卡、機互相驗證 Sector N的 Key
5.1 如果驗證通過 Jump to 6
5.2 如果驗證失敗
5.2.1 設定 Smart Card Reader Sector n 的 Key 為 0xXXX***XXX ***
5.2.2 再次執行卡、機互相驗證 Sector N的 Key
5.2.2.1 失敗 -> exit ->Close Connection
5.2.2.2 成功
5.2.2.2.1 詢問是否重寫 Sector N? 否-> GOTO 5.2.2.1
5.2.2.2.1.1 是 -> 擦除 Sector N 塊1 、2、 3 中的資料
6. 從塊 Sector n*4 開始寫入資料
7. 設定 IC Card Sector n 的 Key 0xXXX***XXX ***(以後讀卡的 Smart Card Reader 上的這一個扇區的 Key 要與之相同)
8. 斷開 Smart Card Reader 和電腦的連結
寫卡 Flowchart