![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
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);
}
| |
| |
| | #2 | |
| Quote:
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. | ||
| |
| | #3 |
|
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.
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics Last edited by AtomSoft; 23rd January 2009 at 04:59 PM. | |
| |
| | #4 | ||
| Quote:
Quote:
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 | |||
| |
| | #5 |
|
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> 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) | |
| |
| | #6 |
|
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>
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #7 | |
| 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> Quote:
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. | ||
| |
| | #8 |
|
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) | |
| |
| | #9 | |
| Quote:
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 | ||
| |
| | #10 |
|
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. | |
| |
| | #11 | |
| Quote:
Thank you much. Now for a little sleep. Mike | ||
| |
|
| 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 |