Sintax error?

General discussion on mikroC.
Post Reply
Author
Message
iasuazo
Posts: 1
Joined: 23 Jul 2010 03:44

Sintax error?

#1 Post by iasuazo » 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;
  }
}

Colin
Posts: 738
Joined: 15 Oct 2007 08:53
Location: Australia

Re: Sintax error?

#2 Post by Colin » 24 Jul 2010 07:05

You might want to ask that question in the proper forum.
You will get better responses. Also please use code tags.

User avatar
tihomir.losic
mikroElektronika team
Posts: 2138
Joined: 02 Dec 2009 14:16
Location: Serbia
Contact:

Re: Sintax error?

#3 Post by tihomir.losic » 27 Jul 2010 14:52

iasuazo wrote: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!!
Hello,

first of all, I want to suggest you to use our newest version of compiler:
mikroC PRO for PIC v3.8
mikroC PRO for PIC is a full-featured C compiler for PIC microcontrollers from Microchip.
Its development environment includes a set of features such as easy-to-use IDE, very compact and efficient code,
hardware and software libraries, comprehensive documentation, software simulator, hardware debugger support,
COFF file generation and many more. Numerous ready-to-use examples will give you a good start for your embedded projects.

After that, you need to do following:
- create new project (I used PIC16F887)
- enter your code
- then you need to choose ICD debug and mikro ICD (please, look at screen)
ICD_debug.PNG
ICD_debug.PNG (40.12 KiB) Viewed 1183 times
After successful compilation and MCU programming press F9 to start the mikroICD. After the mikroICD initialization a blue active line should appear:
debugging.PNG
debugging.PNG (51.16 KiB) Viewed 1183 times
You can debug the program line by line. To execute code line by line press [F8]. However, it is not recommended to use Step Over [F8]
over Delay routines and routines containing delays. In this case use Run to cursor [F4] function or Run [F6] function combined with Breakpoints.
Note that PORTB, TRISB, ANSEL and ANSELH changed its values from 255 to 0. Step Into [F7], Step Over [F8] and Step Out [Ctrl+F8] are mikroICD
debugger functions that are used in stepping mode. There is also a Real-Time mode supported by the mikroICD. Functions that are used in the Real-Time
mode are Run/Pause Debugger [F6] and Run to cursor [F4]. Pressing F4 executes the code until the program reaches the cursor position line.

For any further assistance, feel free to contact me.

Best regards,

Losic Tihomir
mikroElektronika [Support team]

Post Reply

Return to “mikroC General”