Hi folks,
A few weekS ago, I bought a RFID Reader that output his datas using wiegand26 protocol.
Since 3 days, I try to communicate with the reader, but can't get it to work.
Some of my attempts show me "0" or "1" as I set trace in the program.
I put some of my code below.
If a kind soul could take a look to my code, I'd be grateful.
DATA0 of the Reader is connected to B.0
DATA1 of the Reader is connected to B.1
Ground of the electronic assembly and ground of the Reader are common.
There are leds on the reader and a buzzer and all seems to be ok when i pass the card in front of the reader (the green led flashes and the buzzer play a sound)
I remember yet (i'm not at home), i have pull-up resistors for the DATA0 and DATA1 set to 10K. I read a datasheet this morning where it talk to use 4,7K.
Could this be the explanation ?
So, what is wrong ?
It seems I miss some interrupt.
I tried to set the frequency up to M32 (and reset it at M4 just before the sertxd command and to M32 after), but it was not better.
Any help would be much appreciate.
Thanks,
Guillaume
A few weekS ago, I bought a RFID Reader that output his datas using wiegand26 protocol.
Since 3 days, I try to communicate with the reader, but can't get it to work.
Some of my attempts show me "0" or "1" as I set trace in the program.
I put some of my code below.
If a kind soul could take a look to my code, I'd be grateful.
Code:
#picaxe 18M2
symbol x = B0
symbol cpt = B1
symbol ok = B2
setfreq M4
sertxd("CONTROL RFID", 13, 10)
setint not %00000011, %00000011 ' déclenche une interruption si les bits 0 (OU) 1 sont égale à 0 (par ex: 10 ou 01. 00 ne se produit jamais)
let ok = 0
debut:
' DATA0 connecté sur B.0 et DATA1 connecté sur B.1
'If pinB.0 = 1 and pinB.1 = 1 Then ' etat de repos
if ok = 1 then
setint OFF
gosub affiche
setint not %00000011, %00000011
endif
'endif
goto debut
interrupt:
if pinB.1 = 1 and pinB.0 = 0 then
inc cpt
poke cpt,"0"
Else
if pinB.1 = 0 and pinB.0 = 1 then
inc cpt
poke cpt,"1"
endif
End If
if cpt = 28 then
let ok = 1
setint OFF 'not needed I think
else
setint not %00000011, %00000011 ' Ré-arme les interruptions
endif
return
affiche:
sertxd("Affichage ID :",13,10)
for x = 3 to 28
peek x, cpt
'if cpt <> 0 then
sertxd(cpt)
'endif
next x
sertxd(13,10)
for x = 3 to 28
poke x, 0
next x
let cpt = 2 ' re-initialise le compteur de digits
let ok = 0
return
DATA1 of the Reader is connected to B.1
Ground of the electronic assembly and ground of the Reader are common.
There are leds on the reader and a buzzer and all seems to be ok when i pass the card in front of the reader (the green led flashes and the buzzer play a sound)
I remember yet (i'm not at home), i have pull-up resistors for the DATA0 and DATA1 set to 10K. I read a datasheet this morning where it talk to use 4,7K.
Could this be the explanation ?
So, what is wrong ?
It seems I miss some interrupt.
I tried to set the frequency up to M32 (and reset it at M4 just before the sertxd command and to M32 after), but it was not better.
Any help would be much appreciate.
Thanks,
Guillaume
Last edited: