Need info on taking and learning PIC Programming - Page 1
Forum section: electronics / beginners

author: Sigma957
author_rank: Contributor
timestamp: March 29, 2021, 07:39:03 pm
content: 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 advanceSigma

author: Algoma
author_rank: Frequent Contributor
timestamp: March 29, 2021, 08:01:32 pm
content: 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..

author: Sigma957
author_rank: Contributor
timestamp: March 29, 2021, 08:18:35 pm
content: 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.ThanksSigma

author: Jan Audio
author_rank: Frequent Contributor
timestamp: March 30, 2021, 01:50:02 pm
content: 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.

author: Sigma957
author_rank: Contributor
timestamp: March 30, 2021, 02:49:39 pm
content: 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.ThanksSigma

author: rstofer
author_rank: Super Contributor
timestamp: March 30, 2021, 03:06:26 pm
content: 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.pdfThe 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-71303e26b3b1Most 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

author: rstofer
author_rank: Super Contributor
timestamp: March 30, 2021, 03:10:21 pm
content: Even Amazon has PIC development boards. There are several others but this would be one I would considerhttps://www.amazon.com/Microchip-PIC16F877A-Microcontroller-Development-Interface/dp/B07WTB68FK

author: Jan Audio
author_rank: Frequent Contributor
timestamp: March 30, 2021, 03:18:10 pm
content: Quote from: Sigma957 on March 30, 2021, 02:49:39 pmThis 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.

author: Sigma957
author_rank: Contributor
timestamp: March 30, 2021, 03:28:41 pm
content: 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.ThanksGren

author: rstofer
author_rank: Super Contributor
timestamp: March 30, 2021, 03:55:23 pm
content: 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/B08B4D5MV5I 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

author: Jan Audio
author_rank: Frequent Contributor
timestamp: March 30, 2021, 03:59:13 pm
content: Just look what you can do with a PIC12F1572, it is incredible, and only DIP8, fun.

author: Martian Tech
author_rank: Regular Contributor
timestamp: March 30, 2021, 04:00:08 pm
content: 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-processorhttps://hackaday.io/project/25203-toy-basic-computer

author: Sigma957
author_rank: Contributor
timestamp: March 30, 2021, 05:19:26 pm
content: 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 helpGren

author: Sigma957
author_rank: Contributor
timestamp: March 30, 2021, 05:21:57 pm
content: 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.ThanksGren

author: Sigma957
author_rank: Contributor
timestamp: March 30, 2021, 05:26:01 pm
content: Quote from: Martian Tech on March 30, 2021, 04:00:08 pmHello,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

author: MarkF
author_rank: Super Contributor
timestamp: March 30, 2021, 05:52:25 pm
content: 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 offerin 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) modulesSit 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.

author: Sigma957
author_rank: Contributor
timestamp: March 30, 2021, 06:00:57 pm
content: Quote from: MarkF on March 30, 2021, 05:52:25 pmHello,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

author: Ian.M
author_rank: Super Contributor
timestamp: March 30, 2021, 06:21:02 pm
content: 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 ofPIC18F46K22to 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.

author: rstofer
author_rank: Super Contributor
timestamp: March 30, 2021, 08:19:54 pm
content: 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/1914589The 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

author: BlackICE
author_rank: Regular Contributor
timestamp: March 30, 2021, 09:34:06 pm
content: 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.

author: Sigma957
author_rank: Contributor
timestamp: March 31, 2021, 12:42:59 am
content: Quote from: BlackICE on March 30, 2021, 09:34:06 pmHello,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 helpGren

author: MikeK
author_rank: Super Contributor
timestamp: March 31, 2021, 12:56:10 am
content: Nigel something-or-other has some tutorials for the older PIC's:http://www.winpicprog.co.uk/pic_tutorial.htmAnd 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.

author: MarkF
author_rank: Super Contributor
timestamp: March 31, 2021, 02:00:49 am
content: Another PIC I can recommend is the pic18f2620 for those large projects.- Large program space (64K)- Internal 32MHz clock- 28 pin DIP or SOICOne 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.

author: rstofer
author_rank: Super Contributor
timestamp: March 31, 2021, 02:27:42 am
content: Quote from: Sigma957 on March 29, 2021, 07:39:03 pmIf 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.

author: MikeK
author_rank: Super Contributor
timestamp: March 31, 2021, 02:36:43 am
content: 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.

author: Martian Tech
author_rank: Regular Contributor
timestamp: March 31, 2021, 04:15:34 am
content: A good part of the fun of using PIC processors is finding the one that best suits your particular project's needs. It makes you actually understand what you're trying to build and think about the requirements up front. How many GPIOs do you need? Timers? ADCs? DACs? Serial ports? Capacitive touch, etc... You don't just buy the biggest, fastest chip, but use the selection tools provided by Microchip to narrow things down. "Supported by TL866" is another filter you can add (but not provided by Microchip tools). So I would pretty much ignore any recommendations in this thread about what someone else's favorite PIC processor is. Find your own favorites based on your own project requirements.

