Sintax error?
Posted: 23 Jul 2010 07:26
Hello supporters, I have a little problem about this beginner`s code:
the especifications of it are in Spanish but in a simple way it works as a led blinking program using ports
B and C as you can see, so the essential trouble i had, was in lines (5,12,18). Some of the solves I`ve thinking are about
the software version(mikroC v2.5), besides I`ve already tried v8.5 but it persist. other little thing im just fighting with, to try to run a .dbg file, it appears a message saying that theres not a .dbg file saved and givsing me the solution to
rebuild the program starting again.
please try to share some tips about it!!
Best regards!
IS
1 //Ejemplo 1-1
2 unsigned short i,tmp; // variable declaration
3 void main(){
4 //PORTB = 0;
5 Delay_ms(1000); //Initialize PortB off.
6 TRISB = 0;TRISC = 0;
10 PORTB = 0;PORTC = 0;
11 tmp=1;
12 for(i=0;i<=8;i++){ //for cicle for 8 bits (representadas por 8 LEDs)
13 PORTB=tmp; //we write the tmp value to the PORTB
14 Delay_ms(1000); // 1 second delay
15 tmp=tmp*2; // making the operation for the n power
}
16 // same operation for PORC
17 tmp=1;
18 for(i=0;i<=8;i++){
19 PORTC=tmp;
20 Delay_ms(1000);
21 tmp=tmp*2;
}
}
the especifications of it are in Spanish but in a simple way it works as a led blinking program using ports
B and C as you can see, so the essential trouble i had, was in lines (5,12,18). Some of the solves I`ve thinking are about
the software version(mikroC v2.5), besides I`ve already tried v8.5 but it persist. other little thing im just fighting with, to try to run a .dbg file, it appears a message saying that theres not a .dbg file saved and givsing me the solution to
rebuild the program starting again.
please try to share some tips about it!!
Best regards!
IS
1 //Ejemplo 1-1
2 unsigned short i,tmp; // variable declaration
3 void main(){
4 //PORTB = 0;
5 Delay_ms(1000); //Initialize PortB off.
6 TRISB = 0;TRISC = 0;
10 PORTB = 0;PORTC = 0;
11 tmp=1;
12 for(i=0;i<=8;i++){ //for cicle for 8 bits (representadas por 8 LEDs)
13 PORTB=tmp; //we write the tmp value to the PORTB
14 Delay_ms(1000); // 1 second delay
15 tmp=tmp*2; // making the operation for the n power
}
16 // same operation for PORC
17 tmp=1;
18 for(i=0;i<=8;i++){
19 PORTC=tmp;
20 Delay_ms(1000);
21 tmp=tmp*2;
}
}