The WPS Model 01a Control Engine and
Model A1 Programmer Adapter and
progM01 host software.

Tom Jennings
9 June 2003

OVERVIEW

NOTE: This thing is obsolete. It made a lot of sense in 1998, but it's worse than redundant in 2006. Go buy an Arduino board for $29.

The Model 01a (aka M01a) is a 3" x 5.5" self-contained controller board designed for embedded applications. It's based around Microchip Inc's in-circuit-programmable 14-bit PICs, and contains I/O expansion, a power supply and various goodies that I found useful in five years of using my previous controller board design.

(downloads)

The Model 01a, Model A1 Programmer, and the progM01 host software work together as a system; refer to the progM01 man page for details.

The Model 01a, Model A1, progM01 host software, the hardware design, schematics and printed-circuit CAD/CAM files, are all Copyleft, and licensed under the GNU Public License.

You can use either PIC16F818 or PIC16F628A (1K program, 128 byte RAM), PIC16F819 or PIC16F627A (2K program, 224 RAM) or PIC16F648A (4K program, 256 RAM) in the Model 01a. The '818/'819 parts have an A/D converter instead of the comparator, a vast improvement over the '62xA parts.

Summary of Model 01a/Model A1 HARDWARE features:

Summary of Model 01a/Model A1 SOFTWARE features (but see the man page):

USING THE MODEL 01a

The M01 board contains enough support hardware to pull off a lot of functionality. Before I get to handling common interface problems here's a function-by-function description of the hardware. There's some subtlety to some of the design that's worth paying attention to.

