Hello, and help with directions

Say "hi" here, and any general non PIC related chat.

Hello, and help with directions

Postby RetireeJay » Wed Feb 17, 2021 9:47 pm

Hello,
I'm a newbie to PIC progrmming, so I don't even know exactly where to go in this forum. The PIC in question is a [EDIT] 16F628. Is that a "14-bit" or "14-bit enhanced"?

Anyway, what I'm trying to do is take some fairly old software written in Assembly language and try to make just a teensy-weensy modification to it. But the MPLAB X IDE v5.45 is throwing me out at essentially the first line.

An error message (probably not the only one) says "C99 compliant libraries are currently not available for baseline or mid-range devices, or for enhanced mid-range devices using a reentrant stack; using C90 libraries"

So can someone direct me to the right sub-forum in this forum and/or tell me how to get an Assembler that will work with my code? The comments in the header of the program file indicate that the program may be as old as 2006.
Last edited by RetireeJay on Thu Feb 18, 2021 2:33 pm, edited 1 time in total.
RetireeJay
 
Posts: 4
Joined: Wed Feb 17, 2021 9:30 pm

Re: Hello, and help with directions

Postby vloki » Thu Feb 18, 2021 9:10 am

Unfortunately the old MPASM assembler is no longer part of MPLABX IDE.
May be it's best to install an older one from the archive.
https://www.microchip.com/development-t ... ds-archive

Think v5.35 was the last version including it.
vloki
Verified identity
 
Posts: 186
Joined: Wed May 28, 2014 8:42 am
Location: Germany
PIC experience: Professional 5+ years with MCHP products

Re: Hello, and help with directions

Postby ric » Thu Feb 18, 2021 11:53 am

Indeed. MPLABX 5.35 is the last one to include MPASM.

Note, there is no such part number as 16F268. Have another look. Maybe it is 16F628
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 592
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products

Re: Hello, and help with directions

Postby RetireeJay » Thu Feb 18, 2021 2:44 pm

ric wrote:Indeed. MPLABX 5.35 is the last one to include MPASM.

Note, there is no such part number as 16F268. Have another look. Maybe it is 16F628


Thank you both for the info about MPLABX 5.35. I never would have known which file to choose out of the archive without your help. :D

You're right about the part number. I made a typo when I saved the PDF specification file, and that incorrect number kept showing up in the PDF reader "tab"! :oops:
RetireeJay
 
Posts: 4
Joined: Wed Feb 17, 2021 9:30 pm

Re: Hello, and help with directions

Postby RetireeJay » Thu Feb 18, 2021 7:39 pm

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
RetireeJay
 
Posts: 4
Joined: Wed Feb 17, 2021 9:30 pm

Re: Hello, and help with directions

Postby ric » Thu Feb 18, 2021 8:21 pm

That #define line looks bad. Try changing
#define DISPLAY_VARIANT_2 : second prototype, separated PIC and display board
to
#define DISPLAY_VARIANT=2 : second prototype, separated PIC and display board
or even
#define DISPLAY_VARIANT=2
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 592
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products

Re: Hello, and help with directions

Postby RetireeJay » Thu Feb 18, 2021 11:28 pm

Almost all the problems went away when I specified use of MPASM instead of XC8 for the assembler toolchain!
Just for grins, here's a little test I wrote to check out different ways of getting what I wanted. By having the #warning statements in there, I could verify exactly which path the assembler took through the selection matrix, because it would give me errors with line numbers.
Code: Select all
list P=16F628
 #include "p16F628.inc"     ; processor specific definitions
 #define DEBUG 0         ; DEBUG=1 for simulation, DEBUG=0 for real hardware
 
#define DISPLAY_VARIANT  2  ;comments
#if (DISPLAY_VARIANT == 1)  ;comments
  #define DISP_VARIANT  1   ;comments
  #define COMMON_ANODE   0  ;comments
  #define COMMON_CATHODE  1 ;comments
  #warning
#else            ;comments
    #if (DISPLAY_VARIANT == 2)   ;comments
      #define DISP_VARIANT  2   ;comments
      #define COMMON_ANODE   0   ;comments
      #define COMMON_CATHODE  1   ;comments
      #warning
    #endif         ;comments
#endif
   
#if (DISP_VARIANT == 1)
    #warning
#else
    #warning
#endif
    END
RetireeJay
 
Posts: 4
Joined: Wed Feb 17, 2021 9:30 pm


Return to Introductions and general chat

Who is online

Users browsing this forum: No registered users and 1 guest