Next, the data line is changed to reflect the value 0 or 1. First, the programming voltage is raised (VPP) to put the PIC in programming mode. Put it together with VPP for a very simple look at how a PIC is programmed. The clock pulse triggers the PIC to copy the value on the data pin (0 or 1) into memory. The clock line is raised high and then dropped low again when the proper value is on the data pin. The PIC data pin is switched between supply (1) and ground (0) to represent these bits. hex extension, are represented by 0s and 1s on a disk. You probably already know that everything on a computer boils down to 0s and 1s. These are usually found on PORTB, pins 6 and 7, on PIC microcontrollers. I usually use the common 1n4148 for this purpose.Ĭode flows into the PIC on the clock (PGC) and data (PGD) pins. A small signal diode (D1) does exactly that. Everything on the circuit board could be ruined by 13 volts - a one-way valve is needed to keep the high Vpp voltage where it belongs. If we route this pin to a header and connect a programmer, the programming voltage will go through the MCLR resistor (R1) and enter the rest of the circuit. Vpp varies among PIC models, but can be as high as 13 volts. When a programmer applies the "programming voltage" (Vpp) to this pin, the chip readies itself for new firmware to be copied. The MCLR reset pin is also used to put the PIC in programming mode. The programmer MUST share a ground connection to the circuit board, and a connection to the supply voltage is generally used as well. We took care of these connections earlier. Even if you plan to use a socket programmer, read on to understand what connections the programmer makes to the PIC when you put it in the socket. This method of programming is called In-Circuit-Serial-Programming (ICSP). This saves a ton of time with socketed chips, but is absolutely required for surface mount chips that can't be removed from the circuit board. I always add a simple 5 pin connection to the circuit board so that the chip can be programmed without removing it from the circuit.
How to make a usb pic programmer how to#
This gallery shows how to make the bare minimum connections for several different PIC microcontrollers.Ī PIC in a bare circuit is great, but we need to get some software into it before it's useful. To use this function, put a 10K resistor (R1) between the power supply and the MCLR pin.
How to make a usb pic programmer full#
Most PICs have an MCLR function that causes a full reset when this happens. Spikes in the power supply can freeze up a PIC or cause erratic behavior. If the supply and ground pins aren't next to each other, an annoying thing that happens all too often, connect one side of the capacitor as close to the supply pin as possible and the other to a common ground plane. In practice, a capacitor should be put on every supply (Vdd) pin. 0.1uf capacitors should be dirt cheap, buy 100+ online to save a bundle. This noise will cause wild oscillations in the circuit if left unchecked. These are called "decoupling" capacitors because they isolate (decouple) the chip from noise in the power supply. Read more about routing these connections if you design a device that does super-duper delicate measurements with the analog to digital converter.Įach pair of Vdd/Vss or Avdd/Avss pins get a 0.1uf capacitor (C1 in the diagram below). These pins allow you to provide a clean supply to the analog portions of the chip. Check out the RGB color changer circuit board to the right, the large blue area is a ground plane.ĭon't forget to connect any pins marked Avdd and Avss. Ground planes are economical and environmentally friendly - copper must be chemically etched from any unfilled areas on a circuit board, this uses more acid etchants and creates a larger copper waste stream. Most circuit boards use a ground plane, this means that all ground pins connect to the copper areas that remain after other wires have been routed. You'll also see ground referred to as: negative, ground, "-", gnd, the flat side of the battery, and the black wire. Other names for Vdd include: Vcc, power, supply, "+", the bumpy side of the battery, and the red wire. Vdd is generally a 5 volt positive supply. Vdd and Vss are the labels Microchip uses to designate the positive supply and ground. Get all the files for this project in the project archive.īefore we delve into the details of programming, lets take a look at the basic connections needed to get a PIC up and running.