Hi all of you .
I have just finished writing a program and it works but as you see in the code , i have used portb= Leds; into the while(1) loop , why i can't work with it outside the loop ? tricky logic here
My code :
I have just finished writing a program and it works but as you see in the code , i have used portb= Leds; into the while(1) loop , why i can't work with it outside the loop ? tricky logic here
My code :
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=0;
while(1) {
if( start==1){
delay_ms(200);
i++;
portb= Leds;
delay_ms(500);
}
if(i==4){
i=0;
}
}
}
Last edited: