• AVR Freaks

Hot!Firmware for PIC18f4520 microcontroller

Author
Alans MagicEye
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2019/11/13 01:12:49
  • Location: 0
  • Status: offline
2019/11/15 03:46:08 (permalink)
0

Firmware for PIC18f4520 microcontroller

I am very much a newbie to PIC microcontrollers and MPLAB X IDE, so apologies for the following basic question.....

I am attempting to use a PIC PIC18f4520 chip to run a Turbomolecular pump via a TAS 5261 amplifier. Here is a link to the webpage for the setup:

http://www.wimmeralogic.c...xen-a.../MDP-5011.html

My problem comes with the firmware, the author states the following:

"The firmware for the PIC18f4520 microcontroller is written in PIC assembler
Pic18pwm Assembler Source ,
Register Definitions ,
General Macros ,
Handshake IO via programming pins , and compiled using open source tools.
The definitions for the register names and locations are in a copyright macro file published by Microchip. A copy of the file is Microchip Register Definitions , which I renamed pic4520.a18 for consistency"

I have worked with C++ before using Arduino, and I'm familiar with header and library files but I'm a bit daunted about compiling the firmware for this, my main difficulty is knowing where to put the various files listed into MPLAB X IDE. I have studied some YouTube videos but they are all very basic "Blink" tutorials and I'm struggling to see where the whole thing hangs together.

Can anyone tell me where each file should reside within the MPLAB X IDE and if the compiler will compline the code from the files mentioned without further modifications.

Many thanks

Alan
#1

