Figured Out MPLAB X


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557

    Default Figured Out MPLAB X

    Well, at least enough to get some LEDs blinking with Assembly Code. Following an older (2007 I think) book, I was able to get some basic things happening with MPLAB 8.90 several months ago. Try as I may, I couldn't get ANYTHING happening with MPLAB X. Over the holidays I decided to watch videos, read Application Notes, and play until I could get functional. Played with a PIC12F1822 and PIC18F13K22. Tried to do something with the PIC18F26K42, but kept getting errors. There are template (TEMPO.ASM) examples for select MCUs, mostly older ones. Apparently there is something different about the K42 where the K22 TEMPO doesn't work. I did notice the overall format was different between the 12F and 18F. Next I want to learn the nuts & bolts of C code, again, at least enough to be skeletally functional.

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: Figured Out MPLAB X

    Next I want to learn the nuts & bolts of C code, again, at least enough to be skeletally functional.
    every time I compile with xc8 I get this charming statement

    You have compiled in FREE mode.
    Using Omniscient Code Generation that is available in PRO mode,
    you could have produced up to 60% smaller and 400% faster code.
    See http://www.microchip.com/MPLABXCcompilers for more information.
    its almost as if they want you to feel bad and use arduino's instead ,I won't pay $1000 for whats now just a hobby.
    Warning I'm not a teacher

  3. #3
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: Figured Out MPLAB X

    Agreed. I probably won't spend a $grand for high performance XC8. My reason for wanting to learn the basics of C are several-fold. First, there is a massive wealth of information available to do various things... in C. If I can understand it better, I can port it to PBP. Second, I would like to at least dabble with some of the higher level 16-, 24-, and 32-bit PIC MCUs. Who knows, I may fall in love. Next, my wife & I are Mac users. I started learning Visual Basic (part of the Visual Studio 2015 bundle) to create apps for the PC. As Mac users, my wife is starting to learn X Code for creating Mac apps. It is a variation of C called Objective C. Furthermore, this isn't just a hobby for me, I create electronic gizmos for a living. Having never gone to school for any of it (analog or digital electronics), I have a massive library that I refer to often. I subscribe to about 1/2 dozen electronics magazines, plus receive daily/weekly emails with electronics news & new products. I learned by doing, trial & error. I learned how to learn from books. Working on my New Year's Resolutions, I simply decided it's time for me to learn more of the nuts & bolts of the tools I use every day, acquire some new skills, and refine some comfortable ones.

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: Figured Out MPLAB X

    in C. If I can understand it better, I can port it to PBP
    i have been doing the same thing but pbp is going nowhere .i think its time to go the other way i.e
    converting to C from pbp ,If I can understand it pbp then its easy in C. i have been hanging on so as
    to be able to support my older products but really!.
    conversion is not too onerous and once i get it going in C i can refine away using the obvious advantages
    available . its taken a while to come to terms with the microchip code configurator but if you are
    working with chips with pps then its well worth the effort.

    after ioannis got me interested in apa10c rgb leds i discovered i had 17 more of them and thought why not
    make a animated "star" to christen the top of the christmass tree.

    the idea seemed pretty straight forward a good simple project, but it soon got tedious trying to manipulate
    24bit vars in pbp. data transmission was slow and getting it to function in an isr was problematic
    so i gave up and went asm, which generated another set of issues when the code needs to port between
    pic16/18 devices.
    in C with its abundant variable types combined with structures and unions its just so simple no mental
    gymnastics required and once functional in C its just a simple task using the code configurator [MCC] to
    port it to other chips.
    interestingly a led dataframe [ 24bit start, 17 x 32bit data ,24bit stop ] sent in isr
    time asm pic18f26k22@64m 410uS, C pic18f26k22@64m 608uS, C pic16f18326@32m 667uS.
    turns out C is not too bad at banging out bytes from complex arrays ,even if its not optimised .isr's are way easier to implement.
    this really meant that asm was no longer even a consideration for this application.

    here's the pbp version and the first draft of the C conversion done with a 18f26k22 , although the finished
    project went on a 16f18326.
    Attached Images Attached Images  
    Attached Files Attached Files
    Warning I'm not a teacher

  5. #5
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Figured Out MPLAB X

    If you don’t want to pay $1000 for XC8, then just take XC16 or XC32.
    They are both GCC. GCC is open source, and it isn’t possible to steal open source software.

  6. #6
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Figured Out MPLAB X

    Step 1)
    Familiarise yourself with the concept and lisencing for GNU software:
    https://en.wikipedia.org/wiki/GNU_Ge...Public_License

    Step 2)
    Become rightfully pissed off with Microchip for selling something they made
    absolutely no contribution toward the creation of, and non-compiance with GNU
    for deliberately introducing difficulties compiling source after anyone has done so.
    The former, they have every right to do, although morally reprehensible, and not at
    all in the spirit of open source software. The later is a blatant GNU lisence breach.

    Step 3)
    Download the current version of XC16 for Apple Mac OS, or Windows directly from Microchip.
    The current XC16 is version 1.33. Install MPLAB-X and XC16 normally.

    Step 4)
    Locate in Windows:
    C:\Program Files\Microchip\xc16\v1.33\bin\bin\elf-cc1.exe

    Locate in Mac OS:
    /Applications/microchip/xc16/v1.33/bin/bin/elf-cc1

    Back up this orginal file somewhere.

    Step 5)
    Take what already belongs to you, which is specifically GCC (XC16/32).

    Open the original file from it’s original location with any hex editor program.

    For Windows:
    Find file offset: 0x161E7E, and change the original value 0x85 to 0x84.

    For Mac OS:
    Find file offset: 0x64CCC7, and change the original value 0x85 to 0x84.

    Save the file, and you now have the pro version with every level optimisation.
    Free as it was intended by it’s actual authors, who see none of the $1000 Microchip ask.

  7. #7
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    166


    Did you find this post helpful? Yes | No

    Default Re: Figured Out MPLAB X

    Hi Art,

    Are you saying that by following the five steps outlined in your last post, a person will end up with a full version of XC8 - with all the bells and whistles?

    Cheers
    Barry
    VK2XBP

Similar Threads

  1. Mplab x
    By l_gaminde in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th July 2013, 04:59
  2. Mplab 8.40
    By Andre_Pretorius in forum General
    Replies: 1
    Last Post: - 25th November 2009, 19:42
  3. Errors In MPLAB 8.02
    By HOTLNC in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 4th June 2008, 13:52
  4. using MPLAB 8.0 ?
    By iugmoh in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 21st May 2008, 21:07
  5. Mplab 7.22
    By Patrick in forum Documentation
    Replies: 3
    Last Post: - 1st June 2006, 06:32

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts