
PICs

No, PICs is not short for pictures. In this case it stands for "Peripheral Interface Controller" or “Programmable Integrated Circuit”. They are very versatile and you can be building your first program in just minutes. The PICmicro® micro controller (MCU) was first introduced around 1980 as their "Peripheral Interface Controller" (and became commonly known as the "PIC") by General Instruments for use in their product designs. The micro controller the engineers came up with had unusual processor architecture and was ideally suited for many micro controller applications. In the late 1980s, General Instruments "spun off" their chip manufacturing plants as Microchip, which has supported the PICmicro micro controller line along with other products.
The SuperDroids have some combination of the Parallax’s Basic Stamp 2s (BS2), OOPics, or Microchip’s PICs. The OOPic has several advantages over the Basic Stamp such as virtual circuits, object orient programming, event objects, easier programming. The Basic Stamp however has features that make it better than the OOPic, such as minor speed benefits for small programs and serial communications are better. Although now with the OOPic II+ and OOPic-R serial communications and memory access (speed) has improved making it the clear choice for robotic applications. The Microchip PIC is by large the leader, which require a little more work to get them running and interfacing. However, they are much more cost effective in the long run and their speed is +100x faster than the basic stamp or OOPic. The PICs just have the upfront cost of a compiler, depending
on the compiler method chosen.
On this page you will find further information on the following:

PIC Overview
Microchip has continually added new device part numbers to the lineup and the PICmicro microcontroller is now one of the most complete and full-featured microcontroller families available on the market. Microchip has always been on the leading edge for people to get involved with and learn the PICmicro microcontroller with a minimum investment of time and money.
One of the really nice features of the PICmicro microcontroller is the large amount of support that you can find over the Internet. There are a number of PICmicro microcontroller specific listservers and usergroups available on the Internet and a fairly large number of books to help new users learn more about the PICmicro MCU and to share ideas and projects.
The PIC is a small microcontroller designed primarily for fast input/output control using a small instruction set. The PIC is low-cost (~$6-$15), can be developed for free (free IDE, including simulator and others), and can be reprogrammed thousands of times (Flash EEPROM - no UV eraser required) from a cheap programmer (~US$10).
[Return to Top]
PIC Specifics
The PIC16F84 was one of the more common PICs, but has been replaced in popularity with the PIC16F628. The 16F628 offer an internal resonator,
The features of the PIC16F84 MCU are as follows:
 | 8-bit micro controller (MCU) with 14-bit instruction set |
 | 25mA max. sink per pin, 20mA max. source per pin |
 | 18-pin dual-inline package (DIP) with 13 input/output lines |
 | 35 single-word instruction set, each 400ns at 10MHz |
 | DC-10MHz clock, DC-400ns instruction cycle |
 | 1024 x 14-bit 'words' of FLASH program memory |
 | 68 x 8 bits of program RAM (SRAM) |
 | 8-level hardware stack |
 | Timer0: 8-bit timer/counter with 8-bit programmable prescaler |
 | Power consumption: <2mA @ 5V, 4MHz; <1uA standby at 2V |
For the PIC16F62X chips just imagine a PIC16F84 with:
 | 2K program memory (instead of 1K) |
 | 224 x 8 Data RAM |
 | 128 x 8 EEPROM data memory |
 | 15 I/O-pins (instead of 13) |
 | Internal or external oscillator (instead of external only) |
 | Capture, Compare, PWM (CCP) Module |
 | Hardware USART |
 | Analog comparator module |
The PIC 16F628 is less expensive than the PIC 16F84 too.
Detailed explanations of each of the above specifications is included below, along with links to external information sources. The best resource for detailed questions is, of course, the MicroChip datasheets.
8-bit micro controller, 14-bit instructions - which means all data is stored in chunks of 8-bits, and each instruction requires a 14-bit instruction. The Harvard architecture uses separate buses for the data and instructions. No floats, doubles, longs, or even integer data types are available, just the standard 'short' from C. Depending on how you wish to represent numbers, you can use the range 0 to+255 as straight binary, or from -128 to +127 in a two's complement method. While 8-bit arithmetic operations are included, you may require 16-bit operations for accuracy.
18-pin dual-inline package with 13 I/O lines - this is the stereotypical "computer chip", in that it's a small black rectangle and has two rows of metal connections. Of the 18 pins, 13 can be used for input or output, programmed through the portA and portB registers. Each I/O line can be designated as input or output, and tristate buffers are changed accordingly. With the on-chip buffers, the PIC can sink 25mA per pin (50mA per "bank", unfortunately) and can source 20mA per pin (50mA per "bank"). Two I/O lines are required for the clock, two are required for power connections, and the last pin is used as a reset line.
35 single-word instruction set - unlike the computers you have programmed with assembly language, where the instruction set has hundreds of commands, the PIC uses a RISC CPU with only 35 different instructions. A comprehensive list of these instructions is available from the MicroChip datasheets.
DC-10MHz clock, DC-400ns instruction time - this details the speed of the microcontroller. The clock can be run at any frequency up to 10MHz, whereas the time required for each cycle can be as fast as 400ns. Apart from program branches, which take two cycles, each instruction operates in one cycle. This means, at 10MHz, you can execute some 2,000,000 instructions per second. Many PIC chips support 40MHz now.
1024 x 14-bit 'words' of FLASH program memory - the PIC can handle 1024 program instructions, each consisting of 14-bit words. These instructions are downloaded into the FLASH memory, which retains the code - without power - for some 10,000 years. The code is serially programmed into the PIC via a hardware programmer.
68 x 8 bits of program RAM (SRAM) - your program can store 68 bytes of information in the standard SRAM included in the PIC package. This is enough for state variables, counters, constants, and other programming tools, but isn't enough to do serious data logging. To interfacing with additional memory, consult the MicroChip application note "TechBrief: Using SRAM with a PIC16CXX", here.
8-level hardware stack - The 8 x 13-bit hardware stack is implemented to store the program counter (PC) register when a function is referenced with the CALL command. The PC is "popped" off the stack when the function executes a RETURN, RETLW, RETFIE command. The user cannot otherwise access the stack. This means that your program have eight layers of functions without losing track of where it originally came from.
Timer0: 8-bit timer/counter with 8-bit programmable prescaler. It has features as follows:
 | 8-bit variables |
 | Read / write |
 | 8-bit programmable prescaler |
 | Internal or external clock |
 | Edge-rising or falling (external clock) |
 | Interrupt on overflow from 0xFF to 0x00 |
[Return to Top]
PIC Coding
While PIC programming can be simplified by using a C or BASIC compiler, or just assembly language. Microchip's MPLAB® IDE is one of the best Integrated Development Environments ("IDE") available for any micro controller and it is free. This ease of getting into the PICmicro MCU is unmatched by anyone else in the industry. The MPLAB application can be downloaded from Microchip's web site. The MPLAB IDE features the following:
 | MPLAB Project Manager
 | Organizes the different files under one 'project' |
 | nterfaces between the editor, assembler, linker, and simulator |
|
 | MPLAB-SIM Software Simulator
 | Features debug capabilities: unlimited breakpoints, trace, examine/modify registers, watch variables and time-stamp |
 | Simulates core functions and peripherals |
|
 | MPLAB Editor
 | Programmer’s editor to write and edit source files |
|
 | MPASM Universal Assembler
 | Has macro capabilities, conditional assembly |
 | Builds the HEX file (machine language) |
