Arduino to PIC

Thread Starter

djsfantasi

Joined Apr 11, 2010
9,163
Hi y’all!
I’m thinking about moving on to using a PIC, from my previous efforts which all used an Arduino.
I am a professional programmer, so coding does not stress me. I believe that anything can be done in code.
But it’s the hardware form which I am uncomfortable with. The Arduino had all that done for me. I could make peripherals for the Arduino, but starting with just a chip – errrrrrr, where do I go from there? Read the datasheet is the first step! I got that.

The project I am in the process of designing a system with a Microprocessor, controlling an LCD screen, keeping track of time (in days), reading from an SD card, monitoring an input button and maybe outputting to a servo.

The idea is a goal reminder. The goal(s) will scroll on the LCD continuously. Every once in a while, as in a couple of times during business hours It will output something (move the servo?), to motivate someone to look at the device. The times should be randomized. As in, some days it won’t happen at all, some days it will happen only once, etc…

Any advice, recommendations or comments? I am sharing this to get some advice on moving from an Arduino platform to a PIC. Is a simple 3-4 step checklist possible?
 

MaxHeadRoom

Joined Jul 18, 2013
28,688
I usually mock a first system up in Strip board, a Olinex Board or use a Picmicro Picdem2 plus Demo board, each of these except the strip board, the Pic can be left in place and programmed and tested in smooth operation.
It all depends if you want to progress in the future over to PIC for ongoing projects, how sophisticated you want to get as far as a development system.
When I started with Pic's after not programming since the 8085, I used the Nigel Goodwin tutorial and boards to get familiar with them, I have since moved up from the 16F to the 18F series .
Max.
 

OBW0549

Joined Mar 2, 2015
3,566
I am a professional programmer, so coding does not stress me. I believe that anything can be done in code.
But it’s the hardware form which I am uncomfortable with. The Arduino had all that done for me. I could make peripherals for the Arduino, but starting with just a chip – errrrrrr, where do I go from there? Read the datasheet is the first step! I got that.
There really isn't that much to it. You need to download Microchip's MPLAB development environment (free) and get some sort of chip programmer; I'd recommend Microchip's PICKit3, which you can get for $40-$50 or so. Beyond that, you need:

1) Whatever PIC chip you intend to use,
2) A socket for the PIC,
3) A suitable crystal of the appropriate frequency (and capacitors for it), if you don't want to use the PIC's internal RC oscillator,
4) A suitable connector to interface with the PIC programmer gadget, and
5) A suitable voltage regulator to provide your Vdd supply, such as a 7805.

And that's about it, other than whatever application-related stuff you plan on using.

I've been working with PICs for the last 15 years, everything from the teeny little PIC10F series up through the dsPIC33EP devices, and I can tell you they're VERY user-friendly once you climb the learning curve.
 
Last edited:

MaxHeadRoom

Joined Jul 18, 2013
28,688
The Up/Down side of the Picmicro demo boards is they have 3 programmable sockets, 16p, 28p & 40p, several I/O objects covering the various modules, Timers CW different clocks/xtals, LCD, I2c, analogue, Usart etc, and a prototype area.
The only real down side is some of the peripherals are committed to certain fixed I/O, the LCD for e.g.
They also come with all the sample programs for the board in assembler and C+, which are also available for down load from the site.
They are typically used with Pikit2 or 3 programmer.
Max.
 

Brownout

Joined Jan 10, 2012
2,390
Here's how I got started (see attached image) Here I'm using a PICKIT3, and I've mounted the small PCB in a case along with an LCD display, regulator, a breadboard and a USB-Serial converter. I prototype hardware on the breadboard, and if I like it enough, I build up a little board and add it to the system. Also, I programmed all the experiments published in the programming guide before going it on my own.

The processor is pretty high end, and so you can prototype many different ideas with it, and move to a cheaper model if all the features aren't needed.

 

Brownout

Joined Jan 10, 2012
2,390
18f45k20. It's what comes with the debug board supplied with the PICKIT3/board combo. There is a Users Guide for the board PICKIT3 Debug Express, and I have a copy to share if anyone needs it and can't find it (though it should still be available online)
 

upand_at_them

Joined May 15, 2010
940
dj, You might want to go with AVR instead of PIC. For one thing, an Arduino is built from an AVR chip (and you can use your Arduino to program an AVR). And for another, you can program in C for the AVR for free while you have to pay for C compilers for PIC (unless you stick to only using 18F series PICs.)
 

mcgyvr

Joined Oct 15, 2009
5,394
The schematic for the arduino boards is readily available.. Look at the extra components it uses for your needs and thats what you would need to add to a PIC..
Its very minimal really..
And schematics for something like the simple DS1307 real time clock modules are all over too..
Sprinkle in some decoupling caps and voila..

There is a link to the "minimal arduino" (breadboard arduino or something like that) that will show you the minimum you need for a simple arduino setup too so you can compare whats been added..

I'm sure even googling "pic rtc servo" would get you plenty of articles on whats needed hardware wise too.. I'd hope anyways.. Its that simple with the vast arduino information out there..
 

Thread Starter

djsfantasi

Joined Apr 11, 2010
9,163
dj, You might want to go with AVR instead of PIC. For one thing, an Arduino is built from an AVR chip (and you can use your Arduino to program an AVR). And for another, you can program in C for the AVR for free while you have to pay for C compilers for PIC (unless you stick to only using 18F series PICs.)
Thanks for the suggestion.
 

ErnieM

Joined Apr 24, 2011
8,377
...And for another, you can program in C for the AVR for free while you have to pay for C compilers for PIC (unless you stick to only using 18F series PICs.)
For a few years now Microchip has made available free for download versions of C compilers for every PIC in every family.
 

OBW0549

Joined Mar 2, 2015
3,566
...you can program in C for the AVR for free while you have to pay for C compilers for PIC (unless you stick to only using 18F series PICs.)
I may be mistaken, but I don't believe that's true anymore with regard to the PIC: Microchip's XC8, XC16 and XC32 C compilers can be downloaded, installed and used for free, but the Free version provides only a subset of the code optimizations available with the Standard ($$$) and Pro ($$$$$$) versions. AFAIK there are no other limitations in the version.
 

Thread Starter

djsfantasi

Joined Apr 11, 2010
9,163
Thanks to all for your comments. My being quiet in no way indicates my level of interest and thanks for what you've posted. It simply indicates my digestion of your comments! Thanks again.
 
Go for it. I have always used PICs and think they are way more configurable. I currently use as my day to day PIC, a 18F26K22. 16MHz internal clock (can be run at 64MHz when enabling PLL) and every combination of pin arrangement you can think of. Each pin has so many functions which you can change to what you want them to be.

To make life easier, when experimenting with new code and a new project, I made a simple board from copper strip board that has the PIC in a DIP socket and a load of header pins on it. I also put 5 header pins on the top right of it to allow the PICKit3 programmer to plug straight onto it as it can be programmed in circuit.

I haven't done anything with Arduinos before, but I don't think they are so customizable as PICs and loads of the people you use them (I'm not trying to start a PIC/Arduino battle here) just copy code from the interent and stick it into the processor without actually knowing how the code works. Sure I will go and find some code (usually Arduino) to see how someone has implemented something, but always write my own so if something doesn't work, I will be able to sort it out.

There is one thing I really like about the massive hype over the Arduino though, it's the way that there are hundreds of 'breakout' boards available out there which are so cheap from China that can be bought and experimented with before constructing. I can't believe some of these boards, the chips of them cost 3 times the price of the loaded boards. Crazy

The XC8 compiler for MPLab is free, you only have to pay for the Pro version, which doesn't bloat the assembled code that the free version does.
 
Top