Electronics > Microcontrollers

Arduino User looking to move to PIC

(1/13) > >>

I have used an atmel arduino as my microcontroller of choice for a few years now and I am looking to move to using PIC micros. For my first project I am trying to make a bridge between DMX512 and three PWM signals. I want three PWM channels with at least 12 bits of resolution at 200 Hz (I know it might not exactly be 200 Hz because of prescaler values). Which PIC should I use for this? There are so many to choose from.

I will be developing on OSX and linux, is there an IDE to use or will I just be stuck with a command line compiler/debugger?

Can you program a PIC in C? Everyone seems to talk assembler for PIC.

I'm using MPLAB-X on Windows : http://www.microchip.com/pagehandler/en-us/family/mplabx/

As it's based on netbeans ide code, it runs on Linux and Mac.. in fact you can select the distro from the download page (left corner).

It can work with several compilers, they can be added like plugins... and I'm using Hi-Tech C compiler.  So I guess that answers your question about programming in C.

They have some new batch of compilers called XC ... not sure what they are  as i didn't test them yet, but I suspect it's just a rebranding of the hi-tech c compiler with maybe some different compiler for what hi-tech didn't support.

Not sure what micro to recommend for 3 pwm signals, so far I had no use for so many. Maybe others can chip in.

I'm not familiar with your specific application though the microchip web site has a product selection tool.  That might help you narrow things down.  The only PWM I've done has been in software.  At most, I've used a timer to generate an interrupt.  If the 16F and 18Fs have any additional on chip PWM hardware to assist with the task I've not used it, though I'm just a hobbyist.

If you are looking at the PIC18F family, there are two main C compiler options.  The first is Microchip's C18 compiler.  This is what I've used and it's going away.  The second option is HI-Tech.  My understanding from reading the MC forums is that the upcoming XC compiler is based on Hi-Tech.

In either case, both compilers have free unoptimized compilers available.  The MPLAB IDE interfaces well with both of them.  Just this week I upgraded to MPLAB X and it works well on Windows.  I've heard a number of minor complaints about using it on Linux (mandatory reboot after install/root required for install), but in general, it seems to be functional.

I'm not personally familiar with anything other than the 16F and 18F families so I can't comment further.  If you are moving over from an Arduino, take a look at the 18F line and see if that meets you needs in terms of general capabilities and performance.

Though (my understanding is that) C18 is going away, see if you can get a copy of "Applying PIC18 Microcontrollers" by Barry B. Brey.  It has a great deal of example code dealing specifically with C18 and the PIC18F family.  Of course, if you delve into Hi-Tec C, another book might be more appropriate.

Good luck!

Jon Chandler:
Quite a bit of DMX work has been done in Swordfish Basic on PIC18F-series controllers.

You can see the details here: PIC based DMX Dimmer


--- Quote from: charliehorse55 on May 05, 2012, 04:08:09 am ---I want three PWM channels with at least 12 bits of resolution at 200 Hz (I know it might not exactly be 200 Hz because of prescaler values). Which PIC should I use for this? There are so many to choose from.

--- End quote ---

I would likely go for one of the PIC24Fs


They have up to 9 16bit output compare/PWM generators.

I can't recommend PIC18s, klunky architecture and hard to find applications where they have an advantage over the 16 bit parts. PIC10/12/16s are useful for smaller applications. PIC32 if you want 32 bits but they are not hugely faster or have much more memory than the 16 bit parts.

MPLABX is the new cross platform IDE but being new it is not without issues.

There are C compilers for all parts. They are free to use with optimisation restrictions. The 16 and 32 bit compilers (C30 and C32) are GCC based and generate quite respectable code with the optimization limits. Generated code from the free 8 bit compilers (previously Hi-Tech) is pretty bad.

They are in the process of rationalizing the compiler range down XC8, XC16, and XC32. The free version of XC16 and XC32 might be a bit more crippled than the free versions of the current C30 and C32.


[0] Message Index

[#] Next page

There was an error while thanking
Go to full version