Wiegand data and com port


Closed Thread
Results 1 to 40 of 54

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Location
    Australia
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    Hi Allan,

    I am using PIC16F737 internal clock 8MHz, Card 1 is connected to RA6 and RA7, Cards 2, 3, and 4 are connected to PORTC<0:2,5:7>, and Cards 5,6,7,and 8
    are connected to PORTB. All 16 card pins 1K resistors pull up to 5V.

    I use the following code to determine which card has presented.

    MainLoop:
    CurrCard = 0
    ' Card reader 1
    CheckPortA:
    TempVar = PORTA
    if TempVar < $C0 then CurrCard = 1 : goto FoundCard

    ' Card readers 5, 6, 7, and 8
    CheckPortB:
    TempVar = PORTB
    if TempVar < $FF then
    if TempVar.0 = 0 then CurrCard = 5 : goto FoundCard
    if TempVar.1 = 0 then CurrCard = 5 : goto FoundCard
    if TempVar.2 = 0 then CurrCard = 6 : goto FoundCard
    if TempVar.3 = 0 then CurrCard = 6 : goto FoundCard
    if TempVar.4 = 0 then CurrCard = 7 : goto FoundCard
    if TempVar.5 = 0 then CurrCard = 7 : gosub FoundCard
    CurrCard = 8
    goto FoundCard
    endif

    ' Card readers 2, 3, and 4
    CheckPortC:
    TempVar = PORTC
    TempVar = TempVar & %11100111
    if TempVar < %11100111 then
    if TempVar.0 = 0 then CurrCard = 2 : goto FoundCard
    if TempVar.1 = 0 then CurrCard = 2 : goto FoundCard
    if TempVar.2 = 0 then CurrCard = 3 : goto FoundCard
    if TempVar.5 = 0 then CurrCard = 3 : goto FoundCard
    CurrCard = 4
    goto FoundCard
    endif

    goto Mainloop

    FoundCard:
    select case CurrCard
    Case 1: ' scan card 1
    ...
    end select
    ...
    goto Mainloop
    Yuantu Huang

  2. #2
    alind's Avatar
    alind Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks Felch and Yuantu, looks like I have plenty to get started with now!
    Regards,
    ALlan

  3. #3
    jmaloway's Avatar
    jmaloway Guest


    Did you find this post helpful? Yes | No

    Default Pre-Programed PIC?

    Hey there,

    Felch,

    I have been reading this thread and am really interested in giving this project a try, the only problem is that I can't seem to sucessfully burn a PIC - I have tried almost every method possible and I was wondering - Could I buy a pre-programed PIC from you? I live in Canada and would of course pay for all shipping costs.

    Thanks,

    James.

  4. #4
    Join Date
    Sep 2004
    Location
    Tallinn, Estonia
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    Hi!
    Sure i could send you preprogrammed chip but is this really what you want? It could cost a lot...
    Wouldn't it be easier to fix your programmer? What device are you using and what errors does it generate?
    Anyway, if you still prefer a preprogrammed chip, send me your address. I will charge the cost of chip and nothing more. I guess that it is possible to send it with "receiver pays" option?

    rgds,
    /Felch

  5. #5
    jmaloway's Avatar
    jmaloway Guest


    Did you find this post helpful? Yes | No

    Default RE: Pre-Programmed Chip

    Felch,

    I don't know. I've never been good a programming - for any platform. I used to know a bit of Qbasic, but that's about it. Because I don't understand the language the code it written in, I have no idea where to look for errors. I didn't get any error messages when I burned your code onto a PIC, but it dosen't do anything when you power up the chip. I am a more electronically-minded person, I have no problems with the physical aspect such as wiring up the board, but software issues are simply beyond me. Below is what I did to burn the code onto a PIC16F628A using a JDM programmer:

    1. Saved code from your website as .asm file
    2. Opened "Pony Prog 2002" and opened the ASM file.
    3. Clicked "Write to Chip"
    4. Got the message "Write Sucessful"
    5. Wired up the chip with specified crystal, 22pF caps, Miniprox reader and powered it from +5V from my USB port.
    6. The reader powered up and completed the power-on self test.

    That's as far as I've gotten. I have playing around with MPlab, but it is ridicusly overcomplicated for me.

    Am I doing everything right? I have gone to all sorts of different websites and read tons of different beginner's guides to programming PICs but I still don't get it.

    Let me know if I am doing something wrong, and If I'm not then I'll just buy a chip from you. Do you have paypal?

    James.

  6. #6
    Join Date
    Sep 2004
    Location
    Tallinn, Estonia
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    Hi!
    It must be a PIC12F629, not 16f628! That's first. Then, After powering up the chip has no tasks, nor does it output anything. Only after you have presented a card (wiegand data arrives from reader to PIC), card number is output via serial port. Perhaps this helps?
    Let me know if it still does not work.

    /Felch

    PS. Do NOT forget to read PICc's internal calibration data and then burn it back. Otherwise serial comms speed would be incorrect! If programmer asks if it should use OSCAL from file or from chip, say use data from CHIP!

  7. #7
    jmaloway's Avatar
    jmaloway Guest


    Did you find this post helpful? Yes | No

    Default RE: Pre-Programmed PIC

    Yes, it sure would help if I used the right chip :-)... I think I'm loosing it! lol.

    I'll head on over to my parts supplier today and "PIC UP" the right chip.

    I had the PIC16F628A from an other similar project that never worked and I had though for some reason that you were using the same chip for this project - I really need to read things more closley.

    Which pins output the serial data? I tried pin 6 (I thought thats what it said in your code, But I wasn't sure) but didn't get any output. I just used an LED to try and detect output to make sure the circuit was working before thickining the soup by trying to connect to to my PC, yet. I did try presenting a standard Weigand Prox card with with no luck.

    How do you read the calibration data?

    Sorry to have to ask so many questions, but I am very new to this.

    Thanks so much,

    James.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts