Log in

View Full Version : Creating new MPLab Project


Mike
14-01-2006, 16:16
So today I tried opening up the '06 code on my MPLAB 6.3. It wouldn't open, so I figured "OK, I can just make a new project." I did that, got the correct chip to program for, etc. Now it gave me an error on

Generate_Pwms(pwm13,pwm14,pwm15,pwm16);

The error was

C:\FIRST\code\user_routines_fast.c:143:Error [1203] too few arguments in function call


So, I did a search for Generate_Pwms. It returned

#ifdef _FRC_BOARD
/* located in ifi_library.lib */
void Generate_Pwms(unsigned char pwm_13,unsigned char pwm_14,
unsigned char pwm_15,unsigned char pwm_16);
#else
/* located in ifi_library.lib */
void Generate_Pwms(unsigned char pwm_1,unsigned char pwm_2,
unsigned char pwm_3,unsigned char pwm_4,
unsigned char pwm_5,unsigned char pwm_6,
unsigned char pwm_7,unsigned char pwm_8);
#endif


So I assume it is using the second function prototype. This is probably because I neglected to set the pre-processor _FRC_BOARD. I looked in all the menus and such, but couldn't find a listing of pre-processor directives and their values. How do I change that value?

Thanks

Alan Anderson
14-01-2006, 18:13
I don't have a copy of MPLAB handy to check, but I'm pretty sure you'll find a "Compiler Options" choice under the Project menu.

Manoel
14-01-2006, 18:22
With your project open in MPLAB:

Project > Build Options > Project

There, select the MPLAB C18 tab and, under Macro Definitions, add _FRC_BOARD.

You can also enable code optimizations by editing the "-Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-" strings.

These (http://www.chiefdelphi.com/forums/showthread.php?t=34796) two (http://www.chiefdelphi.com/forums/showthread.php?t=35270&highlight=volatile) posts discuss it in more detail.

Mike
14-01-2006, 19:09
Ok, so I did that. I also had to have a custom error suppressantt added to my build options, so I now use the "User alternate settings" function. So to add a macro, I found out that I needed to append -D_MACRO_NAME to my build options. My total build options are now

-D_FRC_BOARD -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- -nw=2066


But now I get the error

Executing: "C:\Program Files\MPLAB IDE\MCHIP_Tools\mplink.exe" /l"c:\mcc18\lib" "18f8520.lkr" "C:\FIRST\code\camera.o" "C:\FIRST\code\ifi_startup.o" "C:\FIRST\code\ifi_utilities.o" "C:\FIRST\code\main.o" "C:\FIRST\code\serial_ports.o" "C:\FIRST\code\terminal.o" "C:\FIRST\code\tracking.o" "C:\FIRST\code\user_routines.o" "C:\FIRST\code\user_routines_fast.o" "C:\FIRST\code\FRC_alltimers.lib" "C:\FIRST\code\FRC_alltimers_8520.lib" "C:\FIRST\code\FRC_library.lib" "C:\FIRST\code\FRC_library_8520.lib" /o"FRC.cof"
MPLINK 3.50, Linker
Copyright (c) 2003 Microchip Technology Inc.
Assertion failed: 0, file ..\..\mplink\LanguageToolShared/mgproc.c, line 873

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.


Any idea of what's wrong now?

Astronouth7303
15-01-2006, 14:26
Ok, so I did that. I also had to have a custom error suppressantt added to my build options, so I now use the "User alternate settings" function. So to add a macro, I found out that I needed to append -D_MACRO_NAME to my build options. My total build options are now

-D_FRC_BOARD -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- -nw=2066


But now I get the error


Any idea of what's wrong now?

I believe this is akin to the infamous syntax error. It decided it didn't like you, or something.

First try cleaning the project and rebuilding (in case of file corruption). Then try changing some compilation options. (eg, optimization)