|
By far the most important component of the IDE is the integrated software simulator, which allows a designer to trace through their assembly code and watch the registers, RAM, ROM, and I/O ports.
Now you can write your code in assembly language, compile and link it to form the actual machine language, called a HEX file, and simulate the PIC running the code. There's a number of good tutorials included with the MPLAB IDE, and you should step through them until you're familiar with the user interface and the features of the development environment.
If you don’t like assembly, the PicBasic Pro Compiler is the easiest way for you to program the fast and powerful Microchip Technology PICmicro micro controllers. PicBasic Pro converts your BASIC programs into files that can be programmed directly into a PICmicro MCU. The PicBasic Pro Compiler features: BASIC Stamp II commands, direct and library routine access to pins on PORTA, C, D, E, as well as PORTB, arrays, real IF..THEN..ELSE and interrupt processing in BASIC.
The PicBasic Pro Compiler gives you direct access to all of the PICmicro MCU registers - I/O ports, A/D converters, hardware serial ports, etc. - easily and in BASIC. It automatically takes care of the page boundaries and RAM banks. It even includes built-in commands to control intelligent LCD modules.
The PicBasic Pro Compiler instruction set is upward compatible with the BASIC Stamp II and Pro uses BS2 syntax. Programs can be compiled and programmed directly into a PICmicro MCU, eliminating the need for a BASIC Stamp module. These programs execute much faster and may be longer than their Stamp equivalents. They may also be protected so no one can copy your code
The PicBasic Pro Compiler is a DOS command line application (it also works in Windows) and runs on PC compatibles. It can create programs for any of Microchip's PICmicro micro controllers and works with most PICmicro MCU programmers, including our EPIC Plus PICmicro Programmer. A printed manual and sample programs are included to get you started.
The PicBasic Pro Compiler can also be used inside Microchip's MPLAB IDE. This allows programs to be edited and simulated within Windows. More information is on the MPLAB page.
PicBasic Pro Compiler now has limited support for the 12-bit core micro controllers and BASIC source-level debugging.
 | True compiler provides faster program execution and longer programs than basic interpreters |
 | Direct and library routine access to any pin or register |
 | Automatic page boundary handling past 2K |
 | Bit, byte and word arrays |
 | Real If..Then..Else..Endif |
 | Hierarchal expression handling |
 | Interrupts in BASIC and assembler |
 | BASIC Stamp I and II library |
 | Built-in LCD support |
 | Oscillator support from 3.58MHz to 40MHz |
 | I2C instructions to access more external devices including serial EEPROMs |
 | In-line assembler and Call support |
 | MPLAB / MPASM / ICE compatibility |
 | Use in DOS or Windows |
 | Supports all Microchip PICmicro micro controllers |
 | Compatible with most PICmicro MCU programmers (see EPIC Plus PICmicro Programmer) |
If you want maximum compatibility with the BASIC Stamp I, or you would like to save a little money, or you just don't need all the extra features in PicBasic Pro, please take a look at the standard PicBasic Compiler.
[Return to Top]
Running the PIC
Once you’ve downloaded the PIC program, what’s next. Unfortunately, the PIC doesn't just work. It needs a couple of clock signals, power and ground connections, a pull-up resistor on the active-low reset pin, and a LED connected to the appropriate pin.
One way to clock the PIC is with a three-pin ceramic resonator. It's a cheap part, and plugs directly into the PIC clock_on and clock_off pins. Connect the middle pin of the resonator to ground, and the other two pins to pins 15 & 16 (PIC16F84) or pins 13 & 14 (PIC16F874). This is the "XT Oscillator" defined in the configuration bits of the code, or in the programmer settings. Other PICs offer internal resonators.
Download your particular PIC datasheet from MicroChip, and check the pinout. The +5V and GND connections will be on the same pins as was required by the programmer. The clock_in and clock_out pins will be defined in the pinout, and you can also find the pin0, portA connection for the flashing LED.
[Return to Top]

