Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Problem with first "C" program attempt. MCC-18

Status
Not open for further replies.

binzer

Member
MCC-18
First attempt. Just a simple setup the devices code.
I am getting a couple of errors when compiling.
The biggie is:
MPLINK 4.22, Linker
Copyright (c) 2008 Microchip Technology Inc.

Error - could not find file 'c018i.o'.

Errors : 1


I can find the file, I added it in the Project window dropdown, still no joy.

The other is the adc setup, probably just missed something (commented out), will go back and do some more reading.

Code:
#include "stdlib.h"

#include "p18f1320.h"

#include "usart.h"

#include "adc.h"

#include "portb.h"

unsigned char config;

unsigned int spbrg;



void main(void)

	{

// setup usart



 OpenUSART(USART_ASYNCH_MODE &

     USART_TX_INT_OFF &

     USART_RX_INT_OFF &

     USART_EIGHT_BIT  &

     USART_CONT_RX    &

     USART_BRGH_HIGH,

     25 );

// setup adc /



// OpenADC(ADC_FOSC_32 & ADC_RIGHT_JUST & ADC_4_TAD & ADC_VREFPLUS_VDD & ADC_VREFMINUS_VSS & ADC_CH0 & ADC_INT_OFF);

	

// setup port inputs /



	OpenPORTB( PORTB_CHANGE_INT_OFF & PORTB_PULLUPS_ON);



}
 
MCC-18
First attempt. Just a simple setup the devices code.
I am getting a couple of errors when compiling.
The biggie is:
MPLINK 4.22, Linker
Copyright (c) 2008 Microchip Technology Inc.

Error - could not find file 'c018i.o'.

Errors : 1
I don't use C18 so I can't help with the error thing, but I will help you by cleaning up and reposting your source code so it's readable (it's strangely double-spaced and sprawling). :p That way others will be more inclined to look at it.
Code:
#include "stdlib.h"
#include "p18f1320.h"
#include "usart.h"
#include "adc.h"
#include "portb.h"

unsigned char config;
unsigned int spbrg;

void main(void)
{
    OpenUSART(USART_ASYNCH_MODE &                           //setup usart
        USART_TX_INT_OFF &
        USART_RX_INT_OFF &
        USART_EIGHT_BIT  &
        USART_CONT_RX    &
        USART_BRGH_HIGH,
        25);

    //OpenADC(ADC_FOSC_32 & ADC_RIGHT_JUST & ADC_4_TAD & ADC_VREFPLUS_VDD & ADC_VREFMINUS_VSS & ADC_CH0 & ADC_INT_OFF);

    OpenPORTB(PORTB_CHANGE_INT_OFF & PORTB_PULLUPS_ON);    //setup port inputs
}
 
Last edited:
i see no config lines also if you get that error than maybe its in a bad folder. Try making a new project in C: like "c:\newcode\" and save it there.

Make sure you add a config line.

Futz its lined like that because he simply copied and pasted from the help file.
 
Last edited:
i see no config lines also if you get that error than maybe its in a bad folder. Try making a new project in C: like "c:\newcode\" and save it there..
Make sure you add a config line.

Will try that, and add some config lines.

Futz its lined like that because he simply copied and pasted from the help file.

I did a cut / paste from the program window of MPLAB, I thought it was because I was messing with it at work last night in WordPad, MPLAB don't like it when you do that.

My brain ain't screwed on correct, we are in the midst of layoffs at work and the line is supposedly drawn just below me, ain't a good feeling when you have 20yrs seniority.

Tnx, Mike
 
Your code has several includes like #include "p18f1320.h"

Use #include <p18f1320.h> to tell the compiler to look for the file in the C:\MCC18\h directory. The same holds for any file the is that directory.

The file should start with code about like this

Code:
// settings for configuration memory
#pragma	config OSC = INTIO2, WDT = OFF, LVP = OFF

// processor definitions
#include <p18f1320.h>
#include <usart.h>
#include <adc.h>

I am not sure where portb.h comes from.

3v0
 
forgot to state that 3v0 good find. To clerify:

If the header file is in the same directory as the source (*.c) file then use the:
#include "some.h"

if its in the default "MCC18" header directory "C:\MCC18\h" use:
#include <some.h>
 
Your code has several includes like #include "p18f1320.h"

Yup, got that.

Code:
// settings for configuration memory
#pragma	config OSC = INTIO2, WDT = OFF, LVP = OFF

// processor definitions
#include <p18f1320.h>
#include <usart.h>
#include <adc.h>

I did add the config info also.

I am not sure where portb.h comes from.
3v0

I got that from the Library manual, I/O Port Functions for port 'b' says include portb.h

I am going to try a new directory for program storage, mine is a few levels deep and that might just be causing a problem.

Thanks, Mike
 
Last edited:
Are you still getting the error

Error - could not find file 'c018i.o'.

It has nothing to do with your code. If the project is setup correctly you should not get it.

Try the new directory and use the project wizzard to setup the project choosing the C18 compiler. It should fix the problem.
 
Are you still getting the error

Error - could not find file 'c018i.o'.

It has nothing to do with your code. If the project is setup correctly you should not get it.

Try the new directory and use the project wizzard to setup the project choosing the C18 compiler. It should fix the problem.

Yes, Still getting the error.
I am going to reload MPLAB and MCC, got that going now, I'll post back in the AM if I have time before going to work.

Thanks, Mike
 
From the C18 getting started guide,

EM-2 Linker error: “could not find file ‘c018i.o’”
Enter the proper directory path in Project>Build Options…>Project General tab. Set
the Library Path box to “C:\mcc18\lib”. c018i.o is the start-up library for MPLAB
C18. It sets up the stack, initializes variables, then jumps to main() in the application.

Mike.
 
Last edited:
From the C18 getting started guide,

EM-2 Linker error: “could not find file ‘c018i.o’”
Enter the proper directory path in Project>Build Options…>Project General tab. Set
the Library Path box to “C:\mcc18\lib”. c018i.o is the start-up library for MPLAB
C18. It sets up the stack, initializes variables, then jumps to main() in the application.

Mike.

Ok. I did a default install so I am not sure why that did not get set correctly, BUT, I did set it just now after a new install and the error is gone, compile completed.

Thank you much.

Now for a little sleep.

Mike
 
Status
Not open for further replies.

Latest threads

Back
Top