author: Sigma957
author_rank: Contributor
timestamp: March 31, 2021, 07:30:36 am
content: Quote from: rstofer on March 31, 2021, 02:27:42 amHello,I just checked the list for the newest TL866II Plus and it handles 16F, 18F and others. (New specs say 16667 chips) List is massive.In Fact I just got a firmware update for the Programmers and now all running latest firmware.The older models I have only go to about 13000 chips.Thanks for letting me know as it is better to be safe then sorry.ThanksGren

author: Sigma957
author_rank: Contributor
timestamp: April 01, 2021, 06:21:15 am
content: Hey Guys and Gals,Just wanted to say thanks for all the reply, help and info.I am currently reading a book to cover basics and then will do some projects from sites people posted just so I get better understanding.I assume it will take me awhile to do my own test projects but will post when I do.Thanks again.Gren

author: Sigma957
author_rank: Contributor
timestamp: April 01, 2021, 11:11:55 pm
content: Quote from: Martian Tech on March 31, 2021, 04:15:34 amHello Martian.I have a question for you based on what you said "A good part of the fun of using PIC processors is finding the one that best suits your particular project's needs".My confusion is from my lack of knowledge, but why does that one line matter?What I mean is that since lots of the PIC's I see for sale they are all pretty close in cost (or it appears to me).Why not just get one type of pic instead of different ones?I see it as if I buy a large pic and it holds lots of data it would not matter if i had little code in it.I hope you understand what I mean as I really suck at explaining things.Thanks in advanceGren

author: Jan Audio
author_rank: Frequent Contributor
timestamp: April 02, 2021, 01:51:00 pm
content: It means you can search for peripherals.If you have a chip with PPS means you can use almost any peripheral on almost any pin.Without PPS you are stuck to having peripherals on fixed pin, or 1 alternate pin.Keep in mind the peripherals are not the same in all chips,by example : the PWM module can be more advanced in newer chips.Yes buy 1 big chip with PPS and you have enough, once you understand all peripherals you can buy a chip that suits your project.

author: Sigma957
author_rank: Contributor
timestamp: April 02, 2021, 09:52:46 pm
content: Quote from: Jan Audio on April 02, 2021, 01:51:00 pmHello,Thanks for the fast reply and info, I really appreciate it.I understand and will start basic since I'm a noob.doing lots of reading now and hope to move on to hands on projects others have done.Thanks againGren

author: Gyro
author_rank: Super Contributor
timestamp: April 03, 2021, 09:56:27 am
content: Quote from: MikeK on March 31, 2021, 02:36:43 amThe PICkit3.5 clone of the PICkit3 is still available reasonably cheaply on ebay. You can still use it either under MPLAB or standalone, like the PICkit2.

author: Sigma957
author_rank: Contributor
timestamp: April 03, 2021, 04:17:20 pm
content: Quote from: Gyro on April 03, 2021, 09:56:27 amHello,Thanks for letting me know, I might grab one just in case I need it.ThanksGren

author: MarkF
author_rank: Super Contributor
timestamp: April 03, 2021, 05:28:35 pm
content: Quote from: Jan Audio on April 02, 2021, 01:51:00 pmI would advise the exact opposite.Having a MCU that can re-map pin functions just adds another whole level of complexity and confusion.Just wading through the internal clock, timers, analog-to-digital (ADC) and interrupts is big enough of a challenge for the noob.Just find a simple 14 or 28 pin PIC to get started.A hand full of cheap $1 MCUs that you can afford to fry are plenty till you get the basics under you belt.You can't go wrong having a few basic PICs on hand for small projects.For those big projects in the future, you'll be searching out a MCU that meets its special requirements anyway.There is no 'one part does all' MCU. You will always be weighing function with physical size with etc...

author: Raj
author_rank: Frequent Contributor
timestamp: April 04, 2021, 10:47:39 am
content: PIC just doesn't have enough users in it's community.I learnt to program AVR using a very cheap book (avr-microcontroller-and-embedded-systems) (image attached).But before you start to learn to write code, make sure that you can program one. ( I couldn't afford any of the programmer suggested in that book so I used 4 resistor and parallel port methodhttp://danyk.cz/avr_prog_en.html)(Thanks Dan)Start with trying out other's schematics and codes.Also, try to learn STM and Espressif stuff. It's easy to transfer from one to another if you learn one but these are the most rewarding.Also, I knew java before any of these things...Knowing C++, C or java will boost your learning skills a lot. (Python will help build a programming mindset but ones you learn python, other languages will become harder.)Also know that, the Arduinos you already have are AVR based.Knowing that you're stuck in home and won't be able to get components easily, try programming pure software stuff first, like Tictactoe game or a clock written in java or C#, or front end written in MySQL, written in java. Try the NCERT Informatic practices book. (image attached) (Do know that finding a printed version of it, is super tough and is only sold in Delhi, India, so everyone taking that subject has to print it using their printer)

author: Sigma957
author_rank: Contributor
timestamp: April 09, 2021, 01:14:50 am
content: Quote from: Raj on April 04, 2021, 10:47:39 amHello,Thanks for reply and info, I appreciate it.I am reading books now and dug out a few parts for testing/building examples in the book(s).As for stuck at home parts are not my worry at all.As various local shops can send me what i would need depending on cost.I will look for the book you suggest and will spend some times reading the books and practicing with examples.Thanks again for the help.Gren