Arduino guy getting his first PIC chip, pointers please - Page 1
Forum section: electronics / general

author: technix
author_rank: Super Contributor
timestamp: April 30, 2015, 12:17:08 am
content: I recently got hold of a bunch of PIC16F72s from a Shenzhen supplier selling away their NOS at US$0.25/each. I need starter guide.I am a CS student with some experience playing with Arduino and Raspberry Pi.PS. I also got a few Altera MAX II (EPM240/EPM570) CPLD evaluation boards, some beginners' instructions is also welcomed.

author: rx8pilot
author_rank: Super Contributor
timestamp: April 30, 2015, 12:23:31 am
content: What have you done to help yourself so far?Surely as a CS student, you have heard of Google. Don't mean to be too sharp, most folks are more helpful if you do at least some work.

author: technix
author_rank: Super Contributor
timestamp: April 30, 2015, 12:36:26 am
content: Quote from: rx8pilot on April 30, 2015, 12:23:31 amSo far I got MPIDE X up and running on my Mac and have a LED blinker up and running.I don't have a PICKit yet and the LED blinker is flashed with my TL866. Is getting an PICKit any good? Will it work on my Mac or do I need to put it on Linux or Windows VM? Is it a good idea for me to hunt down some easier-to-use eval kit for the PIC?On the CPLD front, VHDL seemed odd to me and Quatrus not working on Mac and not supporting Ubuntu Linux well enough made it quite inconvenient - have to fire up a VM and fiddle with shell scripts every time before using it is a bit tiring.

author: miguelvp
author_rank: Super Contributor
timestamp: April 30, 2015, 01:21:43 am
content: I made a short tutorial for a Cyclone V using schematic entry and a little verilog.https://www.eevblog.com/forum/microcontrollers/bemicro-cv-questions/msg524041/#msg524041You will have to adapt it to your device and pinouts, also I don't know what version of Quartus you need for the Max II as in I don't know if it's supported by the latest version.Also Altera usually has at least a myfirstfpga or cpld demos. I'll try to dig the links to altera university and training, they do have tons of information.I do prefer VHDL myself, the reason I used verilog on that example was because the OP of that thread was using that.

author: miguelvp
author_rank: Super Contributor
timestamp: April 30, 2015, 01:55:02 am
content: Some linkshttps://www.openimpulse.com/blog/products-page/product-category/max-ii-epm240-cpld-minimal-development-board/This seems to have example code and it might be one of your boardsThis one could be your other board:https://www.openimpulse.com/blog/products-page/product-category/max-ii-epm570-cpld-development-board/The first problem I see is that you are going to need a usb blaster programmer or compatible. Newer FPGA dev boards have the programmer built in. Otherwise you'll have to purchase one from ebay that will work with your dev boards.You can also pickup something newer including the MAX 10:https://www.altera.com/products/boards_and_kits/all-development-kits.htmlOr go to an FPGA instead.The cheapest ones that I like are the Arrow BeMicro onesProducts:http://www.arrow.com/bemicro/Wiki:http://www.alterawiki.com/wiki/BeMicroBut their samples have erratas so you might be better off with a DE0 Nano or other ones from Terasic, they have more sample code.http://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=English&CategoryNo=13&List=SimpleBut there are many choices and it's hard to decide once you start looking into dev boards, do you want one with the SoC built in? or just FPGA?No matter what, be prepared, because you are going down the proverbial rabbit hole.Edit: Also I don't like what Altera has done with their training website and the full overhaul of their site, I can't find the cpld courseware anymore, but this is their new main entry for the free training:https://www.altera.com/support/training/curricula.htmlLegacy courses :http://wl.altera.com/servlets/searchcourse?num=10&start=10&total=39&forwardto=legacycoursesTutorias:https://www.altera.com/support/training/university/materials-tutorials.html

author: 0b01010011
author_rank: Regular Contributor
timestamp: April 30, 2015, 02:26:53 am
content: Had no issues with PicKIT III but don't let small children near it, as they will split the case when you're not looking.When I started out with PICs the golden rules I followed was:- ALWAYS start with a blinking LED for any new project, and keep it for debugging. No point spending 3 days writing something when you don't even have oscillation.- Remember pins are default analogue inputs.- For more complex peripherals (e.g. gated TIMER1 or the USART), print out that section of the datasheet and read in its entirety.Also remember that Microchip does free samples even if you say it's for educational/hobby use. Never had a request refused, and I must have got at least 20 PICs that way.

author: technix
author_rank: Super Contributor
timestamp: April 30, 2015, 02:51:26 am
content: Quote from: miguelvp on April 30, 2015, 01:55:02 amThe CPLD eval board I got is essentially a breakout board with JTAG, oscillator and 3.3V regulator on it and I usually couple it to my Raspberry Pi or Arduino Due during use.MAX II is supported by the latest Quatrus 14.1. This is one major nice point of it.I do have an USB Blaster clone for a long time, as it is the cheapest JTAG adapter I can find that OpenOCD supports. I was using it as ARM JTAG but since now I got the CPLD eval board it can start serving me as CPLD JTAG.FPGA eval boards get utterly expensive here.

