Page 1 of 1

Importing C code program to FC8

Posted: Wed Jun 06, 2018 7:14 am
by streammaster
I never tried to do this, but i hope it is possible.
I would like to reuse the driver modules with source in C in a FC8 project. What would be the best practice to do so to import working C project or part of it?
Here is a practical example. There is a display driver as part of the working project in microchip MPLAB. I would like to extract the c code from driver main and from the header file(s) (or just simply include a header files), and place them in to FC and create FC macros which i can (re) use in FC environment. I tried to create the project and place the c code in to the FC, hoping for miracle, but compiler is creating tones of errors, which are mostly related to the variable and function definitions (missing definitions) in this process i managed to fix all missing files errors by defining exact paths to files. I can see as possibly conflicting point the hardware configuration, but i hope this is possible to define using C as well in FC8.
Could you guide me here please?
Once i figure it out and have success i will document procedure and publish back to forum how to do it document for everyone as the reference.
In particular case, with this display driver, a first step is to implement all macro functions without simulation and hardware configuration in FC. Once this stage is completed i will try to make the FC simulation, and configuration interface which will lead to have a FC component which then could be used in any FC project with any hardware.
I attached relevant source files for the display driver which needs to be imported in the FC.
Microchip source code ERC12832-1.zip
(8.07 KiB) Downloaded 296 times
I would appreciate anyone's idea which can direct me to the success.

Re: Importing C code program to FC8

Posted: Wed Jun 06, 2018 4:52 pm
by Benj
Hello,

This seems to be working.
LibCode.zip
(10.09 KiB) Downloaded 345 times
I've included the library via the Build -> Project Options -> Supplementary Code.

I had to comment out a few lines in the library as the clock speed was being redefined and it had a dependancy it couldn't find but this didn't seem to actually be required. Currently compiling fine for me.

Re: Importing C code program to FC8

Posted: Mon Sep 07, 2020 4:50 pm
by Kisen
Hello,

I just tried to download this Libcode.zip file as i was hoping it would show me how to import pre existing c files. I just get an unexpected end of archive error.

Is there a more direct tutorial for doing this sort of thing?