(The photos show most of the board populated, but you can only populate the functional areas you'll need for a particular project.)

I/O PIN ALLOCATION:

The 16F819 (et al) have 18 pins, and a bewildering range of options that leave you with as many as 16 or as few as 6 usable I/O pins. The Model 01a necessarily makes some compromises, but ones I've found useful. Note that all eight port B (RBx) pins are preserved for user functions; some of port A is pre-assigned to peripheral strobes and such, via a jumper matrix with copper-trace defaults. Very few pins are not reassignable.

M01a card makes these assumptions:

With the external crystal you can run the serial port (UART) up to 230 kilobits/sec. Not bad for a $5 chip.

Here's the table of compromises the Model 01a makes, and the relative difficulty of changing that pin's default assignment:

pin default other fuction(s) reassignment hassle remarks
1 RA2 AN2/VREF 1
2 RA3 AN3/CMP1 1
3 RA4 T0CK1/CMP2 0
4 /MCLR/VPP RA5 4 Required for in-circuit programming
5 VSS n/a  
6 RB0 INT 0
7 RB1 RX/DT 0
8 RB2 TX/CK 0
9 RB3 CCP1 0
10 RB4 PGM 4 Low-voltage programming not used here
11 RB5 n/a 0
12 RB6 T1OSO/T1CKI/PGC 0
13 RB7 T1OSI/PGD 0
14 VDD n/a  
15 OSC2/CLKOUT RA6 2
16 OSC1/CLKIN RA7 2
17 RA0 AN0 1
18 RA1 AN1 1




Hassle level:
0 NONE: Built-in, labelled accomodation
1 EASY: In option-jumper matrix
2 EASY: Use existing component pad
3 Requires trace-cutting
4 Not possible with this design

And here's a detailed alternate view of the port/pin assignments, and a break out of the jumperable selects:

$Id: select-strobe.txt,v 1.1 2004/05/28 00:54:23 tomj Exp $
Tom Jennings


SELECT JUMPER AREA
.... indicates copper trace

SRC  ----O....O---- RA1
SRB  ----O....O---- RA2
SRA  ----O....O---- RA3
SCLK ----O....O---- RA4
RB5  ----O    O---- DAC
LED- ----O    O---- LED+
Vdd  ----O    O---- Vss (ground)


PIC PORT/PIN PREASSIGNMENTS
The following pins have preassigned functions, * indicates a
jumperable option, above.

        M01a    PIC
pin     signal  alt.    meaning
RA0     SD      AN0     serial data to SRs, DAC, hard to reuse
RA1     SRC*    AN1     cuttable trace default; analog comparator 1
RA2     SRB*    AN2     cuttable trace default; analog comparator 2
RA3     SRA*    AN3     cuttable trace default; analog comparator 3
RA4     SCLK*   T0CK1   cuttable trace default; timer0,
                CMP2    analog comparator
RA5     MCLR            not available
RA6     OSC2            xtal oscillator, reusable with effort
RA7     OSC1            xtal oscillator, reusable with effort

portB pins all available, but if onboard-PIC peripherals (UART,
etc) are used then the following Model 01a extras can be used:

RB0     INT             as input; use RB-U
RB1     RX              UART input; use RXD
RB2     TX              UART output; use TXD
RB3     CCP1            no particular Model 01a support
RB4     PGM             in-circuit programming, doesn't interfere
RB5     -               no alternate use
RB6     TIMER1          no particular Model 01a support
RB7     TIMER1, +       just RB-U7, but adjacent to RXD/TXD,
                        for use as CTS input or output


ONBOARD FUNCTION...     CONSUMES PINS... (worst-case)
analog comparators      RA0, RA1, RA2, RA3
UART                    RB1, RB2

SPECIFIC HARDWARE FEATURES -- ELECTRICAL CHARACTERISTICS

Before the software side (interface) is described, here's an overview of how the ports are arranged electrically.

OUTPUTS

Most PIC projects generate more output than they accept as input (but not always, see below), so the M01a provides expanded and direct outputs.

The PIC's port B (pins RB0 through RB7) are available directly, and are the easiest to use, and if you need 8 or fewer total inputs and outputs, and the unadorned PIC pin capabilities will do (eg. 25mA load at +5V), are all that you need to consider.

However, if you need higher-power outputs, or you need more than 8 - 10 output pins, consider using the built-in expanded outputs, PORTA, PORTB and PORTC, described below. These can be used in addition to the PIC RBx pins.

If you need more than 8 - 10 input pins, there are tricks to use the up to 24-bits of expanded output to examine 24 or more inputs.

DIRECT B IN/OUT (RB-U)

If you need simple PIC inputs or outputs, this is the port to use.

Each RBx pin is brought out to the card edge through a series resistor (array RN6). The series resistors is necessary for in-circuit programming, and it's good practice anyways to have current-limiting on PIC output pins. Each pin can of course be an input or an output, under software control.

Pin RB1 is brought out to RB-U twice; directly as above, but also via an additional series resistor R25, to allow simplistic PIC-style "RS-232" without the use of the RS485 chip, U15.

The pins in port RB-U are physically arranged in .1" rows that fit Berg or T &B Ansley type header connectors. The output pins, the extra RB1, previous paragraph, and a spare resistor in the array are in one row (10 pins), paralleled by 10 "common" pins; the commons can be jumpered to ground, or to the resistor array common.

BUFFERED OUTPUT FEATURES

All of the buffered outputs (PORTA, PORTB, PORTC, RB-B) have the same card-edge pinout; wiring is identical for all four ports.

The output signals are physically arranged in .1" rows that fit Berg or T ∧B Ansley type header connectors. The output pins, commutator, and a spare resistor in the array are in one row (10 pins), paralleled by 10 common pins; the commons can be jumpered to ground, or to the resistor array common. See USING BUFFERED OUTPUTS for details on use.

All of the buffered outputs use a Toshiba TD62083 open collector, high-power driver chip. Open collector (OC) outputs are very flexible, and are covered in detail in a separate section.

There is an optional resistor array jumperable as pullup (to +5V or external) or ground.

The Toshiba chip can handle 50V, 500 mA, and contain a commutating diode to damp the transient caused by relays and other inductive loads. They will directly drive neon lamps and Nixies (due to the peculiar physics of plasma discharge).

HIGH-POWER DIRECT OUTPUTS (RB-B)

These are simply the PICs RBx pins driving a Toshiba TD62083 driver chip, with the same features described in BUFFERED OUTPUT FEATURES.

If you need PIC outputs with additional drive capacity, use these. It's perfectly acceptable to use some RBx pins as inputs (via RB-U) and some as outputs (via RB-B or RB-U, or mixed).

24-BIT HIGH-POWER EXPANDED OUTPUTS

Up to 24 bits of additional output can be installed, in 8-bit increments. These are the same Toshiba TD62083 drivers, but driven by serial-in/parallel-out shift registers under software control. Since they use RAx pins to generate the output data, RBx pins can be used simultaneously for any purpose.

Shift register output is slower than RBx outputs, and exhibit glitching. It takes about 10 uS to output 8 bits to a shift register, and the output bits change rapidly while the 8 bits are sent to the shift register.

BASIC-callable library routines are provided with the M01a that conveniently drive the shift-register outputs at high speed.

This isn't the problem it appears to be in most practical applications. When driving passive components like lamps, relays, LEDs, Nixies, etc the output glitch is so brief as to be undetectable. Parallel-load devices, like parallel latches and such, almost always have a separate strobe input.

And when using the OC outputs to scan input switches, the "glitch" is a necessary feature; a "1" passes from output to the next output to scan/select an input.

These outputs have all of the features described in BUFFERED OUTPUT FEATURES.

RS-485 SERIAL PORT

The serial port uses a MAX488A Maxim RS-485 driver for PC- and Macintosh-compatible serial data. Though RS-232 specifies a bipolar voltage swing, in practice singled-ended outputs like this one work fine. The non-inverted input of the RS-485 receiver is grounded in copper, this could be cut and true RS-485 used to drive very long circuits.

This serial port will support the maximum PIC bit rate of 230,400 bits/sec. BASIC-callable library routines are provided.

DUAL DACs

Maxim D to A converter chip MAX515 (10 bit) or XXXXX (12 bit) can be used. This chip uses an external voltage reference, recommended is AN80xx, a 3-pin, TO-92 packaged device. Both DAC outputs, labelled X and Y, are brough out to an 8-pin header.

The DACs use RAx pins for serial data and strobe. Each DAC can be updated in approx 20 uS using the provided library routines. Using the AN80xx reference, the output range is 0 - +4.096 volts. Each DAC will drive a 10K ohm load, if more drive is needed use the opamps.

DUAL OP AMPS (OPERATIONAL AMPLIFIERS)

Two single standard-pinout internally compensated opamps are provided, in full trim. Each can be independently used as an inverting or non-inverting amplifier, voltage follower, integrator, bounder/clipper, slew limiting amp, etc. Refer to the schematic for details.

POWER SUPPLY

Power is via simple linear regulator of the TO-220 7805 type. There is a minimal amount of copper on the board for heat sink. The regulator fits under a corner mounting screw, and even a short aluminum standoff will provide added heat-sinking; additional heatsinking can be added with a standoff above the chip.

A full diode bridge, filter input resistor and capacitor let you use an unregulated AC or DC source.

USING BUFFERED OUTPUTS

The buffered outputs are open-collector transistor drivers. They only "sink" current, they cannot "source" it. PIC pins will sink (drive to ground) or source (output to a ground-connected load) 50mA.

Open-collector outputs are no liability, no added complexity, and a lot more flexible.

To drive simple current loads loads like LEDs, lamps, relays, etc you simply connect the load between the power supply and the output pin. The PIC itself is limited to 0 and +5V, but the buffered outputs are not: you can directly drive loads up to 50V.

For "logic level" outputs, tie a pullup resistor between the power supply and the output pin; the output will now swing from 0V to the power supply, anything up to 50V.

Note that relays and other inductive loads generate a big voltage spike that will ruin most output drivers; the voltage spike has the opposite polarity and can be much higher voltage; applying (for example) -75V to an output pin will likely ruin it.

The solution is a diode connected between the output pin and the power supply, such that the diode is non-conducting when the normal supply voltage is applied. When a reverse voltage is applied however the diode will conduct and absorb the transient (and turn it to heat).

The TD62083 drivers have built-in diodes, one per output pin. The cathodes are commoned, available on the output connector and ready to be connected to the appropriate power supply.









DOWNLOADS

Contact me if you need Gerber and drill files; I'm too lazy to exert the effort to export them until someone asks.

(Hmm, clicking the PostScript file links here in Galeon browser crashes X. Right-click them to save-to-disk and view them.)

I'll eventually bundle this junk into a tar and rpm, have patience.

The Model A1 files can be found in the Model A1 Programmer page.

Model 01 schematic PostScript format
test2.asm Embarrassingly ugly, beginnings of standard library in test form
PIC-BRG-calculator.xls BRG values for the recommended 18.432MHz crystal