Conditional inclusion
Posted: 21 Jul 2011 06:57
I have a program which has conditions for the LV32MXv6 development board and the target processor.
This is ok, as long as the PIC32MC460F512l is selected, but we have a problem when the target PIC32MX320F32H is selected:
The problem is that the compiler objects to the TRISA in the upper clause even when Protoboard is selected, because the PIC32MX320F32H doesn't have a port A. The compiler shouldn't object to undeclared variables in a non-operative clause, but it does.
Code: Select all
// Uncomment the appropriate flag:
{$DEFINE LV32MXv6} //Declarations for LV32MX v6 develpment board using
// PIC32MX460F512L
//{$DEFINE Protoboard} // Declarations for actual prototype board
Code: Select all
{$IFDEF LV32MXv6}
{Initialization specifically for LV-32MX v6 develpment board
using PIC32MX460F512L. For a summary of all I/O pins and how the TRIS registers are derived
see here: }
TRISA := 64; TRISB := 62; TRISC := 16; TRISD := 0;
TRISE := 0; TRISF := 0; TRISG := 128; AD1PCFG := 0xFFFF;
{$ELSE}
{$IFDEF Protoboard}
{Initialization for actual prototype board
For a summary of all I/O pins and how the TRIS registers are derived
see herefig }
TRISB := 62; TRISC := 0; TRISD := 0;
TRISE := 128; TRISF := 4; TRISG := 128; AD1PCFG := 0xFFC1;