How wiegand rfid interface with pic18f4520
Posted:
Sat Feb 23, 2013 9:15 am
by rachel.tan
Hi, im sucks in programming, i need help in wiegand rfid c programming in mplab c18 complier. Im using PIC18f4520 and c language . I've changed all the configuration of PIC16 to PIC18, why is the code not working? How to read the tag number and display it on LCD? Do i need to use any wiegand to uart converter or i can just get my results through the PIC port(connect the data0 and data1 to RC1 and RC2)? Or i must get my result through the RS232? PLease help. (
Re: How wiegand rfid interface with pic18f4520
Posted:
Sat Feb 23, 2013 3:52 pm
by robosang
Are you sure you upgrade the code correctly? A single wrong configuration bit might cause nothing to work even the rest of program is correct.
Re: How wiegand rfid interface with pic18f4520
Posted:
Sat Feb 23, 2013 4:26 pm
by rachel.tan
for pic16f876A in assembly language is __config(0x3F32)
for pic18f4520 in C language is
#pragma config OSC = RCIO6
#pragma config FCMEN = OFF
#pragma config IESO = OFF
#pragma config PWRT = OFF
#pragma config BOREN = SBORDIS
#pragma config BORV = 0
#pragma config WDT = ON
#pragma config CCP2MX = PORTC
#pragma config PBADEN = ON
#pragma config LPT1OSC = OFF
#pragma config MCLRE = ON
#pragma config STVREN = ON
#pragma config LVP = ON
is it correct??
Re: How wiegand rfid interface with pic18f4520
Posted:
Sat Feb 23, 2013 4:35 pm
by robosang
I wonder how you translate it?
Re: How wiegand rfid interface with pic18f4520
Posted:
Sat Feb 23, 2013 7:04 pm
by shahrul
This is my configuration. I'm lazy, that's why I'm doing this and auto select PIC configuration.
- CODE: SELECT_ALL_CODE
#if defined (_16F777)
__CONFIG(FOSC_HS & WDTE_OFF & PWRTE_ON & BOREN_OFF & MCLRE_ON & CCP2MX_RC1);
__CONFIG(FCMEN_OFF & IESO_OFF);
#define _XTAL_FREQ 20000000
#elif defined (_16F877A)
__CONFIG(FOSC_HS & WDTE_OFF & PWRTE_ON & BOREN_OFF & LVP_OFF);
#define _XTAL_FREQ 20000000
#elif defined (_16F887)
__CONFIG(FOSC_HS & WDTE_OFF & PWRTE_ON & BOREN_OFF & CP_ON & MCLRE_ON & LVP_OFF);
#define _XTAL_FREQ 20000000
#elif defined (_18F4520)
__CONFIG(1,HS & FCMDIS & IESODIS);
__CONFIG(2,PWRTEN & BOREN & BORV20 & WDTDIS & WDTPS32K);
__CONFIG(3,CCP2RC1 & PBADDIS & LPT1DIS & MCLREN);
__CONFIG(4,XINSTDIS & STVREN & LVPDIS & DEBUGDIS);
__CONFIG(5,UNPROTECT);
__CONFIG(6,UNPROTECT);
__CONFIG(7,UNPROTECT);
#define _XTAL_FREQ 20000000
#elif defined (_18F4550)
__CONFIG(1,USBOSC & CPUDIV1 & PLLDIV5 & HSPLL & FCMDIS & IESODIS);
__CONFIG(2,VREGEN & PWRTEN & BOREN & BORV20 & WDTDIS & WDTPS32K);
__CONFIG(3,CCP2RC1 & PBADDIS & LPT1DIS & MCLREN);
__CONFIG(4,XINSTDIS & STVREN & LVPDIS & ICPORTDIS & DEBUGDIS);
__CONFIG(5,UNPROTECT);
__CONFIG(6,UNPROTECT);
__CONFIG(7,UNPROTECT);
#define _XTAL_FREQ 48000000
#elif defined (__dsPIC30F4013__)
__CONFIG(FOSC, HS);
__CONFIG(FWDT, WDTDIS);
__CONFIG(FBORPOR, MCLREN & BORDIS & PWRT64);
__CONFIG(FGS, GCPU & GWRU);
__CONFIG(FICD, PGEMU);
#define _XTAL_FREQ 20000000
#else
#error PIC not support
#endif