because my project is, if there is a card - no buzzer alarm will be present, if there is no card detected - the buzzer will be alarm about 30 second and it will start looping again
anybody can help for this programming?
this is my programming :
- CODE: SELECT_ALL_CODE
int main(void)
{
unsigned char value = 0; // declare a variable to store
// ensure all the hardware port in zero initially
PORTA = 0;
PORTB = 0;
PORTC = 0;
PORTD = 0;
PORTE = 0;
// Initialize the I/O port direction, this must be configured according to circuit
// please refer to PTK40A schematic for details
// TRISX control pin direction, output pin must be configure as '0'
// while input must be configure as '1'
TRISA = 0b00010000;
TRISB = 0b00001111;
TRISC = 0b10000000;
TRISD = 0;
TRISE = 0;
mode=0;
//initialize UART for using it
uart_initialize();
//Initialize LCD to be use
lcd_initialize();
lcd_putstr("PWD Parking System"); //LCD display
lcd_goto(0xc4);
delay_ms(1500);
lcd_putstr("Begin");
delay_ms(1500);
lcd_clear();
while(1) // create an infinite loop
{
if(m_sensor==1)
{
lcd_putstr("3:Starting ");
led_oren=1;
if(ir_sensor==0) //waktu nak scan card
{
while(m_sensor==1)
{
lcd_clear();
lcd_putstr(" Scan the Card ");
delay_ms(1500);
lcd_clear();
lcd_putstr("ERROR Try again ");
Get_NUID();
lcd_clear();
lcd_putstr(" NUID Card ");
lcd_2ndline();
LCD_HextoASCII(reply[12]);
LCD_HextoASCII(reply[11]);
LCD_HextoASCII(reply[10]);
LCD_HextoASCII(reply[9]);
led_oren=0;
led_green=1;
while(m_sensor==1);
}
}
n++;
if(n>5)
{
while(m_sensor==1)
{
led_oren=0;
led_red=1;
__delay_ms(500);
led_oren=0;
__delay_ms(500);
n=0;
led_green=0;
bz=1;
}
}
__delay_ms(1000);
}
else
{
lcd_clear();
n=0;
led_red=0;
led_green=0;
led_oren=0;
bz=0;
}
}
}