16F877A programming with mikroC problem

Discussion about projects that used PIC Microcontroller, Hardware Interface, Programming Algorithm and etc......

16F877A programming with mikroC problem

Postby wilsonz91 » Sat Jun 11, 2011 9:39 am

Hi,

I'm new to PIC. I'm using 16F877A and using mikroC to program it. However, i face a problem when i 'build' the program. It says 'can't open include pic.h'. My code is something as follow:

#include<pic.h>

#define pb1 RB0

.......(so on so forth)

What should I do? please help, thank you.
wilsonz91
Freshie
 
Posts: 4
Joined: Thu Jun 09, 2011 4:37 pm

Re: 16F877A programming with mikroC problem

Postby robosang » Sat Jun 11, 2011 4:02 pm

the #include <pic.h> is for HI-TECH Compiler. since you are using Mikro C, you should not need that line. Anyway 2 different compiler will have some different setting and library, so still a lot of modification needed. Good luck.
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: 16F877A programming with mikroC problem

Postby Brian Griffin » Sat Jun 11, 2011 9:45 pm

wilsonz91 WROTE:Hi,

I'm new to PIC. I'm using 16F877A and using mikroC to program it. However, i face a problem when i 'build' the program. It says 'can't open include pic.h'. My code is something as follow:

#include<pic.h>

#define pb1 RB0

.......(so on so forth)

What should I do? please help, thank you.


The Pic.h is only in Hi-tech compilers.

Next time, try not to blindly paste the code inside the compiler. Please check the compiler and the code before you compile. I've seen similar threads about that already this week.
PIC - UIC00B from Cytron (replacement for my broken PICKit 2), Pickit 3, MikroC for PIC
dsPIC - MikroC for dsPIC, mikromedia board (dsPIC33)
AVR - AVR Dragon
Parallax - Prop tool
User avatar
Brian Griffin
Enthusiast
 
Posts: 403
Joined: Mon Jan 17, 2011 9:36 am

Re: 16F877A programming with mikroC problem

Postby wilsonz91 » Sat Jun 11, 2011 10:26 pm

My friend gave me the code with #include<pic.h> and he told me to use mikroC so I just did as he told. Anyway,since that's for Hi-tech compiler, is there any '#include' needed for programming the pic using mikroC? i tried doing simple programming such as LED turning on and it worked.

Another question, for mikroC and Hi-tech C, is the initialization the same? eg.

TRISA0 = 0;

Is it applicable to both mikroC and Hi-tech C in initializing only port A0 as output port?
wilsonz91
Freshie
 
Posts: 4
Joined: Thu Jun 09, 2011 4:37 pm

Re: 16F877A programming with mikroC problem

Postby Brian Griffin » Sat Jun 11, 2011 10:47 pm

wilsonz91 WROTE:My friend gave me the code with #include<pic.h> and he told me to use mikroC so I just did as he told. Anyway,since that's for Hi-tech compiler, is there any '#include' needed for programming the pic using mikroC? i tried doing simple programming such as LED turning on and it worked.

Another question, for mikroC and Hi-tech C, is the initialization the same? eg.

TRISA0 = 0;

Is it applicable to both mikroC and Hi-tech C in initializing only port A0 as output port?


If you need to compile it into MikroC, take out the "#include <pic.h>".

You then go to Project->Edit Project (or Control+Shift+E) and edit whatever configurations that suits you and the microcontroller.

Different compilers have different ways of describing the ports.

In MikroC, it's just simply TRISA = 0 if you want them all outputs.
PIC - UIC00B from Cytron (replacement for my broken PICKit 2), Pickit 3, MikroC for PIC
dsPIC - MikroC for dsPIC, mikromedia board (dsPIC33)
AVR - AVR Dragon
Parallax - Prop tool
User avatar
Brian Griffin
Enthusiast
 
Posts: 403
Joined: Mon Jan 17, 2011 9:36 am


Return to PIC Microcontroller

Who is online

Users browsing this forum: No registered users and 6 guests