# MPLAB help

#### vane

Joined Feb 28, 2007
185
I bought the June 09 issue of Elektor magazine with part 2 of Embedding C programming.

I downloaded MPLAB but i can not get it to function properly

I tried making a new project then added a file called main.c to the project and inset this code:
Rich (BB code):
void delay(unsigned int);
void set_7segment(int, int );
unsigned int t;

void main(void)
{

delay(100);
set_7segment(3,1)
...
}

void delay(unsigned int k)
{
int i;
...
}

void set_7segment(int nr, int dp)
{
...
}

if ((P1IN & BIT5)== 0)
{
do
{
P1OUT |= BIT1;
delay(3);
P1OUT &= BIT1
delay(3);
}
while(P1IN & BIT6);
Can anyone help me on this subject?

EDIT: BTW i managed to set it to PIC16F627

#### n9352527

Joined Oct 14, 2005
1,198
What C compiler are you using with MPLAB? MPLAB itself only comes with assembler, there is a separate download for C18 compiler, which supports PIC18 only. To program PIC16 with C you need to additional C compiler, such as CCS or Hi-Tech. These are pay for software, but you could download the limited evaluation version if you wish.

#### vane

Joined Feb 28, 2007
185
Thats is pretty stupid :s

#### vane

Joined Feb 28, 2007
185
ah, when i was installing it gave me the option of installing HI-TECH C or something like that, would that be what i need?

#### n9352527

Joined Oct 14, 2005
1,198
Yes.

#### vane

Joined Feb 28, 2007
185
any idea on how to operate it?

#### n9352527

Joined Oct 14, 2005
1,198
No. I've never used Hi-Tech compiler. I use C18 on 18F, and assembly for other devices. But the procedures should be similar. Choose the tools from the menu and select the compiler on the dialog box. There should be a help file coming with the compiler. And 'How to Get Started' example.