Figured Out MPLAB X


Closed Thread
Results 1 to 15 of 15
  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,383


    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,383


    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

  8. #8
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Figured Out MPLAB X

    That example was for XC16 specifically, but I can also help with XC32.
    These are both GCC (General Cross Compiler), and you already have the absolute right to use unrestricted, fully unlocked versions of them for free,
    so long as you agree to the GNU license terms and conditions.

    I can’t say the same of XC8, and can’t help with that either in public or private.
    That said, they are both C, and it wouldn’t be a huge jump to use XC16 with a 16 bit pic.
    Select the right device and you get zero overhead looping.

    Mods/Admin may feel uncomfortable about this kind of thing as it is, and if so, I guess it will be deleted,
    which is ok, but it won’t be because posting it was the wrong thing to do.

    I told Microchip exactly why I cancelled my paid XC16 subscription, and received no reply. Were I ever to hear anything from them I didn’t like,
    I’d run straight to the Free Software Foundation, who have the time, money, resource, and willingness to pound Microchip’s legal team into the mud.

  9. #9
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383


    Did you find this post helpful? Yes | No

    Default Re: Figured Out MPLAB X

    they might be on to you already , if you download ver 1.33 from the archive you now get ver 1.32b
    and the hack does not fit the latest. which is ver 1.34
    Warning I'm not a teacher

  10. #10
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Figured Out MPLAB X

    I’ll have to get that!

    Meanwhile, can you back up a version from 1.32b to 1.32?

    Windows:
    Same file location in Windows directory structure.

    Find file offset 0x1623AE, change 0x85 to 0x84.

    For them to have truly deliberately blocked a weakness, the new version would not have the 0x85 value in a close location (for the new version),
    and/or changing it to 0x84 would have no effect. There’s a completely different method though, they would have had to stop both.

    It’s probably best if certain words are never mentioned in this thread to it isn’t found,
    such as the word that describes what happens to an egg shell when you hit it.

  11. #11
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Figured Out MPLAB X

    You should have a message Richard, but the second method might also break XC8 (untested).
    All integrity would be lost if that was posted in public.
    If you can determine that is also GCC compiler it doesn’t matter, but I seriously doubt it.

    If that no longer works, they have definitely found it, and I guess I can’t update

  12. #12
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795


    Did you find this post helpful? Yes | No

    Default Re: Figured Out MPLAB X

    In their archive (http://www.microchip.com/development...nloads-archive) there are all software versions available since 1.0 for all software packages.

    But I wonder, what are they doing? Is it legal to grab an open source and sell it 1K?

    Ioannis

  13. #13
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Figured Out MPLAB X

    It’s not illegal to include it in your own project and sell it so long as you provide the source (which Microchip do).
    That part is still moral thuggery, but technically there’s nothing wrong with it.

    But you must also provide full source and any modification made to it for your project, and any scripts required for anyone else to compile it themselves,
    and must not take any steps to make it difficult for anyone else to compile.
    This has occurred at least twice in the history of Microchip distributed GCC, and that is illegal.

    Richard is saying if you download the v1.33 package right now, you actually get v1.32b in it.

    The first part Ioannis, you can liken that to you writing some program for free, and giving it away to everyone including source.
    Then I take it, deliberately cripple it (disable some nice features), and charge people a fee to un-cripple it for them, all without your knowledge.
    Unfortunately GNU licensing didn’t really accommodate this situation, and it's legal, but you wouldn’t think much of me for doing it if you found out.
    Last edited by Art; - 28th April 2018 at 10:55.

  14. #14
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795


    Did you find this post helpful? Yes | No

    Default Re: Figured Out MPLAB X

    OK, I see.

    satanic...

    Ioannis

  15. #15
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Figured Out MPLAB X

    Hi
    For help with latest versions:
    github.com/cv007/XC3216

    XC8 is definitely not GCC.

    The Mac OS version is missing form the document on Github, and I have found it myself:
    XC16 v1.34: offset: 0x64D8E7. Change 0x85 to 0x84.

    Cheers

Similar Threads

  1. Mplab x
    By l_gaminde in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th July 2013, 05:59
  2. Mplab 8.40
    By Andre_Pretorius in forum General
    Replies: 1
    Last Post: - 25th November 2009, 20:42
  3. Errors In MPLAB 8.02
    By HOTLNC in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 4th June 2008, 14:52
  4. using MPLAB 8.0 ?
    By iugmoh in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 21st May 2008, 22:07
  5. Mplab 7.22
    By Patrick in forum Documentation
    Replies: 3
    Last Post: - 1st June 2006, 07: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