Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 23rd January 2009, 04:06 PM   #1
Default Problem with first "C" program attempt. MCC-18

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);



}
binzer is offline  
Old 23rd January 2009, 04:44 PM   #2
Default

Quote:
Originally Posted by binzer View Post
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). 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
}
__________________
=========================
Futz's Microcontrollers & Robotics
=========================

Last edited by futz; 23rd January 2009 at 04:46 PM.
futz is offline  
Old 23rd January 2009, 04:58 PM   #3
Default

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 by AtomSoft; 23rd January 2009 at 04:59 PM.
AtomSoft is offline  
Old 23rd January 2009, 06:17 PM   #4
Default

Quote:
Originally Posted by AtomSoft View Post
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.

Quote:
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
binzer is offline  
Old 23rd January 2009, 06:46 PM   #5
Default

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
__________________
Please post questions to the forums. PM's are for personal communication.

BCHS/3v0's Tutorials
Junebug USB PIC programmer kit., USB Bit Whacker,
The 15 Minute Printed Circuit Board! (+drill time)
3v0 is offline  
Old 23rd January 2009, 07:08 PM   #6
Default

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>
AtomSoft is offline  
Old 24th January 2009, 06:13 AM   #7
Default

Quote:
Originally Posted by 3v0 View Post
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.

Quote:
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 by binzer; 24th January 2009 at 06:14 AM.
binzer is offline  
Old 24th January 2009, 06:28 AM   #8
Default

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.
__________________
Please post questions to the forums. PM's are for personal communication.

BCHS/3v0's Tutorials
Junebug USB PIC programmer kit., USB Bit Whacker,
The 15 Minute Printed Circuit Board! (+drill time)
3v0 is offline  
Old 24th January 2009, 07:10 AM   #9
Default

Quote:
Originally Posted by 3v0 View Post
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
binzer is offline  
Old 24th January 2009, 07:18 AM   #10
Default

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 by Pommie; 24th January 2009 at 07:19 AM.
Pommie is online now  
Old 24th January 2009, 07:39 AM   #11
Default

Quote:
Originally Posted by Pommie View Post
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
binzer is offline  
Reply

Tags
attempt, mcc18, problem, program

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
while(feet!=wet) { search(friendly="Linux", hardware="avr", software="kde desktop");} FirefighterBlu3 Micro Controllers 6 12th September 2008 06:31 PM
Basic how to "Electronics program"... Im using Multi Sim 10 R3tic General Electronics Chat 4 29th October 2007 09:43 PM
Where to find "How to Program" info for beginners Tim_B Micro Controllers 6 8th May 2007 12:27 PM
Inchworm "Hello World" (your first PIC program) draft #1 William At MyBlueRoom Micro Controllers 5 15th January 2007 02:59 AM
8051 "data" storage within program memory - how? L0D|Mr_B 8051/8951 1 11th January 2004 03:56 PM



All times are GMT. The time now is 05:00 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker