OK, I'm making some progress. I have MPLAB 5.35 running, but there's one particular error type that shows up like 13 times in the file. I think if I can do a global search-and-replace I'll be getting pretty close to being able to compile this file. But I can't understand what the assembler is looking for.
The error message is
nbproject/FreqMPLABX.as:147:21: error: token is not a valid binary operator in a preprocessor subexpression
#if DISP_VARIANT_1 ; display variant 1 : clocked with 4 MHz (low power, "XT" )Here is all the code leading up to that statement (minus a hundred lines of comments) The problem is in the very last #if statement below. Originally the definitions assigned a number to DISP_VARIANT; the original statement was
- Code: Select all
#if (DISP_VARIANT == 1)
. When the definition was numeric, I tried replacing the "==" with "=" or "equ" or just a space to no avail. Now I've got it simply as a compiler variable that is or is not defined, and I still have the problem!
Oh, and if the #include <p16F628.inc> line uses chevron brackets like this, the compiler says to use quotes instead. But if I use quotes, it says to use chevron brackets instead! I don't know where the file is really supposed to be, but I've got it in a place now where the assembler does not complain that it can't find the file - so I guess it can find the file.
- Code: Select all
list P=16F628
#include <p16F628.inc> ; processor specific definitions
#define DEBUG 0 ; DEBUG=1 for simulation, DEBUG=0 for real hardware
; Selection of LED display control bits... since 2005, three different variants.
; Select ONE OF THESE in MPLAB under "Project".."Build Options".."Macro Definitions"!
; DISP_VARIANT=1 : first prototype, PIC on left side of display
#define DISPLAY_VARIANT_2 : second prototype, separated PIC and display board
; DISP_VARIANT=3 : similar as (2), but for COMMON CATHODE display
#ifdef DISPLAY_VARIANT_1
#define DISP_VARIANT_1 ; very first (old) prototype by DL4YHF
#define COMMON_ANODE 0
#define COMMON_CATHODE 1
#else
#ifdef DISPLAY_VARIANT_2
#define DISP_VARIANT_2 ; 5 digits, new layout, COMMON CATHODE
#define COMMON_ANODE 0
#define COMMON_CATHODE 1
#else
#ifdef DISPLAY_VARIANT_3 ; added 2005-03-21 :
#define DISP_VARIANT_3 ; similar as (2), but for COMMON ANODE display
#define COMMON_ANODE 1
#define COMMON_CATHODE 0
#else
#define DISP_VARIANT_4
#define COMMON_ANODE 0
#define COMMON_CATHODE 1
"Error, Must define DISPLAY_VARIANT_1, .._2, or .._3 under project options"
; With MPLAB: Project..Build Options..Project..MPASM..Macro Definitions..Add
#endif
#endif
#endif
;**************************************************************************
; *
; PIC config definitions *
; *
;**************************************************************************
; '__CONFIG' directive is used to embed configuration data within .asm file.
; The lables following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.
; Since 2006-05-28, the watchdog must be ENABLE in the config word
; because of its wakeup-from-sleep function (see 'Sleep100ms') .
; EX(16F84:) __CONFIG _CP_OFF & _WDT_ON & _PWRTE_ON & _RC_OSC
#if DISP_VARIANT_1 ; display variant 1 : clocked with 4 MHz (low power, "XT" )
__CONFIG _CP_OFF & _WDT_ON & _PWRTE_ON & _XT_OSC & _LVP_OFF & _BODEN_OFF & _MCLRE_OFF
#else ; display variants 2+3 : clocked with 20 MHz (needs "HS" oscillator)
__CONFIG _CP_OFF & _WDT_ON & _PWRTE_ON & _HS_OSC & _LVP_OFF & _BODEN_OFF & _MCLRE_OFF
#endif