Series of Harvard architecture RISC microcontrollers from Microchip. Looking like innocent TTL logic chips, they get tiny-to-huge interface/control jobs done with flair, speed, and low power consumption. They are the CPU for the nifty Basic Stamps--running a powerful token interpreter in under 1024 bytes.

The 16F84 is a very popular part: configured with FLASH RAM and programmable with free software / (very) minimal HW. Once code is stable, OTP chips bring the cost to nothing.

Inexpensive Compilers/emulators/programmers (see GNUpic) abound. If you do Windows, get the excellent MPLAB for all your editing and simulating needs. Free CD with datasheets and software for the asking from Microchip.

In the context of microchips it is an acronym. It stands for Peripheral Interface Controller, hence PIC. These things are unbelivebly useful. I belive that some one has writen a webserver for one of these.

In aviation, PIC is also an abbreviation for Pilot In Command. Pronounced "pick," private pilots record solo flight time under the PIC time heading in their logbooks, as opposed to flying with another person or instructor in which case it is logged under dual time.

An old little language for drawing diagrams. Originally a troff (and nroff and groff and ...) preprocessor which was part of the UNIX Documenter's Workbench text tools supplied by AT&T and/or BSD. Nowadays, that pic is dead, but GNU pic continues the tradition. Even nicer, it can produce TeX output at the drop of a -t switch. ESR has a very well-written tutorial and reference entitled "Making Pictures With GNU PIC".

While pic is usable with TeX (indeed, I almost never use it with *roff, preferring TeX), its syntax is a bit like the syntax of other *roff preprocessors, such as eqn, tbl and grap. grap is a pic preprocessor, but as it is no longer available there is little point in dwelling on the mind-bending thoughts of prepreprocessors... Therefore I shall use pic in *roff mode. On a Linux or similar system, a syntax for processing pic files could be

pic < input-file.pic | groff > output-file.ps
(or pipe the groff output to a PostScript viewer such as gv or ghostview).

Basic drawing

Like any UNIX Bell Laboratories tool, pic has a simple, readable syntax, which is almost but not quite totally unlike the syntax of every other UNIX Bell Labs tool. (There is no need to worry -- GNU pic extends the syntax of "classic" pic in a simple, readable and utterly different way...). So the easy things are very easy:

.PS
box "A"; arrow; box "B"
.PE
draws a picture rather like this one:
+-----+      +-----+
|  A  |----->|  B  |
+-----+      +-----+
except that pic produces printed quality, and I produce low-level cheap ASCII art imitations. Everything between the ".PS" and ".PE" troff-like commands is considered a pic program; pic will ignore all the other text, passing it through to programs further down the pipeline. This lets pic work with *roff and TeX.

pic commands ask for some object to be drawn: box, circle, line, arc, ellipse, arrow, are all provided, as well as macros. After a command come various options. Commands end at the end of the line, or with a semicolon. The most common option is just "some string" -- that string will be printed, centered, on the object. You can also use just "some string" as the object, making pic draw that string.

After drawing any object, pic moves in the default direction. The default default direction is "right" -- that's why we got a box, an arrow, and a box going from left to right. Some commands -- like "arc" -- can change the default direction, which is nice. You can change the default direction by using a direction name as a command:

.PS
down
box "two" "lines"
arrow
ellipse "The" "End."
.PE
draws a box above an arrow above an ellipse. Note also the use of multiple strings as options -- the strings are displayed on separate lines.

Default directions are convenient, but don't always do what you'd expect. Luckily pic has gazillions of positioning directives, which let you do what you need to do. Of course, there are so many directives that it can be hard to decide which ones you really need. The area which causes the most difficulties is when you want to change directions. To draw a closed loop of boxes and arrows, you can say:

.PS
right; box "1"; arrow
box "2"; down; arrow from last box .s
box "3"; left; arrow from last box .w
box "4"; up; arrow from last box .n
.PE
(There are many other ways to get the same effect).

You can also name parts of your picture using LABEL: object. Saying "arrow from BIGBOX .nw" can be easier than saying "arrow from 18th box .nw" (although both syntaxes work). Naming parts is especially useful when using a macro. For a final simple example, here's a simple organization chart of where you work:

.PS
right
P: box "Z. President"
define vp {
  line from P.e right 0.1 then down $1 then right 0.1
  box height 0.35 width 0.8 $2
}
vp(-0.6, "VP RND")
vp(-0.2, "VP S&M")
vp( 0.2, "VP Cloud" "Control")
vp( 0.6, "VP Self" "Advancement")
.PE

pic is very old-fashioned by today's (sub-)standards. But it excels in programmatic creation of diagrams, or in letting somebody with as poor mousing skills as mine prepare a semblance of a diagram.

The Microchip PICmicro microcontroller series (known as the PIC) is extremely popular among both hobbyists and commercial designers. Its excellent I/O support, low cost, and versatility combine to make it an attractive option for low-end embedded applications.

A Low-End Microcontroller

In the embedded systems world, there are widely varying requirements of microprocessors and microcontrollers: from simple I/O controllers, to high-speed signal processors, and general purpose CPUs. Microchip's PICmicro series of microcontrollers falls from the low to medium end of this scale, fulfilling the simplest of needs with its 12C devices, and scaling up to more demanding requirements with its high-end 17C family. In the mid-range are the most commonly used devices, the 16C and 18C range; these give a good balance between low cost and high performance.

PIC Architecture

The PIC microcontroller started life as a piece of specialised industrial control logic. It grew out of General Instrument's Peripheral Interface Controller, slowly adding more microprocessor-like instructions, until it became a more general purpose machine. Much of its success is down to its low cost, both for the development tools and the microcontrollers themselves.

Because of the cost requirements of low-end microcontrollers, most PICs have very little RAM. Data memory is organised into 8-bit registers, ranging in number from 25 to 3840; only the 17Cxxx series supports externally addressed SRAM. Working with so little writable storage leads to a necessary rebalancing of programming style, making heavy use of look-up tables and unrolled loops wherever possible. While RAM is lacking, EPROM is not, ranging from 768 bytes to 128 Kbytes. The memory is organised as a Harvard architecture: the data memory is 8 bits wide, and the instruction memory is 12 to 16 bits wide, depending on the device.

Looking from a modern CPU architecture perspective, the PIC instruction set design has some unusual quirks. Due to the restricted instruction width, two-operand calculations use a special working register, denoted w. This design was common in the early days of microprocessors, where the working register was more commonly known as an accumulator. It allows for a very small instruction width, but slows execution due to almost continuous memory accesses.

An implication of the accumulator design is a highly verbose assembly language, and therefore very poor code density. Some seemingly simple operations, such as array manipulation, can take many more instructions than would be required on a modern architecture. Since low-end microcontrollers are primarily programmed in assembler, this arduously lengthy style of coding is less than ideal from a programmer's point of view.

Features

Combined with the low cost and size, the I/O capabilities of the PIC are what make it such an attractive proposition for interfacing projects. Even the 8-pin 12Cxxx devices have six I/O pins, and the more common mid-range 16C84 has thirteen. Many PICs also have multiple analogue input capability, using either reference voltage comparison or successive approximation methods, with 8-bit or 10-bit accuracy.

Programmable timers are also a standard feature, and many PICs have a hardware watchdog timer to allow resetting the processor if the program fails to function correctly. A useful complement to this is brown-out detection, allowing the system designer the option of halting the processor on a low voltage condition, instead of continuing and possibly operating incorrectly.

Many mid-range and high-end PICs are available with a built-in USART (Universal Synchronous/Asynchronous Receiver/Transmitter), which greatly assists serial interfacing. The maximum data rate is limited by the clock speed of the processor, but even a 20MHz external clock allows for asynchronous communications at up to 1250Kbaud.

One of the biggest selling points for enthusiast and educational users is the availability of the PIC in Dual In-line Package (DIP) format, which is readily mounted in breadboard or strip board. Many designs benefit from the fact that DIP chips can be built into a simple custom-designed circuit with exactly the I/O connections needed for the specific system being built.

Most other microcontrollers are only available in surface-mount configuration, which means that a pre-manufactured development board must be used as a basis for any home or university projects. Some microcontrollers are available in DIP format, but these tend to be available only in low volumes, and are therefore prohibitively expensive.

PICs are available in three memory configurations: one-time programmable (OTP), EEPROM, and Flash. Reprogrammable devices are intended for use in research and development, and cheaper OTP products are available in bulk for manufacturing. The low-cost OTP production capability of the PIC is one of the reasons it is so popular today, allowing microcontroller-based products to be mass-produced inexpensively.

Development Environment

Since the PIC is such a widely-used architecture, there is no shortage of software and associated development hardware aimed at developers. The most popular software includes Microchip's own MPLAB Integrated Development Environment, and a loose collection of GNU utilities.

MPLAB is a free collection of development tools, integrated in a Windows Multiple Document Interface application. It includes a simple text editor which is somewhat similar to the popular PFE32, a macro assembler, a build system, a rudimentary simulator, and drivers for a few Microchip EEPROM/Flash programmers. None of the components excel, but when combined are more than adequate for developing a full-scale software project.

Microchip and several third parties all offer C compilers targeted at various PIC instruction sets. Almost all of these are commercial, and those that are Free Software, freeware, or shareware tend to have very poor code density when compared to hand-crafted assembler. In any case, there is often little benefit to be gained from writing PIC software in C, since most of the work in developing for the microcontroller is interfacing with the hardware, and this is not helped by using the higher level language. For more complicated, algorithm-intensive tasks, using a C compiler may be a worthwhile trade-off; in simple interfacing projects, it is more likely that assembler will be the best choice.

Several GNU tools are available to aid PIC development; all of these are Free Software, and have been ported to most UNIX-compatible operating systems and Microsoft Windows. By far the most useful and popular of these is Scott Dattallo's gpsim simulator tool. This is well-known as the most full-featured and accurate PIC simulator available, allowing cycle counts, single instruction step, and full inspection of the microcontroller state. External hardware simulation support is available, including an LCD emulator, and support for USART and other more advanced hardware simulation is forthcoming.

Also available is gputils, an MPLAB-compatible assembler and disassembler which is on a par with Microchip's offering. Completing the full development environment is a wide range of drivers for PIC programmers, ranging from a reverse-engineered driver for Microchip's own PICstart+ kit, to several pieces of software which come with circuit diagrams to build your own parallel port programmer. When combined with the user's choice of text editor, standard GNU make, and a version control system, the Free Software offering is better in some ways than the Microchip option.

However, the GNU tools are not as easy to learn as MPLAB, and lack support for certain newer PIC devices and programmers. Those more familiar with a Windows environment will certainly feel more at ease with MPLAB, and the GNU collection of individual tools is certainly a viable alternative for everyone else.


References:
"Programming and Customizing the PIC Microcontroller", Myke Predko, McGraw-Hill, 1998
Microchip: http://www.microchip.com/
GNUPIC Collection, Scott Dattalo: http://www.gnupic.org/
"PIC UART", Fr. Thomas McGahee: http://redrival.com/mcgahee (mirrored at http://penglet.org/picuart.asm)

Pic (?), n. [Cf. F. pic.]

A Turkish cloth measure, varying from 18 to 28 inches.

 

© Webster 1913.

Log in or register to write something here or to contact authors.