PDA

View Full Version : Weigand to RS232 in PBPBasic?



circuitpro
- 2nd September 2010, 02:39
Hi,

I only find one post regarding Weigand to RS232, and its in assy. Has anybody tried a converter in PBP?

Len

Dave
- 2nd September 2010, 11:37
circuitpro , 29 bit, 32 bit? Hand shaking? Just to say Weigand doesn't give much info...

Dave Purola,
N8NTA

circuitpro
- 2nd September 2010, 17:03
Sorry. I'm just trying to understand the technique involved, really. I think that any wiegand pbp application would show me that, but specifically I am interested in a 26 bit application. It seems like you could just use two interrupts to put an ascii word together, but the problem there is recognizing the end of the transmission. Needless to say, I'm a little confused about how to begin with this, (and of course the clock keeps ticking).

circuitpro
- 4th September 2010, 07:00
Yes, it is as simple as using two interrupts and forming a word from the interrupts. The length of the bits doesn't matter in the least - it can be as long as necessary. That's how all these 'custom' variations come about. After the timeout period (forgot what it's called right now), that marks the end of the word.

Thanks to DT_Ints, it's very simple, and checks out by comparing to a prox reader with a RS232 output. ;-)

Ioannis
- 4th September 2010, 11:43
Wiegand has very short pulses of the order of 50uSec. PBP interrupts or DT-INTS need a very fast say 40MHz controller to catch these pulses.

I had found a reader that happened to be slower, I mean the low going pulses were over 175uSec. But that is not the case always.

Darrel had helped me alot to reduce the latency of the Intterupts but was not possible to catch the 50uS at 4 or 8MHz system clock.

I used another method in a tight loop and was able to work at 4MHz clock.



mainloop:
if d0=0 then 'Wiegand D0 line read
array[index]=0 'at 4MHz reads 50usec pulses!
index=index+1 'Increment array index
while d0=0:wend 'Wait for D0 line to go high
endif
if d1=0 then 'Eiegand D1 line read
array[index]=1
index=index+1
while d1=0:wend
endif
if index=26 then convert 'If 26 bits read, convert to ASCII
goto mainloop


Ioannis

circuitpro
- 4th September 2010, 16:52
Yeah, every once in awhile, alot of software headaches can be instantly cured with a $.15 flip-flop!

Ioannis
- 6th September 2010, 07:38
I do not quite follow... How does a F.F. relate to the case?

Ioannis

circuitpro
- 9th September 2010, 16:51
looked too quickly. I was looking into hardware decoding, or at least helping the micro out with a little hardware. it's only a NAND gate, but a 40 mhz clock works fine. (also found out in the process that a PIC18F4685 makes a nice 'upgrade' to the PIC16F877A in a LAB-X1 board).

http://www.siliconchip.com.au/cms/A_107882/article.html

http://docs.tibbo.com/taiko/index.html?ser_wiegand_mode.htm

happy decoding.