mailus
Full Member level 4
what is problem in my program,
ABOUT PROGRAM
i want to flash a LED when push button once pressed.on next pressing the flasher should off.
*/controlleric 16f84A osc:8.000Mhz porta RA2_output porta RA3_input*/
by this my program LED flashes when switch is pressed,otherwise LED off....
ABOUT PROGRAM
i want to flash a LED when push button once pressed.on next pressing the flasher should off.
*/controlleric 16f84A osc:8.000Mhz porta RA2_output porta RA3_input*/
Code:
sbit led at RA2_bit;
sbit sw at RA3_bit;
#define port porta
#define pin 3
#define time 20
short int co;
void main()
{
trisb=0x00;
trisa=0b01000;
portb=0x00;
porta=0x00;
do
{
co=0;
if(button(&port, pin, time, 1))
{
(co>1)?co=0:co++;
}
if(co=0)
{
led=0x00;
} while(!sw);
if(co=1)
{
led=0xff;
delay_ms(40);
led=0x00;
delay_ms(40);
}while(!sw);
}while(1);
}
by this my program LED flashes when switch is pressed,otherwise LED off....
Last edited: