Electronics > Microcontrollers

[PIC16C773] Toolchain help

(1/4) > >>

Sudo_apt-get_install_yum:
Hello everybody!

I have to make some very minor changes to the firmware of a 20 year old product. Issue is that i have no idea of how to compile the code....

The only thing i have to go of is that its a PIC16C773 and the code is dated September 2003, there is only one file main.c and it references <pic.h> (presumably abstraction from the IDE).
I do know that MPLAB IDE 8.50 is used to program the processor so i've tried to compile it using that version of the IDE but just get ~100 errors about Illegal character (X), Illegal opcode (X) and that it is unable to open "pic.h". I assume that this is the source for a lot of errors but wouldn't it be a part of the IDE/toolchain? This error number 36 so quite a few other complaint before missing library files.

Maybe another compiler/library was used but i have no idea, there is zero documentation of this.

Does anybody have any idea on how to compile this?
I've never used PIC nor any toolchain from this time, other than gcc and make.

I appreciate any help :)

Ian.M:
"Illegal Opcode" 'smells' like you are attempting to use the Microchip MPASM assembler toolchain for C sourcecode!  |O

IIRC 20 years ago Microchip didn't have their own PIC16 C compiler though there were a couple of third party ones.

You'd need to post enough of the source file for us to identify the compiler, which we do by recognising the names of system functions, how the CONFIG word is set, device or compiler specific includes, and various data types.   Then you'd need to find a copy of that compiler and install it as MPLAB 8 didn't come with compilers (though you could optionally install demo versions of several with limited device support or program size restrictions).  Then you have the problem of obtaining a valid licence key for a legacy compiler as without it, most will drop back to demo mode, and even if the demo mode supports your chip, either code size restrictions or lack of optimization will bite your ass.

JPortici:
Luckily the .mcs file is a text file, and should have enough information to identify the toolchain

Sudo_apt-get_install_yum:

--- Quote from: Ian.M on November 23, 2023, 01:30:37 pm ---"Illegal Opcode" 'smells' like you are attempting to use the Microchip MPASM assembler toolchain for C sourcecode!  |O

--- End quote ---

Haha you're probably right, looking through the different configurations of MPLAB suggests that....
Thought i was using the built in PIC-C C-compiler but it doesn't seem to exist, falling back to the MPASM suit :/
I have hower tried to compile it with the MPLAB X IDE with a C-compiler and it does not work. Im however able to create a project for the old processor in this modern IDE.

There are two flags/defines and such that aren't defined in the C-file or referenced in the datasheet.

* STAT_BF
Found one mention in this paper https://picmania.garcia-cuervo.net/recursos/ccs_picc_pic16f87x_tutorial_-_1a.pdf.
Below is stated in the paper, i have no idea what PCW is, google suggests its "The Philippine Commission on Women" but i doubt the code is compiled there :/

--- Quote ---Program UNION_1.C compiles under PCW. However, when compiling in MPLAB, MPLAB hangs. I saw this
problem at a recent workshop and also a posting on the PICLIST describing the same problem.
--- End quote ---

* ADGO
Cant find any mention on google regarding this.

Almost all of the code seems to be handwritten/not using external functions. Other than the above mentioned "defines".

DavidAlfa:
Pic.h refers to the old Hitech compiler, now XC8.
Mplab is just an IDE, doesn't come with any compiler by default.
Mplab 8 is ancient, but older xc8 versions will work fine.
Download a v1.xx version from the archive (v2.xx works only in mplabX):
https://www.microchip.com/en-us/tools-resources/archives/mplab-ecosystem

I think v1.45 worked in mplab 8.92, but I recall having issues with certain deprecated functions/pragmas and reverting to v1.33. So I'd try that one first.

IIRC all pic.h includes should be replaced with xc.h.

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod