[sdiy] PIC basic setup?

rsdio at sounds.wa.com rsdio at sounds.wa.com
Fri Jan 10 06:09:28 CET 2014

I've designed several commercial products based on the PIC (USB-MIDI  
control surfaces), but I've never used an evaluation board. The  
biggest mistakes I've run into are:

A) Most PIC chip models have everything they need internally to  
implement a Power-On Reset for reliable startup. However, a few PIC  
chip models require a pull-up resistor on /MCLR to be reliable. I had  
one board where waving your hand over the PCB would cause it to  
reset! Adding a pull-up solved that, and the quick solution on the  
prototype was to add a resistor using the ICSP connector. The data  
sheet should give example circuits and should tell you whether your  
PIC needs this circuit or not.

B) Even though you might want to run your PIC at 48 MHz or 64 MHz,  
you probably can't connect a 48 MHz crystal. Usually, the PIC wants a  
4 MHz or 8 MHz crystal (pick the one you can get cheaper). The PIC  
can use its built-in PLL to boost the internal clock to the maximum.

C) Usually, every port pin on a PIC can handle 20 mA, especially on  
the 5 V parts, which is about the most you'll need for an LED.  
However, some of the newer PIC chips that run on 3.3 V (usually for  
USB) only support 20 mA on specific I/O pins. Other pins only support  
8 mA or even as little as 2 mA. In those cases you'll need to set  
your LED resistors to limit the current to the data sheet specs,  
otherwise you'll wear out your PIC rather quickly. In all cases, you  
might want to use an FET that can handle 100 mA to switch on the LED,  
and then the PIC I/O pin only needs to run the Gate of the FET with  
little or no current.

D) Grounding and shielding are very important for reading pots. You  
always want to connect the metal case of your pot or fader to the  
analog ground plane of your board. Then you'll want to pay careful  
attention to the analog and digital grounds, and the Vref+ and Vref-  
pins for the PIC. It should work no matter what, but you might have  
lots of noise with poor grounding and shielding, making the 10-bit A/ 
D perform worse than a 7-bit A/D.

p.s. With your PIC16 at 5 V, you're probably not going to run into  
the same problems I had with the PIC18 at 3.3 V with USB. Still, the  
above notes might be helpful since many peripheral designs are shared  
between the various PIC models. USB circuits have lots of  
requirements, but it doesn't seem like you're going there.

Brian Willoughby
Sound Consulting

On Jan 8, 2014, at 05:29, Jack Jackson wrote:
> Any good ideas/tutorials for getting a PIC working with just a  
> basic setup (pic, xtal, maybe 5v regulator), making it blink an  
> LED, respond to a pot, etc?
> I got a few PIC16F684 and a programmer with the intention of doing  
> Tom Wiltshire's/Electric Druids VCADSR project. 		 	   		

More information about the Synth-diy mailing list