Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem in generating hex file for pic18f4550 microcontroller on terminal in linux

Status
Not open for further replies.

abhishekdixit

Full Member level 2
Full Member level 2
Joined
Dec 30, 2011
Messages
124
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Location
India
Activity points
2,182
hi all,
I am working on Ubuntu 14.04 LTS 32 bit. i want to copmile and generate hex file for pic18 microcontroller on linux using terminal. i have made many program on linux using MPLABX but now i want to do it on linux terminal. i am using mplabc18 complier for this, i have installed mplabc18 copiler from microchip website. and i also make c file on terminal using vim editor for compiling and generating what should i do? after searching on internet i found that for compiling abd generating hex file for this file i have to use Makefile. so how am i create this file? please help me.
 

First of all MPLAB C18 will not work on Linux, i don't know how you are using that.
I think you are using XC8 compiler from Microchip which is cross platform compiler, and supports mac, windows and linux.

Compiling a code from command line is not complicated, just use the correct command, and the command for compiling the code is as follow:-
Create a file which contains the code, suppose main.c is a file which contains this code


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// this is for pic16f877a and pic18f4550 will be same, just write the appropriate code
#include <xc.h>
 
#define _XTAL_FREQ  4000000UL
 
void main()
{
    TRISB = 0x00;
    while(1)
    {
        PORTB = 0x00;
        __delay_ms(1000);
        PORTB = 0xFF;
        __delay_ms(1000);
    }   
}



the command for compiling the code is as follow:-
Code:
xc8 --chip=16f877a main.c

Here is the snapshot of the compilation.

Windows Command Line Test.PNG

NOTE:- The above code is compiled using windows command line and it will be same for linux, the command line has nothing to do with Operating System in this case, as the compiler is cross platform.
 

hello,
Thanks for your concern, but i just want to inform you that MPLAB C18 works on linux platform, and you can get it form following link
**broken link removed**
if this link does not work, then i will provide you this from another way.

and as i can see the terminal which you have shown in snapshot, is a windows DOS terminal. and i am talking about linux terminal. is this xc compiler also work on linux terminal?? bcoz now i am able to generate hex file using linux terminal using MPLAB C18 compiler.
Thank You

Regards,
Abhishek
 

The Link you provided doesn't works for me.

And still i had not heared about MPLAB C18 for linux, i checked there download page https://www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=SW006011#dtDocumentation and found the they are still offering the windows version only.

This is main reason due to which Microchip has moved to new X Series, whether it is MPLAB X, MPLAB XC8, XC16 and XC32, they all are cross platform and works in Windows, Linux and MAC OS.

and as i can see the terminal which you have shown in snapshot, is a windows DOS terminal. and i am talking about linux terminal. is this xc compiler also work on linux terminal?? bcoz now i am able to generate hex file using linux terminal using MPLAB C18 compiler.

I had mentioned that thing in my last post as i dont have XC8 installed on my Linux Machine, so i an not able to produce the required snaps for linux OS, but i am 100% sure, that the build process will be similar.

Apart from that can you share the working link of MPLAB C18 for Linux, i just wanted to check that, and also how you managed to build the code in Linux using MPLABC18.

- - - Updated - - -

I just installed XC8 v1.33 on my Linux Machine, and the whole process which i mentioned in my first post is correct.

Here are the snaps showing the results, generated hex file is tested on Labcenter Electronics Proteus Also.

XC8_Linux_Terminal_Test.png

Proteus Simulation Result

Led High.png


Led Low.png
 

hello,
I have shared you google drive link for MPLAB C 18 linux compiler on your email id.
try to use it
may be it will work.
Thank You

Regards,
Abhishek
 

Show me the microchip website link, and official download page, if you have.
Rest its okay,
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top