c - How to break a loop in mikroC -


i primary in programming mikroc (microchip). need break loop in code have no result "break;" if me? need make after while condition satisfied "stop" everything!

this flowchart project:

my project flow chart "ags system" auto generator starter

here code:

void main() {     int x=0;     trisd=0b00011111;     trisb=0b11111000;     portb.f0=0;     portb.f1=0;     portb.f2=0;     while(1){         if(x==3){break;}         if(portd.f1==0)         {             if(portb.f2==0){portb.f1=1;delay_ms(50);portb.f0=1;delay_ms(300);portb.f2=1;}         }         if(portb.f2==1){portb.f0=0;}         if(portd.f1==1)         {             portb.f1=0;portb.f0=0;portb.f2=0;         }         portb.f2=0;         delay_ms(300);         while(x<=4){             x++;             if(portd.f1==0)             {                 if(portb.f2==0){portb.f1=1;delay_ms(50);portb.f0=1;delay_ms(300);portb.f2=1;}             }             if(portb.f2==1){portb.f0=0;}             if(portd.f1==1){delay_ms(300);portb.f0=0;portb.f1=0;portb.f2=0;}         }     } } 

try with:

if(x>=3){break;} 

since increase x 5 here: while(x<=4){x++, , enter infinite loop.


Comments

Popular posts from this blog

android - questions about switching from C2DM to GCM -

c++ - Qt setGeometry: Unable to set geometry -

batch file - How to extract all multi-volume RAR archives from subfolders of a folder? -