Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

C18 problem

Wp100

Well-Known Member
Hi,

Have some C18 code v 3.05 circa 2007 for a project that we originally just programmed up the hex code into the chip and it worked ok, but now would like to make some small changes to the program,

We have Mplab v8.92 set up for our old Assemby code work that we have also not touched for several years.
We downloaded C18 Eval and loaded in the project but we got a linker error that the web suggests uninstalling and reloadng Mplab and C18 should solve.

Now we get this message which seems obvious enough but the devices seems to be specifed in the code and is also in the Configue Select box.

Any help please ...


002003.jpg



002002.jpg
 
It's been a long time since I used it, but didn't C18 come with its own version of mpasm and mplink?
Do you have the toolsuite installed to point to the C18 folder?

C18 3.05 is older than the versions I've used, so maybe it doesn't matter...
 
You don't have an explicit device type line - eg. in the one and only C18 program I have, the first non-comment line:
(I usually use the CCS compiler).

#include <18F452.h>

Try
#include <18F4550.h>
at the start??
 
It really doesn't take long to change the code to XC8. You will have mega issues to get any peripheral libraries working, The latest C18 was 3.47 but you can't get it without pleading with Microchip.

The /p option is set in the build options ( but normally automatic ) You may need to go back to MPLAB v8.xx to compile this. That version( thankfully) is in the archive.

Its the linker whinging, not the compiler.. Also, be aware that the eval version is very bloated and may, depending on the amount of code, not fit.

Your best bet is to get the old peripheral libraries and run it in the much newer XC8. It should compile off the bat.
 
On my MPLab 8.92 with 16F chips, I have to add "p" or I get similar errors. I don't know about 18F chips.

I also use the hex for config, and comment the actual settings to avoid a nag message about the word being too long.

1712216147491.png
 
Thanks all for the advice, will try them and see how far we can get.
Though doing a lot of Assembly code in the past, C always looked so complicated and we never touched it.

The above program is for a digital train controller and it still works well using four standard potentiometer controls and though there are many similar more modern programs they all use mobile phone apps/wifi with screen sliders as the handsets which we do not like.
 
Thanks Ian, but following on from the above comments now wondering if its worth all the trouble for the few mods we want or can make to this little project.
Perhaps better to follow the old saying, " if it aint broke..... "
You aren't fixing it. You say you are intending to modify (improve?) it.
 
No, we initially thought we could readily modify the program code, but after taking onboard the above good advice and what little we could actually achieve if we did, it does not seem worthwhile.
It should be pretty easy, and it's worth you doing it simply to make it easier to modify in the future, if you ever need to. C18 is generally pretty simple to move to XC8.
 

Latest threads

New Articles From Microcontroller Tips

Back
Top