wiegand

General discussion on mikroBasic PRO for PIC.
Post Reply
Author
Message
bariseryener
Posts: 15
Joined: 09 May 2008 18:34

wiegand

#1 Post by bariseryener » 28 Feb 2011 08:31

Hi,

how can i use wiegand protocol via interrupt?

pls help

baris@ulgen.com.tr

bariseryener
Posts: 15
Joined: 09 May 2008 18:34

Re: wiegand

#2 Post by bariseryener » 04 Mar 2011 14:27

i write programme and this is work with out interrupt.

Code: Select all

program wiegand26


' Lcd module connections
dim LCD_RS as sbit at RB4_bit
    LCD_EN as sbit at RB5_bit
    LCD_D4 as sbit at RB0_bit
    LCD_D5 as sbit at RB1_bit
    LCD_D6 as sbit at RB2_bit
    LCD_D7 as sbit at RB3_bit

    LCD_RS_Direction as sbit at TRISB4_bit
    LCD_EN_Direction as sbit at TRISB5_bit
    LCD_D4_Direction as sbit at TRISB0_bit
    LCD_D5_Direction as sbit at TRISB1_bit
    LCD_D6_Direction as sbit at TRISB2_bit
    LCD_D7_Direction as sbit at TRISB3_bit
' End Lcd module connections

dim wiegand, buffer as longint
dim ar1, at1  as word
dim num as string[8]
dim fcl as string[8]
dim cnt,  even, odd as byte
dim ID as string[11]
dim sayi as string[8]

main:
  ADCON1  = 0x0F                              ' Configure AN pins as digital I/O
  cmcon = 0x07
  PORTA = 255
  TRISA = 255
  PORTD = 0
  TRISD = 0
  cnt = 0
  wiegand = 0
  num = 0

  lcd_init()
  lcd_cmd(_LCD_CURSOR_OFF)
  lcd_cmd(_LCD_FIRST_ROW)
  

 while TRUE
 
  if porta.0 = 0 then
  delay_us(500)
  wiegand = wiegand << 1
  cnt = cnt + 1
  end if
  
  if porta.1 = 0 then
  delay_us(500)
  wiegand = wiegand << 1
  wiegand = wiegand or 0x00000001
  cnt = cnt + 1
  end if

  if cnt = 26 then
  lcd_cmd(_LCD_FIRST_ROW)
  wiegand = wiegand >> 1
  buffer = wiegand and 0x00FF0000
  buffer = buffer >> 16
  at1 = buffer and 0x000FFFFF
  ar1 = wiegand and 0x0000FFFF
  longinttostr(wiegand, ID)
  bytetostr(at1, fcl)
  wordtostr(ar1, num)
  lcd_out(1,1,"FACILITY : ")
  lcd_out_cp(fcl)
  lcd_out(2,1,"ID NUMBER: ")
  lcd_out_cp(num)
  cnt = 0
  wiegand = 0

  end if
  

wend

end.

sahniana
Posts: 7
Joined: 28 Nov 2009 06:35

Re: wiegand

#3 Post by sahniana » 26 Jul 2014 10:22

got problem with this code.

on card (wiegand id): 0009079479 138,35511
data received: fc1=30024, num=117

0003058857 046,44201
received: 21334, 209

User avatar
petar.timotijevic
mikroElektronika team
Posts: 1739
Joined: 19 Feb 2014 13:46
Location: Serbia
Contact:

Re: wiegand

#4 Post by petar.timotijevic » 29 Jul 2014 16:40


Post Reply

Return to “mikroBasic PRO for PIC General”