PIC / MPLAB PICC new user prob....

Trying to learn some C with PICs and I've fallen over before I've even started.

I'm running MPLAB with PICC18 (lite student version). When I try to compile I get an error:

"Error - could not find definition of symbol 'TRISD' in file './01 Hello LED.o'. Errors : 1 Link step failed."

In the project I have "p18f45k20.h" included under header files, TRISD is defined in this file but the compiler seems to be looking for the definition in "01 Hello LED.o".

Anyone tell me what I've missed?

thanks Nik

// PIC18F46K20 Starter Kit Lesson 1 - Hello LED // This lesson turns on LED 7 on the demo board.

#pragma config FOSC = INTIO67 #pragma config WDTEN = OFF, LVP = OFF, MCLRE = OFF

#include "p18f45k20.h"

void main (void) {

TRISD = 0b01111111; // PORTD bit 7 to output (0); bits 6:0 are inputs (1)

LATDbits.LATD7 = 1; // Set LAT register bit 7 to turn on LED

while (1) ;

}
Reply to
Nik Rim
Loading thread data ...

MPLAB -> Project -> Set Language Tool Locations -> MicroChip C18 ToolSuite ->

Default Search Paths & Directories -> Library Search Path, $(LIBDIR) C:\\ \\lib -> OK

don

Reply to
don

I checked as suggested, the paths were as follows and the directories appeared to contain the .inc & .lib files

Include search path: C:\\MCC18\\mpasm Library search path: C:\\MCC18\\lib

Thanks for the suggestion - it must be something else simple like that, I'll go look some more.

cheers Nik

Reply to
Nik Rim

I suspect that TRISD will only be *declared* in that file, not defined there.

For Microchip's MCC18, the definitions are in p18f45k20.lib. This is normally linked in by an entry in the linker script (.lkr), e.g.:

FILES p18f45k20.lib

If you aren't using a linker script, you'll need to add the library to the project.

Reply to
Nobody

Thanks - just tried making that change & unfortunately it didn't work.

I've changed the lib path directory as suggested by don. Didn't fix it but now having played with all the paths, it progresses further and spits out a syntx error from the first line in the .inc file. Its reporting the ";" which makes sense as I assume it should be "//" for C. Surely I must be doing something fundamental wrong here! It's a pain being a noob!

Reply to
Nik Rim

Problems fixed!

Reinstalled MPLAB-C18-Lite-v3_33.exe and after checking / setting toolpaths it progs would compile ok. Had a few probs then realised I had to have clib.lib as one of the libraries. Thanks for the replies/help - no doubt I'll be back soon asking for more.....

Reply to
Nik Rim

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.