olivervd
Joined: 10 Oct 2014 Posts: 10
|
|
Posted: Tue Oct 21, 2014 1:18 am |
|
|
Hello,
I have a same problem with my read RFID.
I use PCW compiler(CCS).
My hardware is the recommended EM Marin for Em4150. If you need my schematic I can send for email.
I use em4095 + pic16f876A.
When I run my circuit emerge the next message "ERROR PARITY".
I can read em4100 and em4102, also I can write em4150, but I can't read em4150.
Can you help me?
This is my email: olivercharmander@hotmail.com
This is my code:
Code: | #include <16F876a.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP,NOBROWNOUT,NOPUT
#use delay(clock=20000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,stream=RS)
#include <em4095.c>
#include <em4102.c>
#include <em4150.c>
#include <stdlib.h>
int32 msg;
int8 err;
int32 tagNum=0x00;
int8 tag_adr=5;// tag_adr is between 0-33
void main(void) {
rf_init();
rf_powerUp();
while(true) {
// restart_wdt();
//LOGIN
err = login_4150(0x00);
// resultado=readProtect_4150(1, 2);
// printf("valor de Resultado = %d\n\r",resultado);
// printf("valor de ERR LOGIN = %d\n\r",err);
switch(err) {
case ERR_OK: printf("\n\rOK LOGIN"); break;
case ERR_LIW:printf("\n\rLIW LOGIN"); break;
case ERR_NAK:printf("\n\rNAK LOGIN"); break;
case ERR_PARITY: printf("\n\rPARITY LOGIN"); break;
}
puts(msg,RS);
delay_ms(500);
//ESCRITURA
tagNum = make32(0x01,0x02,0x03,0x04);
tag_adr=5;
err = write_4150(tagNum,tag_adr);
switch(err) {
case ERR_OK: printf("\n\rOK ESCRITURA");
break;
case ERR_LIW:printf("\n\rLIW ESCRITURA"); break;
case ERR_NAK: printf("\n\rNAK ESCRITURA"); break;
case ERR_PARITY: printf("\n\rPARITY ESCRITURA"); break;
}
puts(msg,RS);
PWprotect_4150(FALSE);
delay_ms(500);
err=setPassword_4150(oldPassword, newPassword);
printf("valor de ERR Password = %d\n\r",err);
//LECTURA
err = read_4150(&msg,5);
tagNum=msg;
switch(err) {
case ERR_OK: printf("Data: %lu \n\r", tagNum);
printf("Data: %x \n\r", tagNum);
break;
case ERR_LIW: printf("\n\rLIW LECTURA");
break;
case ERR_NAK: printf("\n\rNAK LECTURA");
break;
case ERR_PARITY:
printf("\n\rPARITY LECTURA");
//printf("PARITY\n\r");
break;
}
puts(msg,RS);
//RESET
err= reset_4150() ;
switch(err) {
case ERR_OK: printf("\n\rOK RESET");
break;
case ERR_LIW: printf("\n\rLIW RESET");
break;
case ERR_NAK: printf("\n\rNAK RESET");
break;
}
}
} |
|
|