Author Topic: A good Pic programming book...  (Read 721 times)

0 Members and 1 Guest are viewing this topic.

Offline Fantozzi44Topic starter

  • Newbie
  • Posts: 1
  • Country: gb
A good Pic programming book...
« on: February 18, 2024, 10:24:34 am »
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...
 

Offline jpanhalt

  • Super Contributor
  • ***
  • Posts: 3480
  • Country: us
Re: A good Pic programming book...
« Reply #1 on: February 18, 2024, 10:46:49 am »
Welcome to EEVBlog

Are 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.
 


Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19537
  • Country: gb
  • 0999
Re: A good Pic programming book...
« Reply #3 on: February 18, 2024, 07:34:41 pm »
 

Offline Etesla

  • Regular Contributor
  • *
  • Posts: 149
  • Country: us
Re: A good Pic programming book...
« Reply #4 on: February 18, 2024, 08:38:13 pm »
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.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12865
Re: A good Pic programming book...
« Reply #5 on: February 18, 2024, 09:08:03 pm »
+1 for Gooligum tutorials.  If you want a book, print them off and have them comb bound!  :box:
 

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 6213
  • Country: ro
Re: A good Pic programming book...
« Reply #6 on: February 18, 2024, 09:36:11 pm »
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.

Offline meshtron

  • Regular Contributor
  • *
  • Posts: 132
  • Country: us
Re: A good Pic programming book...
« Reply #7 on: February 18, 2024, 09:48:05 pm »
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.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12865
Re: A good Pic programming book...
« Reply #8 on: February 18, 2024, 10:04:03 pm »
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).
 

Offline jpanhalt

  • Super Contributor
  • ***
  • Posts: 3480
  • Country: us
Re: A good Pic programming book...
« Reply #9 on: February 18, 2024, 10:27:30 pm »
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).

However, 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.
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5914
  • Country: es
Re: A good Pic programming book...
« Reply #10 on: February 18, 2024, 10:38:46 pm »
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...
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12865
Re: A good Pic programming book...
« Reply #11 on: February 18, 2024, 10:55:31 pm »
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 3

OTOH 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 .
« Last Edit: February 18, 2024, 11:05:52 pm by Ian.M »
 

Offline dobsonr741

  • Frequent Contributor
  • **
  • Posts: 674
  • Country: us
Re: A good Pic programming book...
« Reply #12 on: February 19, 2024, 03:51:15 am »
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.
 

Offline jpanhalt

  • Super Contributor
  • ***
  • Posts: 3480
  • Country: us
Re: A good Pic programming book...
« Reply #13 on: February 19, 2024, 10:11:29 am »
OTOH 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 .

I 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.


« Last Edit: February 19, 2024, 10:15:19 am by jpanhalt »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf