Author Topic: Need info on taking and learning PIC Programming  (Read 3686 times)

0 Members and 1 Guest are viewing this topic.

Offline Sigma957Topic starter

  • Contributor
  • Posts: 19
  • Country: ca
Need info on taking and learning PIC Programming
« on: March 29, 2021, 07:39:03 pm »
Hello Guys & Gals,

I am new to forum and have some background in electronics.
I have had several programmers TL866A, TL866cs and now the TL866II programmer. (not fakes sold on some sites)
I have never used them yet as I have no knowledge in programming.
I want to learn to program pic microcontrollers for fun and am looking for some online courses.

Do any of you know of any good online courses for learning coding for pic microcontrollers?
I have 1 course on udemy but still looking for others that could have more of a step by step course and explanations.

Also would code be usable using any model pic programmer as I see many different chip programmers on the market?

I am stuck at home 24/7 so want to finally start doing some projects.


Thanks in advance
Sigma
 

Offline Algoma

  • Frequent Contributor
  • **
  • Posts: 291
  • Country: ca
Re: Need info on taking and learning PIC Programming
« Reply #1 on: March 29, 2021, 08:01:32 pm »
PIC programming is done at quite low level control of the device itself,  Assembly or C .. Powerful, but a fair bit to learn all at once.

For learning and fun, Arduino is an excellent entry point, Programming at a high level language, with wide support, documentation and videos. All you need is a USB port for programming. Its the same exercise and all skills will transfer to PIC when you're more comfortable with debugging something like PIC the hard way..
« Last Edit: March 29, 2021, 08:03:11 pm by Algoma »
 
The following users thanked this post: 4cx10000

Offline Sigma957Topic starter

  • Contributor
  • Posts: 19
  • Country: ca
Re: Need info on taking and learning PIC Programming
« Reply #2 on: March 29, 2021, 08:18:35 pm »
Hello,

Thanks for the fast reply to my post.

I did use some html a few years back so I am normally a quick learner.
I will do research on C and assembly and see if I can find any good courses for them.

I have tons of stuff from Arduino's, Pic's, Raspberry Pi's and near everything else (caps, resistors, diodes and the list goes on.)

So I am all set once I find some good courses.

Thanks
Sigma
 

Offline Jan Audio

  • Frequent Contributor
  • **
  • Posts: 820
  • Country: nl
Re: Need info on taking and learning PIC Programming
« Reply #3 on: March 30, 2021, 01:50:02 pm »
Start with 8 bit first, they are very simple.
For C coding start with DOS in your computer.
What do you want to make first ?, 8 bit chips cant do much processing.
 

Offline Sigma957Topic starter

  • Contributor
  • Posts: 19
  • Country: ca
Re: Need info on taking and learning PIC Programming
« Reply #4 on: March 30, 2021, 02:49:39 pm »
Hello Jan,

Thanks for fast reply to my post, I really appreciate it.

What I want to make first is a door, LED and switch sensor.
What I mean is I want an led light to turn on if a door is opened and then stay on until door is closed and a button is pushed.
So even if door is closed led will remain on until the button is pushed.

I have both NO and NC magnetic contacts ready for my test as well as various led's in many voltages.
I know there are kits I can buy with remotes and relays  as I have some, but really want to do it myself without using prebuilt.

Thanks
Sigma
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Need info on taking and learning PIC Programming
« Reply #5 on: March 30, 2021, 03:06:26 pm »
The mid-range 16F PICs can be programmed with C but it is not often satisfactory because the CPU has no sizeable stack for passing parameters to functions.  It's doable but the output code from the compiler is truly ugly and space consuming.

Given that, assembly language is often used and can be quite elegant when written well.

Here's a snapshot of the difference between C and assembly language.  Good news and bad, the C code is easier to understand, the assembly code is shorter.

https://www.teachmemicro.com/pic-assembly-language-intro/

I have no idea what assembler is being used today since I haven't done anything with PICS in about 20 years but this seems to be the most current:

https://ww1.microchip.com/downloads/en/DeviceDoc/MPLAB%20XC8%20PIC%20Assembler%20User%27s%20Guide%2050002974A.pdf

The most common chip in projects on the Internet seems to be the 16F84A and this thing is truly obsolete.  It was obsolete 20 years ago.  I kind of like the 40 pin 16F877A or the 18 pin 16F628A.

Here's an inexpensive development board, there are many others:

https://www.aliexpress.com/item/1859126962.html?spm=a2g0o.search0302.0.0.52ac1598FKNufS&algo_pvid=dfb243d0-09a0-47c8-97e6-71303e26b3b1

Most hobbyists have moved away from PICs to AVRs (notably Arduino but I like the ATmega128) and on to ARM.  The PICs are still sold by the millions but they are used in niche applications.  Today the game is played with ARM.

The bigger game is played with Raspberry Pi
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Need info on taking and learning PIC Programming
« Reply #6 on: March 30, 2021, 03:10:21 pm »
Even Amazon has PIC development boards.  There are several others but this would be one I would consider

https://www.amazon.com/Microchip-PIC16F877A-Microcontroller-Development-Interface/dp/B07WTB68FK
 

Offline Jan Audio

  • Frequent Contributor
  • **
  • Posts: 820
  • Country: nl
Re: Need info on taking and learning PIC Programming
« Reply #7 on: March 30, 2021, 03:18:10 pm »
What I want to make first is a door, LED and switch sensor.
What I mean is I want an led light to turn on if a door is opened and then stay on until door is closed and a button is pushed.
So even if door is closed led will remain on until the button is pushed.

This is to simple to need any MCU.
You dont need to learn any programming for this.
Ofcourse you like to use this as a starting point for learning.
Just make it and forget about learning programming, just try to get a default project for your target chip,
add 2 lines of code for this project.
 
The following users thanked this post: Sigma957

Offline Sigma957Topic starter

  • Contributor
  • Posts: 19
  • Country: ca
Re: Need info on taking and learning PIC Programming
« Reply #8 on: March 30, 2021, 03:28:41 pm »
Hello,

Thanks for reply.

I know it is simple and was just using as test.
I have same thing done using only relays.
Its only to learn and then see what I can change.

I dont need it as door has alarm on it and reports to my panel but I thought basic.

But later I want to tie into a/c to turn Garage light off and on and put a IR sensor that if beam is crossed will also turn on garage light as well as led light.

Thanks
Gren
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Need info on taking and learning PIC Programming
« Reply #9 on: March 30, 2021, 03:55:23 pm »
Above I posted some info on PICs and development tools.  The thing is, I wouldn't wish PIC 16F programming on my least favorite cousin.  When an 18 pin or even 6 pin simple device will do the job and price is important (you're making 10,000 widgets) then, sure, PIC is a possibility.

For the absolute beginner, I would recommend Arduino every time.  Specifically, I would recommend this kit as I know for a fact that the tutorial is excellent.  There is a similar kit for the Raspberry Pi.

https://www.amazon.com/Freenove-Ultimate-Compatible-Solderless-Breadboard/dp/B08B4D5MV5

I don't see a future in mid-range PICs for the average hobbyist.  Besides, it is almost always programmed in C.  Everything that can be done with an Arduino has already been done and the project is on the Internet.

If you really want to learn PIC assembly language programming, rock on.  It isn't a place I want to go back to.

If you want to move to state of the art, the Teensy 4.1 is an extremely powerful device:

https://www.pjrc.com/store/teensy41.html
 
The following users thanked this post: Sigma957

Offline Jan Audio

  • Frequent Contributor
  • **
  • Posts: 820
  • Country: nl
Re: Need info on taking and learning PIC Programming
« Reply #10 on: March 30, 2021, 03:59:13 pm »
Just look what you can do with a PIC12F1572, it is incredible, and only DIP8, fun.
 
The following users thanked this post: Sigma957

Offline Martian Tech

  • Regular Contributor
  • *
  • Posts: 90
  • Country: us
Re: Need info on taking and learning PIC Programming
« Reply #11 on: March 30, 2021, 04:00:08 pm »
Rather than looking for courses, you might just want to study some existing PIC-based designs.  Here are a couple that might prove educational:
https://hackaday.io/project/25771-jobeaux-processor
https://hackaday.io/project/25203-toy-basic-computer
 
The following users thanked this post: Sigma957

Offline Sigma957Topic starter

  • Contributor
  • Posts: 19
  • Country: ca
Re: Need info on taking and learning PIC Programming
« Reply #12 on: March 30, 2021, 05:19:26 pm »
Hello,

Thanks for reply to my post.

I have Raspberry PI's , Arduino and lots more.
I went on a spending spree over a year ago and went wild with items.
Then my health took a turn for worse and it has all sat shelved.

Now that I am feeling better I want to finally start doing something to keep my mind active.
Since I worked fixing planes many years ago I wanted stuff I enjoyed which is electronics.
But only for fun and tinkering.
Once I get started I want to make some advanced LED projects and work with LCD displays.

I have always learned by hands on more than in books but now I really want to learn.
Spending 24/7 locked/stuck at home is wearing me down so I want to do something that interest me.

Thanks for suggestions and help
Gren
 

Offline Sigma957Topic starter

  • Contributor
  • Posts: 19
  • Country: ca
Re: Need info on taking and learning PIC Programming
« Reply #13 on: March 30, 2021, 05:21:57 pm »
Hello,

Thanks for fast reply I will take a look at the pic and add it to my supply.

What ever will help me more is what I will do and will take all suggestions to get me to learn.

Thanks
Gren
 

Offline Sigma957Topic starter

  • Contributor
  • Posts: 19
  • Country: ca
Re: Need info on taking and learning PIC Programming
« Reply #14 on: March 30, 2021, 05:26:01 pm »
Rather than looking for courses, you might just want to study some existing PIC-based designs.  Here are a couple that might prove educational:
https://hackaday.io/project/25771-jobeaux-processor
https://hackaday.io/project/25203-toy-basic-computer

Hello,

Thanks for the links as they look great.
Never heard of that site before but looks easy to follow from what I see.

I really appreciate the help.
Gren
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2550
  • Country: us
Re: Need info on taking and learning PIC Programming
« Reply #15 on: March 30, 2021, 05:52:25 pm »
I've done a lot with the 8-bit PICs.  With the 8-bit PICs, you learn low level hardware interfacing.
Hence getting a very unique understanding hidden by other products such as an Arduino.
There are MANY things a simple 8-bit MCU can do. 
You don't always need the latest 32-bit fancy processor on the block.

Although I haven't used the pic16F1503, it looks like it has a lot to offer
in a small 14 pin DIP package for only $1:
   - Internal 16MHz oscillator
   - 10 bit DACs
   - 3 timers
   - PWM
   - serial/SPI/I2C
   - Complementary Waveform Generator (CWG)
   - Configurable Logic Cell (CLC) modules

Sit down with the datasheet and the C compiler.
These days, I see no need for assembly language unless you have VERY special requirements.
I started programming back in the days of punch-cards and don't see the need for those headaches.
 
The following users thanked this post: Sigma957

Offline Sigma957Topic starter

  • Contributor
  • Posts: 19
  • Country: ca
Re: Need info on taking and learning PIC Programming
« Reply #16 on: March 30, 2021, 06:00:57 pm »
I've done a lot with the 8-bit PICs.  With the 8-bit PICs, you learn low level hardware interfacing.
Hence getting a very unique understanding hidden by other products such as an Arduino.
There are MANY things a simple 8-bit MCU can do. 
You don't always need the latest 32-bit fancy processor on the block.

Although I haven't used the pic16F1503, it looks like it has a lot to offer
in a small 14 pin DIP package for only $1:
   - Internal 16MHz oscillator
   - 10 bit DACs
   - 3 timers
   - PWM
   - serial/SPI/I2C
   - Complementary Waveform Generator (CWG)
   - Configurable Logic Cell (CLC) modules

Sit down with the datasheet and the C compiler.
These days, I see no need for assembly language unless you have VERY special requirements.
I started programming back in the days of punch-cards and don't see the need for those headaches.

Hello,
Thanks for reply. to my posts.

I will start with C as I see it is mostly used now and will learn assembly once I am done with C or if I need it sooner.

Thanks for your help.
Gren
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: Need info on taking and learning PIC Programming
« Reply #17 on: March 30, 2021, 06:21:02 pm »
Be aware that Microchip dropped MPASM (assembler) support for all 8 bit PICs after MPLAB X v5.35.  The assembler bundled with XC8 is very different and most of the tutorials you'll find on the WWW expect you to be using MPASM.  Fortunately there is no problem having different versions of MPLAB installed on the same PC.

Most modern PICs are debug capable.  Some of Microchip's entry level demo boards have integrated debuggers or you could get a PICkit 3 or 4. (PICkit 3 clone if you are on a really tight budget).  Being able to set breakpoints and step through code on the actual chip, and examine and modify variables, and registers etc. *LIVE* is a game-changer if you are coming from the bad old days of the build-burn-crash MCU development cycle.

The PIC16F877A is an antique.  Its marginal whether or not its even worth studying it except for the fact it was one of the founding members of Microchip's 'classic' midrange (14 bit core) FLASH memory PICs and it was one of their earliest debug capable PICs.  IMHO if you are tempted by the board Rstofer suggested, you should also get a couple of PIC18F46K22 to use in place of the '877A'.  The PIC18 family are much nicer chips, and the PIC18F46K22 has much more memory, far better peripherals yet is nearly 100% pin compatible with the '877A, and unlike many newer PICs can run over the full supply voltage range from 1.8V to 5.5V.
« Last Edit: March 30, 2021, 08:37:03 pm by Ian.M »
 
The following users thanked this post: Sigma957

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Need info on taking and learning PIC Programming
« Reply #18 on: March 30, 2021, 08:19:54 pm »
I suggested the PIC16F877A simply because I have some experience with it dating back to the Junun Minisumo Mark III robot.  I believe it actually used the PIC16F877.  This was pretty interesting stuff, 20 years ago.

At the end of the day, I don't recommend ANY of the mid-range PICs.  The hardware is too limiting, C compilers have to generate a lot of extra code for paging and banking and the lack of a stack pointer is really limiting.

Personally, I would skip the mid-range PIC experience entirely.  But it's hard to argue when the proposed project is so simple.  The thing is, STM32F devices are all over the place and they include a programmer/debugger.  I'm more of a printf() kind of programmer but having a hardware debugger has to be useful to newcomers.

The most fun micro I play with is the PSOC 6.  At the moment I can't convince myself that the 4.4 version of the software works with any of the demos but 4.2 does.  I really like the PSOC 6 101 video series.

If I wanted something simple, I would use the DIP version of the Arduino, get the code working and then put the pre-programmed chip in my project board.  The ATmega328P is a pretty decent chip and requires little around the outside to get it to work.

I really can't get into the idea of backing up to the mid-range PICs.  In comparison to something like Arduino, they are truly grim.

The ATmega328P chip, as used in the Arduino, is $2.52 at DigiKey but I would start with the kit I linked above.  Learn some stuff and then deal with the proposed project.

https://www.digikey.com/en/products/detail/microchip-technology/ATMEGA328P-PU/1914589

The 16F877A (40 pin DIP) is a little over $6 at DigiKey and the 16F84A is also around $6.

For developing on the DIP chip, I would use the genuine Ardino Uno board:

https://www.amazon.com/Arduino-A000066-ARDUINO-UNO-R3/dp/B008GRTSV6

 
The following users thanked this post: Ian.M, Sigma957

Online BlackICE

  • Regular Contributor
  • *
  • Posts: 222
  • Country: us
Re: Need info on taking and learning PIC Programming
« Reply #19 on: March 30, 2021, 09:34:06 pm »
Unless you are designing something that is expect to sell more than 10,000 going with another micro controller is a lot easier. I've played with  PIC18 and have a ICD 3 and PICDEM 2 PLUS DEMO BOARD I can sell you if you are really interested. I have decades of experience with assembly and C programmer so neither is problem. But when I just want to get a one off project done my go to processors are now Atmega 328 for low power or ESP32 when I want wifi or multi-threading. Just a lot of stuff already made to so I have less wiring to do.

PICs have a cost savings but I'm never going to see it because I'm not producing 1000s.
« Last Edit: March 30, 2021, 09:54:57 pm by BlackICE »
 
The following users thanked this post: Sigma957

Offline Sigma957Topic starter

  • Contributor
  • Posts: 19
  • Country: ca
Re: Need info on taking and learning PIC Programming
« Reply #20 on: March 31, 2021, 12:42:59 am »
Unless you are designing something that is expect to sell more than 10,000 going with another micro controller is a lot easier. I've played with  PIC18 and have a ICD 3 and PICDEM 2 PLUS DEMO BOARD I can sell you if you are really interested. I have decades of experience with assembly and C programmer so neither is problem. But when I just want to get a one off project done my go to processors are now Atmega 328 for low power or ESP32 when I want wifi or multi-threading. Just a lot of stuff already made to so I have less wiring to do.

PICs have a cost savings but I'm never going to see it because I'm not producing 1000s.


Hello,

All I want to do is to learn and for only home interests not for selling or business.
And like I said I have 3 different versions of programmers all authentic TL866 various with software.
I want to start small and learn and work up to complex projects.

Thanks for all the info and help
Gren
 

Offline MikeK

  • Super Contributor
  • ***
  • Posts: 1314
  • Country: us
Re: Need info on taking and learning PIC Programming
« Reply #21 on: March 31, 2021, 12:56:10 am »
Nigel something-or-other has some tutorials for the older PIC's:

http://www.winpicprog.co.uk/pic_tutorial.htm

And Gooligum had free tutorials for older PIC's, that I think they now charge for.

There are still older, used books available, such as "PIC in Practice" by DW Smith.

Learning an older PIC isn't a total waste of time, but things like context-saving are done for you in modern PIC's.  And modern PIC's have features that won't be learned when using an older PIC.

Oh, and there's nothing wrong with modern mid-range PIC's...plenty of engineers and hobbyists use them.
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2550
  • Country: us
Re: Need info on taking and learning PIC Programming
« Reply #22 on: March 31, 2021, 02:00:49 am »
Another PIC I can recommend is the pic18f2620 for those large projects.
  - Large program space (64K)
  - Internal 32MHz clock
  - 28 pin DIP or SOIC

One thing nice with the newer PICs is their internal clock.
You can get reasonable high master clocks without the need of an external crystal.
Nice for breadboard work.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Need info on taking and learning PIC Programming
« Reply #23 on: March 31, 2021, 02:27:42 am »
I have had several programmers TL866A, TL866cs and now the TL866II programmer. (not fakes sold on some sites)
I have never used them yet as I have no knowledge in programming.

If you want to use those programmers, you need to select a PIC that can use them.  It doesn't seem like the 16F series is covered but I didn't spend much time looking.  Some of the 18F chips are supported.
 

Offline MikeK

  • Super Contributor
  • ***
  • Posts: 1314
  • Country: us
Re: Need info on taking and learning PIC Programming
« Reply #24 on: March 31, 2021, 02:36:43 am »
It's a shame the PICKit2 sells for stupid prices on eBay.  I still use mine.  I reprogrammed it so that it handles modern PIC's.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf