Programming PIC cips in ASM

Discussion in 'Programmer's Corner' started by CVMichael, Aug 7, 2007.

  1. CVMichael

    Thread Starter AAC Fanatic!

    Aug 3, 2007
    I'm trying to learn ASM for PIC programming, but I cannot find good sources.
    Most of the things I find is just an explanation on how PIC chip works, but not on the ASM itself...

    Here is a link I found that is pretty good, but still now good enough, because it's just an introduction:

    I need something more extensive, with sample code too
  2. hgmjr

    Retired Moderator

    Jan 28, 2005
    This site looks like a pretty good one to cut your teeth on.

  3. Dave

    Retired Moderator

    Nov 17, 2003
    Without you specifying your m/c of choice, your IDE, or your application I would suggest you look at the User Guides section at

  4. CVMichael

    Thread Starter AAC Fanatic!

    Aug 3, 2007
    Thanks for the link

    I did not specify because I thought that there is a general one that explains ASM programming for any PIC chip.

    The chip I have is PIC16F877, and I program it using a Velleman KIT K8048
    This KIT came with MPASM compiler and it's own programmer software "Progpic2"
  5. spar59

    Well-Known Member

    Aug 4, 2007
    The site you mention looks pretty good at a first glance - it seems to cover most issues.

    There are quite a few text books out there related to PIC programming -unfortunately in common with most technical literature they are not cheap.

    I bought one about 3 years ago "Programming and customizing PICmicro Microcontrollers" by Myke Predko, ISBN 0-07-136172-3.

    I found it invaluable and I have certainly had my money's worth despite its high price of £30+, it obviously does not cover the latest devices but I still refer to it on a regular basis since the principles remain good and when I eventually tire of it I can use it as a door stop since it runs to nearly 1200 pages.

    Bear in mind that much of the PIC range is a few years old and still being manufactured, hence a slightly out-of-date book is still going to be rather useful so it could be time to try a search on e-bay or similar!

    However Microchip's own website has huge amounts of technical info and application examples - and it is all free!

    The PIC being a RISC processor has a very small instruction set and hence the assembler coding is fairly straightforward - the instruction set summary in the datasheet for the appropriate device lists what instructions are available and what they do. I found that getting used to MPLab IDE (which contains MPASM) was the most difficult bit rather than understanding the PIC instructions.

    If you download a few example programs (.asm files) and load them into MPLab IDE it is amazing how much you can learn by examining the code - examples from Microchip which are also available in text format for bedtime reading have lots of comment text to explain what is going on.

    Text books are most valuable in suggesting neater, more efficient ways of doing things that you may have never considered on your own.

    PICs are great fun - it is worth persevering.