A good Pic programming book... - Page 1
Forum section: electronics / beginners

author: Fantozzi44
author_rank: Newbie
timestamp: February 18, 2024, 10:24:34 am
content: Hi. I'am brand new here as I have just registered. Can anybody suggest me a good book for learning how to program pic microcontrollers? I really don't want to base my choice just by judging the book by its cover or just a by few pages available in a preview. There are some PDF version which seemed to be pretty good, however I much more prefer a book. I'm not new to electronics, however regarding the PIC's, I have to start totally from scratch (literally). thx...

author: jpanhalt
author_rank: Super Contributor
timestamp: February 18, 2024, 10:46:49 am
content: Welcome to EEVBlogAre you intending to program in C or Assembly? Are you totally new to programming?Years ago when I had no experience with micros (MCUs), my programming experience was with TI Basic (TRS80) and IBM Basic, and that experience was from 20 years prior to that. I had a simple project and didn't want to waste time learning a whole new language, so started with Assembly and have stayed with it. Assembly is quite specific for the MCU. Even within a class of PICs, say 8-bit, the instruction set is different for 12F5xx/16F515, 12F6xx/16Fxxx, 12F1xxx/16F1xxx,and 18F devices. (It depends on "core" size, 12-bit, 14-bit, 16-bit.) C supposedly takes care of those differences for you.

author: DavidAlfa
author_rank: Super Contributor
timestamp: February 18, 2024, 07:15:56 pm
content: https://github.com/free-educa/books/blob/main/books/John%20Lovine-PIC%20Microcontroller%20Project%20Book-McGraw-Hill%20(2000).pdfhttps://class.ece.uw.edu/475/peckol/doc/8976457-Programming-8Bit-PIC-Micro-Controllers-in-C.pdfhttps://www.embedic.com/uploads/files/20201008/Microcontrollers%20-%20Fundamentals%20and%20Applications%20with%20PIC.pdfhttps://dsp-book.narod.ru/QPIC.pdf

author: Zero999
author_rank: Super Contributor
timestamp: February 18, 2024, 07:34:41 pm
content: https://github.com/gooligumelec/PIC-tutorials

author: Etesla
author_rank: Regular Contributor
timestamp: February 18, 2024, 08:38:13 pm
content: Best way to learn something is by doing it. I recommend finding a youtube series you like for programming a specific 8 bit PIC microcontroller. Buy like 10 of that microcontroller off digikey, buy a pickit off amazon (the ripoff ones never let me down), download mplabx, pull up the datasheet, start messing around.

author: Ian.M
author_rank: Super Contributor
timestamp: February 18, 2024, 09:08:03 pm
content: +1 for Gooligum tutorials. If you want a book, print them off and have them comb bound!

author: RoGeorge
author_rank: Super Contributor
timestamp: February 18, 2024, 09:36:11 pm
content: When I wanted to step into microcontrollers, I've tried starting with PIC (8bit, yet the program word was not 8, but slightly longer, 11 or 14 bits, don't recall). It was tedious and cumbersome. Very frustrating experience. Manual memory pages switch, almost no RAM so no C programming - anything more elaborated than blinking a LED has to be written in assembler - peripherals hardware were not standard across various model of the same 8bit family, etc.After a couple of weeks of absolute frustrations, I've switched to 8bit AVR and never looked back. By AVR I mean the ATmega family, later to be used in the now ubiquitous Arduino.My advice is to start either with AVR, or with PIC32. PIC 8 bits is not good as a first microcontroller.

author: meshtron
author_rank: Regular Contributor
timestamp: February 18, 2024, 09:48:05 pm
content: Similar here, but stepped straight in to the ATTiny AVR series and they've been great to learn on. I'm working in C but started in C++ and there are loads and loads of places to get ideas/instruction/support.