OOPic Overview
OOPic is an acronym for Object-Oriented Programmable Integrated Circuit. It is the first programmable micro-controller that uses an object-oriented language. The OOPic is more than just a programmable micro-controller; it's a Programmable Virtual Circuit! The Objects within the OOPic can be connected together to create a Virtual Circuit. This virtual circuit operates in the background as your program tends to other tasks. You programs can even be Event-Driven by tying programmed procedures into the virtual circuits to trigger interrupts. This alone makes the OOPic a great choice for robotic applications.
OOPics also include a built in network. An OOPic can be used as a stand-alone device, or it can be connected together with several other OOPics, Components and Computers via an I2C network created by Philips Corporation. This makes it key when wanting to do many tasks. Using the I2C network, OOPics can communicate with other OOPics, as well as other computers including a PC. The OOPic is programmed via a cable from the parallel port of your PC. The programs can be written in basic, C, or Java. The OOPic-R uses a serial cable. You need to install the free software that is downloaded from the OOPic site.
The OOPic R's biggest claim to fame is that it has a RS232 serial port, buttons and convenient hobby servo type connectors on it. It also has a separate built in I/O voltage regulator and a special motor connector for dual H-Bridge motor control. It also has some LEDs and a built-in speaker. Basically it's most of what you need for a robot all on the board, no soldering required.
The OOPic-R does not have a removable chipset, so to upgrade you must send it back to the factory for flashing a new firmware version on it. Also if you happen to damage the chip, the entire board must be replaced. The OOPic I, II, and II+ all use the type S board and the chipset can be replaced if damaged or if you want to upgrade.
This is the new OOPic C module. This small sized OOPic is aimed at the popular 24-pin sockets used by several microcontrollers expanding the OOPic's audience to individuals who already have hardware based on this 24-Pin system. The module comes packaged in a sturdy case. The OOPic-C board includes an RS232 serial port, 16 I/O pin configured within the 24-pin. Additional I/O lines are available at one end of the board, each has a solderable test point labeled with the I/O function. The OOPic-C board comes equipped with one socketed EEPROM, three indicator LED's, and the OOPic2+ firmware. The OOPic-C also comes without leads (leadless). Its the same as the OOPic-C except it has no leads (the LL stands for LeadLess). Without the leads your wires can be soldered directly to the OOPic. Great where weight or size is an issue! The OOPic-C is programmed with a serial cable and carrier board (sold with the starter package) and the free software that is downloaded from the
OOPic site.
PICs are remarkably durable. Shorting an output to ground or Vcc for a moment may not harm anything, doing it for 10 minutes may fry the output, but the rest of the chip is usually fine. Things not to do:
 | Connect power backwards (blows the regulator, but rarely the OOPic). |
 | Static zap (blows the OOPic, but rarely the regulator). |
 | pull more then 200mA from the regulator. (oopic "s" board) |
 | connect an output directly to ground |
 | connect an output directly to 5V. |
 | connect an output to something that has less then 330 ohms of resistance (covered by the two above) |
