非接觸式智能卡模塊ID-0/10/15的原理及應用
5 應用實例
5.1 Wiegand 26 模式
在Wiegand 26 模式下,ID-0/10/15引腳接法如下s
PIN1s 地
PIN2sReset Bar
PIN3,4 sAntenna
PIN5 s接+5VDC
PIN6sDATA 1
PIN7: DATA0
PIN8: Beeper/Led
PIN9: +4.6V~+5.5V
在Wiegand 26 模式下,ID-0/10/15數(shù)據(jù)引腳輸出波形如下s
data0
。。。
data1 950μs 50μs
。。。
50μs 950μs
DATA0 和 DATA1總共26個低電平脈沖,每一個脈沖代表一個BIT 數(shù)據(jù),第1個BIT 為1-13 BIT 的偶校驗位,第26 個BIT 為14-26 BIT 的奇校驗位,BIT2-BIT25 共6 DIGITS(每4 BIT 為一個DIGITS)代表卡片號碼的后六位數(shù)。
此模式下與MCS51單片機接口的程序如下s
ID-0_DATA0: EQU P1.7 ;P1.7 CONNECT TO DATA0
ID-0_DATA1: EQU P1.6 ;P1.6 CONNECT TO DATA1
ADDR_1: EQU 30H ;6 BYTES DATA SAVE IN INRAM 30-35H
EVEN_CHECK EQU 00H ;20H_BIT0 SAVE AS EVEN PARITY
ODD_CHECK EQU 01H ;20H_BIT1 SAVE AS ODD PARITY
EVEN_FLAG EQU 02H ;20H_BIT2
TIME_OUT_FLAG EQU 03H ;20H_BIT3
ORG 000BH
LJMP TIMER0_IN
ORG 30H
WIEGAND_START: TMOD,#01H ;
SETB EA
SETB EVEN_FLAG ;SET EVEN CHECK FLAG
CLR TIME_OUT_FLAG
MOV R2,#6 ;TOTAL 6 BYTES DATA
MOV R3,#4 ;4 BITS PER BYTE
MOV R0,#ADDR_1 ;START ADDRESS OF DATA
WIEGAND1: JNB ID-0_DATA0,WIEGAND2 ;DATA0 IS LOW THEN START TO OUTPUT DATA
JB ID-0_DATA1,WIEGAND1 ;DATA0 AND DATA1 IS HIGH THEN WAIT DATA
JB TIME_OUT_FLAG,ERR
MOV TH0,#0F8H ;2000US INTERRUPT
MOV TL0,#30H
CLR TIME_OUT_FLAG
SETB TR0 ;TIMER0 START
LCALL DELAY25US
MOV C,ID-0-DATA0
LCALL DELAY175US
JNB ID-0-DATA1,ERR
LJMP WIEGAND3
WIEGAND2: NOP
JB TIME_OUT_FLAG,ERR
MOV TH0,#0F8H ;2000US INTERRUPT
MOV TL0,#30H ;
CLR TIME_OUT_FLAG
SETB TR0 ;TIMER0 START
LCALL DELAY25US ;DELAY 25 μS
MOV C,ID-0_DATA0 ;MOVE DATA IN C REGISTER
LCALL DELAY175US
JNB ID-0-DATA,ERR
WIEGAND3: JNB EVEN_FLAG,WIEGAND_DATA ;EVEN IS 0 THEN OUTPUT IS DATA
MOV EVEN_CHECK,C ;OUTPUT IS EVEN CHECK BIT
CLR EVEN_FLAG ;CLR EVEN CHECK BIT
LJMP WIEGAND1 ;RECEIVE DATA
蜂鳴器相關文章:蜂鳴器原理
評論