i add some code to display to the lcd the error code which will be received first of the 5 data to receive.
i save the 5 data to data[x] and after receiving all the data,(which is, if there is error, it also sends back a 00 in all data),
i display it on the lcd.
i constantly send command to the rfrw to check the value of certain block (block 1F)
and receive it immediately,
here's the scenario A:
1.) after powering up, the paralax rfrw LED is red, meaning it is receiving command
2.) the error code displayed on lcd is 2, meaning no tag present.
3.) if i present the tag, the error code changes to 1, meaning no error,
4.) the LED or rfrw becomes green w/c means idle (note. i constantly send command to rfrw)
5.) it hangs up
scenario B:
1.) #1-3 of scenario A
2.) the system reads another memory block ( i knew it because it switches the relay in this stage)
3.) #4-5 of scenario A
scenario C:
1.) #1-2 of scenario A
2.) #4 of scenario A
scenario D:
1.) the system is working fine for a few trials (present of tag)
2.) the system hangs up, the rfrw LED is green.
scenario E:
1.) the system is working fine.
2.) no error.
the scenario's occur in random.
somebody says i need to add capacitor near the MCU supply.
@ stanfidavid
how to protect back emf? i already put diode across the supply of the relay.
i already put a bunch of delay at the beginning
void delay(void)
{ for(int x=0;x<=0xFF;x++)
{ for(int y=0;y<=0xF;y++)
{ continue; }
}
}
void main(void)
{ delay();
delay();
delay();
delay();
delay();
delay();
delay();
delay();
delay();
delay();
sci_Init(9600, SCI_EIGHT); // initialize serial data bus for DS1307 RTC
init_PORTS(); // initialize ports
init_nokia(); // initialize nokia LCD
// time_set(); // set the time
initialize(); // initialize the device
.
.
.
.