author: technix
author_rank: Super Contributor
timestamp: April 30, 2015, 03:05:15 am
content: Quote from: 0b01010011 on April 30, 2015, 02:26:53 amI also have this "start with a blinky and keep it blinking" habit on all but the smallest MCUs :-P (8-pin MCU like ATtiny85 or the like never get blinky but anything bigger will)

author: 22swg
author_rank: Frequent Contributor
timestamp: April 30, 2015, 08:42:03 am
content: PIC16F72 is not were you should start... coming from arduion etc ... get hold of a PIC18 or PIC24 starter board or put an enhanced PIC16 on a BB...

author: technix
author_rank: Super Contributor
timestamp: April 30, 2015, 10:53:12 am
content: Quote from: 22swg on April 30, 2015, 08:42:03 amI will try to get a cheap PIC18/24 starter kit maybe, but before that PIC16F72 is all I got. Maybe I would roll a Arduino-compatible board for this chip for now?

author: 0b01010011
author_rank: Regular Contributor
timestamp: May 01, 2015, 04:23:13 am
content: I second this - I started on a PIC16F84A I got given in a grab bag, but quickly found the enhanced devices (PIC16F1XXX for example) were the way to go - a variety of pin counts and features and things to play about with.Another thing is that most of the peripherals are configured in reasonably sane states to begin with so there's no need to set every possible parameter if you don't need to. But you do need to study the datasheet carefully.I have a few demo boards that I got with my PicKIT 3 - these aren't too bad really and give you a nice space to experiment from with areas for prototyping.

author: 22swg
author_rank: Frequent Contributor
timestamp: May 01, 2015, 08:47:00 am
content: 0x53 I wholeheartedly agreeTechinx If you are serious about learning about PIC mcu then I applaud your ambition, I see from your other EEVblog posts ( why a different thread ? ) you seem very capable , It just depends how deep you want to go with the learning PIC process . Plan A … buy a board and fill it with someone else’s code have a project up and running in hours, and learned very little.Plan B. Put a PIC16Fxxxx on a board. With a pickit 2 or 3, Nice steady power supply (not usb ) Have the PIC Data sheet and any errata on hand . Install MPLAB 8.x gather example code Ready , steady … GoIn assembler code ….Flash a led.Read a switch or key pad.“Hello world” on a LCDSave / read data to PIC EEMake a digital alarm clock.Make a thermometer ( with and without ADC )Communicate to a PC.Save data to an I2C eeprom.Control a DC motor speed.Control a stepper motor.Etc etc …be creative…Project Problems … Post here , 1000 of EE’s ready to help .This will be a solid foundation and you will now be ready for advanced code bigger and better PIC’sYou could do this with a 16F72 but its a little ancient as a starting device.I did plan B aged 55 and I am still learning 16 years on.Good luck, don’t think you will need it.

author: metalphreak
author_rank: Frequent Contributor
timestamp: May 01, 2015, 10:28:54 am
content: Pickit3 works fine in OS X FYI

author: nctnico
author_rank: Super Contributor
timestamp: May 01, 2015, 10:45:29 am
content: IMHO PIC is a step back. Better venture into the ARM world; that's where the future is and gives you an advantage to find a job.

author: technix
author_rank: Super Contributor
timestamp: May 01, 2015, 12:13:08 pm
content: Quote from: 22swg on May 01, 2015, 08:47:00 amMaybe I will get a better PIC chip and draw a better Arduino-like dev kit...

author: jnz
author_rank: Frequent Contributor
timestamp: May 19, 2015, 09:24:06 pm
content: Quote from: nctnico on May 01, 2015, 10:45:29 amI know this thread is 18 days old, but this quote can not be more truthful.Knowing what I know now, and seeing just how terrible MPLABX is, how badly Microchip is being run into the ground... Run... Run while you still can. Dump pic and get a cheap ARM dev board. Do not put even a few hours into learning anything about PIC 8bit. Ardunio is a step up even if it was a 1/2 as powerful chip if for no other reason than support.

author: ale500
author_rank: Frequent Contributor
timestamp: May 30, 2015, 04:51:36 am
content: Why not a PIC32 ? They are not much more expensive and you can get 28 PIN narrow DIP version with between 16 to 256 k Flash, up to 50 MHz. MPLABX is a bit slow, I'd say. It is not a bad IDE but well, it could be muuuch better, faster would be great.But, if you want to run away from PICs, you can try a Xpresso board (debugger+uC) with LPCXpresso (the IDE), from NXP. The bundle IDE+Board works quite well. And LPCs are quite easy to work with too. Sadly, DIP28 options are limited to one part: LPC1114, it also has 32k Flash like the ATMega328 but double the MIPS and 32 bits to boot