posted June 11, 2003 12:13
Below is an overview of getting Salvo v3.1.0 to work with MPLAB-C18 and MPLAB v6.x.The next release of Salvo will include projects for MPLAB-C18 and MPLAB v6.x.
******************
Here's what I had to do to get Salvo tutorial tu5 for MPLAB-C18 to work with MPLAB v6.2:
1) From a clean install, create a new project for the 'C452 in \salvo\tut\tu5\syse called tu5lite(.mcp). Select the device (18C452) and Tools Suite (MPLAB-C18).
2) Add \salvo\tut\tu5\main.c and \salvo\tut\tu1\isr.c as source files to the project.
3) Add \salvo\lib\sfc18sfa.lib as a library to the project.
4) Add the appropriate linker script to the project.
5) Under Project -> Build Options -> Project -> General, set the Include Path to \salvo\tut\tu5\syse;\salvo\tut\tu1;\salvo\inc
6) Under Project -> Build Options -> Project -> General, set the Library Path to \mcc18\lib
7) Under Project -> Build Options -> Project -> General, set the Linker-Script Path to \mcc18\lkr
8) Under Project -> Build Options -> Project -> MPLAB-C18 -> Macro Definitions, you need to Add three symbols: MAKE_WITH_FREE_LIB, SYSE, and USE_INTERRUPTS. Also, ensure that the Procedural Abstraction optimizationa are disabled (-Opa-).
N.B. The symbols MAKE_WITH_FREE_LIB and SYSE are required for all six tutorial projects tu1-tu6 when using Salvo Lite. The symbol USE_INTERRUPTS is only required / appropriate for tutorials tu5 and tu6.
You should then be able to build the project.
For an alternative chip, e.g. the PIC18F452, normally all you would do is change the device (Configure -> Select Device) and the linker script file. However, If you do so and rebuild, MPLAB-C18 will complain about T0PS3 being improper for the 'F452. What happened is when Salvo v3.1.0 was released, there was a disparity among the various MPLAB-C18 header files. Apparently this has now been fixed, and for a successful build with the 'F452 and tu5 you'll need to change the appropriate line in \salvo\tut\tu1\main.h:
code:
#if defined(SYSE) // MPLAB-C18 uses different nomenclature
#if defined(__18C242) || defined(__18C252) || defined(__18C442) \
|| defined(__18C452) || defined(__18F248) || defined(__18F258) \
|| defined(__18F448) || defined(__18F458)
#define Init() { T0CONbits.T0CS = 0; \
T0CONbits.T0PS0 = 1; \
T0CONbits.T0PS1 = 0; \
T0CONbits.T0PS2 = 1; \
T0CONbits.PSA = 0; \
INTCONbits.TMR0IE = 1; }
#elif defined(__18C601) || defined(__18C658) || defined(__18C801) \
|| defined(__18C858) || defined(__18F010) || defined(__18F020) \
|| defined(__18F242) || defined(__18F252) || defined(__18F442) \
|| defined(__18F452)
#define Init() { T0CONbits.T0CS = 0; \
T0CONbits.T0PS0 = 1; \
T0CONbits.T0PS1 = 0; \
T0CONbits.T0PS2 = 1; \
T0CONbits.T0PS3 = 0; \ << change this line to read T0CONbits.PSA = 0;
INTCONbits.TMR0IE = 1; }
#endif
The salient point here in using MPLAB-C18 with MPLAB v6.x is that there is no need (barring the header-file issue I mention above) to edit any of the existing Salvo files for a successful build. Rather, paths need to be set properly (the tutorial projects reference the current project's folder, the \salvo\tut\tu1 folder, and \salvo\inc), source files and Salvo libraries need to be added to the project, and symbols (e.g. SYSE) must be defined for the source files as command-line options that are passed to the compiler.Regards,
------------------
[This message has been edited by aek (edited June 12, 2003).]