mikroc portb input
thanks for the reply. helped a lot. now i have another one, i want to run this such that RB7 act like a switch. when its on, it performs the task. Problem is, it doesn't work that way i tried with == and =. both not working. help is much appreciated. here is the code. another thing, how to simulate switch in MikroC IDE?
unsigned int i=1;
void main() {if (PORTB.F7=1)
{
PORTB = 0;
TRISB = 0;
while(1) {
for(i=1;i<=63;i=i++)
{
PORTB.f0 = 1;
Delay_ms(1000);
PORTB.f1 = 1;
Delay_ms (1000);
PORTB.f2 = 1;
Delay_ms (1000);
PORTB.f3 = 1;
Delay_ms(1000);
PORTB.f4 = 1;
Delay_ms (1000);
PORTB.f5 = 1;
Delay_ms(1000);
for(i=63;i>1;i=i--)
{
PORTB.f5 = 0;
Delay_ms(1000);
PORTB.f4 = 0;
Delay_ms (1000);
PORTB.f3 = 0;
Delay_ms (1000);
PORTB.f2 = 0;
Delay_ms(1000);
PORTB.f1 = 0;
Delay_ms (1000);
PORTB.f0 = 0;
Delay_ms (1000) ;
}
} } }
} //~!