author: Ian.M
author_rank: Super Contributor
timestamp: February 18, 2024, 10:04:03 pm
content: The Baseline and Midrange 8 bit PIC families are foul architectures to code for in assembler. However if you switch to C (Microchip's XC8 in Free mode) after learning the instruction set, but before you exceed the limits of one bank of ram and one page of program code, you will have learnt enough to be aware of the processor's capabilities so you aren't surprised when seemingly simple C produces bloated binary code, or executes very slowly, and have enough knowledge to be able to grok the compiler's assembly listing when you need to optimise time-critical stuff. You'd be surprised how much you can actually do with XC8 on a PIC10F200 (the most minimal baseline PIC!), even though its only got 16 bytes RAM and 256 instruction words of Flash.The biggest downside of learning on PICs is Microchip's MPLAB X IDE, which is a buggy resource hog based on the NetBeans IDE platform. The other fly in the ointment, which you need to know if comparing price/performance ratios is that unlike AVRs which have many single cycle instructions, most 8 bit PIC instructions take four clock cycles, so a 20Mhz AVR is likely to be faster than *any* 8 bit PIC on the market (as the top end ones max out at 64MHz, and most of the rest at 20MHz or 32MHz).

author: jpanhalt
author_rank: Super Contributor
timestamp: February 18, 2024, 10:27:30 pm
content: Quote from: Ian.M on February 18, 2024, 10:04:03 pmHowever, 8.92 MPLab and earlier versions are still available on its site. 8.92 is not without its issues too, but for Assembly, it works fine. Of course, it does not include the latest chips with NCO , etc., but it's a start.

author: DavidAlfa
author_rank: Super Contributor
timestamp: February 18, 2024, 10:38:46 pm
content: I would not start with modern chips, too many quirks.The old 16f876, 877 are great starters. Get any cheap Pic board at AliExpress and start with the basics!Status, Option, tris, port registers... Blink some leds, learn to use timers...

author: Ian.M
author_rank: Super Contributor
timestamp: February 18, 2024, 10:55:31 pm
content: I *STRONGLY* prefer MPLAB 8.92 for any older PIC! The downside of MPLAB 8 is no XC8 (C compiler) V2.x support. You have to go back to a V1.x release and for the later ones faff around with MPLABXC8.dll to register the toolsuite.Also, there's no programmer/debugger support for anything newer than PICkit 3/ICD 3OTOH MPLAB X v5.40 dropped Microchip MPASM assembler (used for all the datasheet examples) and 'replaced' it with XC8's PIC-AS (based on Hitech's ASPIC) which is largely incompatible other than the instruction set mnemonics, so its not much fun learning PIC assembler on MPLAB X even if you can stand its bloat and complexity .

author: dobsonr741
author_rank: Frequent Contributor
timestamp: February 19, 2024, 03:51:15 am
content: Get an Arduino-compatible board and save yourself a lot of headache and time. You'll be happier. The PIC architecture is outdated compared to the simplicity and fluidity of the C code provided by the Arduino environment. It's no longer considered cool to study datasheets and delve into dozens of registers to handcraft bit manipulation in C just to blink an LED.

author: jpanhalt
author_rank: Super Contributor
timestamp: February 19, 2024, 10:11:29 am
content: Quote from: Ian.M on February 18, 2024, 10:55:31 pmI have somewhat the same comment about Gooligum's tutorials. They are quite good, except relocatable code in introduced quite early. There is nothing wrong with absolute Assembly. It is certainly easier (IMHO) when starting out.

author: armandopoolheco19
author_rank: Newbie
timestamp: July 24, 2024, 07:15:50 am
content: Quote from: Fantozzi44 on February 18, 2024, 10:24:34 amA bit cliché, but my grandfather once gave me a piece of advice that really helped me: The most important thing is to start small and gradually move on to more complex projects. Good luck on your journey to learning PIC microcontrollers! Never give up. Even when it seems like you're not making progress, know that you're doing great and just need to keep working a bit more to see the results.