Rule 1: Check all connections thrice.
Rule 2: See rule one.
OOPic Memory
|
Program Code Space
|
RAM
|
EEPROM
|
|
Inside the EEPROM located in the E0 socket.
The OOPic ships with a 8K EEPROM. You can upgrade it to a 32K EEPROM.
We sell EEPROM
|
There are two types of memory inside the OOPic. Variables and object memory. The OOPic-R has a third kind also sbyte.
OOPic-R & OOPic II+
- objects = 96 bytes
- variables = 72 bytes
- sbyte = 256 bytes
OOPic II
- objects = 87 bytes
- variables = 72 bytes
- sbyte = 0 bytes
OOPic
- objects & variables = 87 bytes
|
The EEPROM in E0 is where the code is stored. You can save values to this EEPROM after the code space. On the local buss you can have 7 EEPROMs of the 32K size. The "S" style board has a second EEPROM socket installed for you.
The EEPROM has a limit of 32K because of the .location property is a word length. You can't set it for higher than 32K. Also the EEPROMs that are larger than 32K have a page_select pin. If you do not toggle this pin to the other state then you do not get the other half of the EEPROM space.
|
OOPic Website Links:
What's New
OOPic Object List
OOPic II+ Objects
OOPic II versus OOPic-R board specifications
OOPic-II Board Specifications
OOPic-R Board Specifications
OOPic Schematics
OOPic-R Schematic
http://www.oopic.com/i2cwpc.htm
Installing the OOPic Software (Free downloads from www.oopic.com)
1. If you are using windows NT, windows 2000 or XP you must Run Port95nt.exe which will install a Windows NT printer port driver (Port95nt.exe).
2. Run the latest numeric version of the install program by double clicking it in your windows explorer and install the installation instructions.
3. Your PC should now be ready to run the OOPic program.
4. For any problems with the installation the best source for information is :
http://groups.yahoo.com/group/oopic
OOPic Troubleshooting: (if you are having problems running and loading a program try these suggestions after following the above installation guide)
 | Make sure you have selected the correct target device: In the OOPic program go to options> target device> and change it to the match chipset you have. |
 | make sure the correct cable is connected to the back of the PC |
 | Ensure you have the correct address and cable type are selected under tools>cable configurations. You can obtain your address using the cable auto-detect or by going to you windows control panel and system configuration |
 | If you are using a NT machine windows 2000 or XP you need to install Port95nt.exe |
 | If you have more than one PC try installing it on another PC and see if you can get it to work |
 | To eliminate the SuperDroid programs, does this happen with the sample programs that were installed with the OOPic program usually under program files/oopic/samples? |
 | Sometimes the OOPic install removes the common dialog box. A remedy is on the CD under CD\OOPic Install\comdlg32. Install this only if you get a common dialog error. The download can also be found on the Yahoo board at http://groups.yahoo.com/group/oopic/files/Tonys_files/setup_comdlg32_ocx.exe |
 | When downloading to the OOPic-R if you receive the following message: |
>Expected: v
>Received:
The downloader was expecting "v" and got nothing.
This would happen if:
1. The serial port was configured for the wrong port.
2. The OOPic was not connected to the PC serial port specified.
3. The OOPic did not have power.
4. The OOPic was not working.
To check if the OOPic is working, look at the green EAC light by
the 8-pin EEPROM chip. If it is on, then the OOPic is getting power
and is running.
[Return to Top]

Parallax Basic Stamps
The Basic Stamp has been around a lot longer than the OOPic; hence there are more examples and support available for the Basic Stamps.

BASIC Stamps are small microcontrollers/PICs that run Parallax BASIC (PBASIC) programs. They have fully programmable I/O pins that can be used to directly interface to TTL-level devices, such as buttons, LEDs, speakers, potentiometers, and shift registers. And with just a few extra components, these I/O pins can be connected to non-TTL devices, such as solenoids, relays, RS-232 networks, and other high current/voltage devices.
BASIC Stamps are available in various physical packages, but all versions have the same logical design, consisting of a 5-volt regulator, resonator, serial EEPROM, and PBASIC interpreter. A tokenized PBASIC program is stored in the non-volatile serial EEPROM, which is read from and written to by the interpreter chip. This interpreter chip fetches the instructions one at a time and performs the appropriate operation on the I/O pins or internal structures within the interpreter. Because the PBASIC program is stored in an EEPROM, it may be programmed and reprogrammed almost endlessly, without the need to first erase the memory, as with many micro controllers. To program BASIC Stamp, you just connect them to an IBM PC or compatible (parallel port for the BASIC Stamp I, and serial port for the BASIC Stamp II and IISX) and run our editor software to edit and download your program.
The BASIC Stamp I has 8 I/O pins, holds 80 to 100 instructions and executes an average of 2000 instructions/sec. The BASIC Stamp II has 16 I/O pins plus two synchronous serial pins, holds 500 to 600 instructions and executes an average of 4000 instructions/sec. The BASIC Stamp IISX has the same number of pins as the II, except it executes 10,000 instructions/sec.
[Return to Top]