8 Replies Related Threads

    katela
    Super Member
    • Total Posts : 1458
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: offline
    Re: Firmware for PIC18f4520 microcontroller 2019/11/16 04:44:48 (permalink)
    0
    The link you have posted does not exist.

    Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
    YouTube Tutorials: https://www.youtube.com/StudentCompanionSA
    #2
    Ian.M
    Super Member
    • Total Posts : 13268
    • Reward points : 0
    • Joined: 2009/07/23 07:02:40
    • Location: UK
    • Status: offline
    Re: Firmware for PIC18f4520 microcontroller 2019/11/16 05:57:27 (permalink)
    +2 (2)
    As usual this forum has FUBARed a pasted link.  Fortunately there was enough of it for Google to find it:
    https://www.wimmeralogic.com/adixen-alcatel/MDP-5011.html
     
    The author doesn't state what toolchain he's using.  All we know is it apparently uses the extension .a18 for assembler source and include files.
     
    Some hints about the author's preferred open source toolchain(s) for PIC18 can be found at:
    https://www.wimmeralogic.com/PIC18F45K20/PIC18F45k20.html
    post edited by Ian.M - 2019/11/16 06:14:20

    --
    NEW USERS: Posting images, links and code - workaround for restrictions.
    I also support http://picforum.ric323.com because this forum is sometimes too broken to use!
    #3
    Mysil
    Super Member
    • Total Posts : 3476
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: online
    Re: Firmware for PIC18f4520 microcontroller 2019/11/16 07:44:13 (permalink)
    +3 (3)
    Even a very basic LED blinking excercise, has it's value,
    in getting hardware, development environment, compiler, programmer, debugger,
    and your head to work together.
     
    But watching it on video have limited value, you have to do it yourself.
    It isn't about the blinking, it is about the tools and procedures to getting it to happen.
     
    Also, getting it to blink with a frequency that you decide, from scratch,
    is an exercise that may involve configuration and and setup of oscllators, 
    setup of timers, and possibly also interrupt handling.
    All of these experiences may be useful if you are going to set up timekeeping,
    or communication like UART asynchronous serial, or other protocols.
     
    Taking over, or getting familiar with a big code written in assembly by someone else,
    possibly using tools that you maybe is not familiar with,
    may be a challenge.
     
    While the file containing hardware definitions  are copyrighted by Microchip,
    it is with the licence that you may use it to make firmware for any microprocessor produced and sold by Microchip,
    or any of the companies they have bought.
     
    About the analysis of PIC18F45K20 written by the author of the program you are trying to use:
    There is a successor device, PIC18F45K22  that have removed many of the restrictions pointed out in the review,
    while generally working the same way.  It may work with any power supply voltage between 2.3 V and 5.5 Volt.
    If you are going to make battery powered  equipment, there is LF variant that may be used with even lower supply voltage.
     
    The author make a point of large steps in the relation between clocking frequency and nessesary power voltage.
    I do think that those steps are not actually real.
    It may be more about writing specifications, and how to test that those specifications are actually fulfilled in production testing.
     
    About the original question: where to place the files, the   ProjectName.X     directory that is created by MPLAB X
    is just as good as anywhere else.
    But it will not solve your main problem, what to do with the files.
     
    Maybe the most meaningful, may be to find a tutorial demonstrating use of MPLAB X for assembly language  using MPASM assembler, and study that first.
     
    In MPLAB X,   Click on the big Yellow [+]    up near the left end of the toolbar. 
    It will open a wizard,   select the project type:  'Microchip Embedded'   and  'Standalone Project'  and click Next.
    select the device type you want to use, PIC18F4520,  or  PIC18F45K20, or whatever device you have available.
    Select what Programming / Debugging tool to use:   PICkit 3  or  PICkit 2,  or whatever you have access to,
    that have 2 green dots, or 2 yellow dots.  If you have no Programmer, select Simulator.
    In Select Compiler,   Click 'mpasm'
    Specify a Project name of your choise, and browse for a directory where you want the project to be stored.
    Beware,   No space characters or other special characters in directory path or file names, underscore may be used. 
    then finish the wizard.
     
    You may make a new assembly source file by use of the white icon with green + in the upper left corner.
    select 'Assembler'   and select 'AssemblyFile.asm' 
     
    Then fill it with something suitable.
     
    Regards,
        Mysil
     
    post edited by Mysil - 2019/11/17 01:16:26
    #4
    dan1138
    Super Member
    • Total Posts : 3286
    • Reward points : 0
    • Joined: 2007/02/21 23:04:16
    • Location: 0
    • Status: offline
    Re: Firmware for PIC18f4520 microcontroller 2019/11/16 13:28:17 (permalink)
    +1 (1)
    Alans MagicEye
    I am very much a newbie to PIC microcontrollers and MPLAB X IDE, so apologies for the following basic question.....

    Can anyone tell me where each file should reside within the MPLAB X IDE and if the compiler will compile the code from the files mentioned without further modifications.

    The short answer is that the code you have found does not build using the Microchip tools.

    It appears to build using the gputils, but this is only the first of your problems.

    Your projects seems to be about driving a high vacuum turbo pump.
     
    After reading about these things, seems they could be a bit tricky to do right. The way these things work suggest that when they fail they do it in a spectacularly destructive way.

    The documentation on link you site seems like something scratched on the back of a bubblegum wrapper with a rusty pin.

    The source code is just awful. Incomprehensible macros, stupid symbol names and NO USEFUL F---ING COMMENTS!

    Perhaps this is the best you can find but it is really a bad example.
     
    As a first project with a PIC18F controller you have almost no chance at success. But give it a try, you can learn a lot.
    #5
    Mysil
    Super Member
    • Total Posts : 3476
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: online
    Re: Firmware for PIC18f4520 microcontroller 2019/11/17 01:40:33 (permalink)
    0
    Hi,
    See added description in message #4
    Here is a package attached,
    if forum server allow.
     
     
     
    #6
    Alans MagicEye
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2019/11/13 01:12:49
    • Location: 0
    • Status: offline
    Re: Firmware for PIC18f4520 microcontroller 2019/11/17 01:41:26 (permalink)
    0
    Thanks everyone for your responses to this and for taking the time to study the link, it is much appreciated. It confirms my suspicions that the code that I have found will be of little use.

    Going forward, I do have the manual for the pump and feel that it may be better to try and write some simpler code as I don't think that the author of the code to which I linked just used the PIC to run the pump but also had vacuum transducers linked in.

    I would guess that making a flow chart of the sequence to start and run the pump and to detect an overload would be a sensible starting point, and then building the code from this. It is indeed correct that these pumps can fail in a spectacular manner, thank you for the warning.

    As a fallback I do have the schematic for the original analogue controller and I am okay at building and fault finding fairly complex electronics projects so that is another option, I just thought it would be interesting to try something new!

    Thanks again

    Alan
    #7
    Alans MagicEye
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2019/11/13 01:12:49
    • Location: 0
    • Status: offline
    Re: Firmware for PIC18f4520 microcontroller 2019/11/17 01:43:28 (permalink)
    0
    Thanks very much Mysil
    #8
    Alans MagicEye
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2019/11/13 01:12:49
    • Location: 0
    • Status: offline
    Re: Firmware for PIC18f4520 microcontroller 2019/11/26 10:57:26 (permalink)
    0
    Hello again

    I have now found a suitable circuit using a 555 timer, a logic gate and FET's, so I'm shelving the PIC idea for now but thanks for your contributions.

    Alan
    #9
    Jump to:
    © 2019 APG vNext Commercial Version 4.5