Hi all of you .
I have a hard time using this program witch consists of controlling the lightning of 4 leds with the press of a button , so when a button is pressed first led goes on and with the next press its the turn of the second one to light up and so on in a loop .
Unfortunatly the program compiles very well but fails when i simulate the uC on ISIS , am by the way using the PIC16F84A , and using porta.b0 as input for the button , portb.b0 to portb.b3 as outputs for the 4 leds .
Here is the program script :
I have a hard time using this program witch consists of controlling the lightning of 4 leds with the press of a button , so when a button is pressed first led goes on and with the next press its the turn of the second one to light up and so on in a loop .
Unfortunatly the program compiles very well but fails when i simulate the uC on ISIS , am by the way using the PIC16F84A , and using porta.b0 as input for the button , portb.b0 to portb.b3 as outputs for the 4 leds .
Here is the program script :
Rich (BB code):
#define start porta.b0
#define led1 portb.b0
#define led2 portb.b1
#define led3 portb.b2
#define led4 portb.b3
int Leds[6]= {0x00,0x01,0x02,0x04,0x08};
int i=0 ;
void main() {
porta=0x00;
portb=0x00;
trisa=0xff;
trisb=0x00;
i=1;
if( start==1){
delay_ms(200);
portb= Leds;
i++;
delay_ms(500);
if(i==6){
i=0;
}
}
}