Weigand
VB
Posts: 1
Has anyone tried to use the basic stamp alongwith a Weigand protocol based proximity reader ?
Quoting from an earlier message in this forum
"Weigand uses 2 data lines that sit high. One line is the 1 line
and the other is the 0 line. When data is sent the 1 or 0 line will pulse low
for 50 us. There is at least a 2 ms pause between each pulse. If the 1 line
pulses it is a high bit in the data string, if the 0 line pulses it is a low bit
in the data string."
Would it work if I use the COUNT command to wait for and decode 50us transitions ?
Quoting from an earlier message in this forum
"Weigand uses 2 data lines that sit high. One line is the 1 line
and the other is the 0 line. When data is sent the 1 or 0 line will pulse low
for 50 us. There is at least a 2 ms pause between each pulse. If the 1 line
pulses it is a high bit in the data string, if the 0 line pulses it is a low bit
in the data string."
Would it work if I use the COUNT command to wait for and decode 50us transitions ?
Comments
You could sample both lines at the same time with:
INPUT 0 ' "0" pin
INPUT 1 ' "1" pin
' Note InA will read 4 pins at one time
ReadPins:
BRANCH InA, [noparse][[/noparse]BothPins, RecordZero, RecordOne, ReadPins]
GOTO ReadPins
RecordZero:
' Do stuff until line goes high again
' Record a zero value
GOTO ReadPins
RecordOne:
' Do stuff until line goes high again
' Record a one value
GOTO ReadPins
BothPins:
' Shouldn't happen
GOTO ReadPins
The only problem with this approach is it may miss a 50 uSec pulse -- that's awfully small compared to the BS2 instruction cycle time (33 uSec / instruction).
·