Hamstack Getting Started Guide PDF
Hamstack Getting Started Guide PDF
HamStack
Microcontroller Project Platform
Welcome
Getting Started With the HamStack Microcontroller Project Platform
Special thank you to Robert Ralston, KJ6HFR, who contributed many edits and
improvements to this manual. Your contributions will be appreciated by all who
use it.
The HamStack community support web site is hosted on Yahoo Groups with a group
name of hamstack – http://tech.groups.yahoo.com/group/hamstack/
Microchip's web site for more info on the CPU chips, MPLAB, C18 compiler and
incircuit programming software – www.microchip.com
Swordfish Basic compiler website for basic language and compiler information and
general support forum – www.sfcompiler.co.uk
We believe all material in this document is correct and up to date. There is always a
chance that something was omitted or incorrect. If you find any errors or have
ideas of how to make the document better, please email us at
support@hamstack.com
Table of Contents
Introduction
3. Assembly Instructions
7. Mini-Projects
Temperature controlled fan
CW beacon controller
Appendix
-3-
Introduction
Over the last several years, we have built some very sophisticated, multi-CPU ham
radio projects using PIC microcontrollers. The power and flexibility of these
devices can be applied to many applications including repeater controllers,
beacon transmitters, keyers, antenna switches, battery monitors, etc. We had
several people ask us how to get started designing and building their own
microcontroller-based ham projects. As we thought about it, we asked
ourselves “what would the perfect platform look like?” We came up with the
following criteria…
As we looked around, it became obvious that nothing really met our requirements.
So, in typical ham radio fashion, we decided to build a platform that met our
criteria. We looked at various hardware devices, board form factors, language
compilers, etc. The result of that effort is a platform we call the HamStack.
The “ham” part of the name refers to the desire to target the platform to the
needs of the ham radio operator. The “stack” is a play on words that refers to
the physical design of the platform with its ability to stack multiple boards
together. Stack also refers to the “software stack” of libraries that are available
to make programming easier.
The HamStack is designed for the beginner and the experienced designer
For the more advanced user, the HamStack is a powerful hardware platform with a
high performance CPU, lots of IO and a variety of packaging options. You can
easily incorporate a HamStack CPU board into your own projects. Lots of
- 4 - access to all signals.
solder pads are provided giving you easy
People new to programming may prefer the easy to read Swordfish Basic language.
Advanced programmers can take advantage of the free Microchip C18 C-language
compiler for developing sophisticated programs. The HamStack library provides
added functionality to build really amazing applications without developing all of the
low level code from scratch.
How does the HamStack compare to the other hardware and software out there?
There will be the inevitable comparison between the HamStack and the Arduino, Basic
Stamp, PIC-EL or any of a dozen other platforms out there. There are many fine
products on the market and they all have their pros and cons. Some are proprietary,
some are very slow or very limited in memory space, some lock you into specific
software tools or languages and most have little or no design examples or software
tailored to the ham radio operator. Our goal is to make the HamStack a powerful, yet
easy to use platform, ideal for learning about and deploying microcontrollers in ham
radio projects.
We hope you enjoy using the HamStack as much as we enjoyed designing it.
’73
John, KJ6K
George, KJ6VU
-5-
Section 1
-6-
Hardware Reference
Architecture Overview
The HamStack is built on the 8 bit PIC 18F series of flash based microcontrollers from
Microchip. These powerful “computers on a chip” are some of the most popular
devices in use today. As a result there is a very large and growing community of
professional and hobbyist designers and programmers that you can draw on for ideas
and information. The heart of a project is the CPU board. The HamStack CPU board
contains the CPU chip, crystal, voltage regulator, RS-232 interface chip and
connectors. When building your own project, the CPU board can be embedded into
your project. For experimentation and extending the functionality of the CPU board,
you can add the prototype “backpack” board. This board stacks on top of the CPU
board and provides either solder pads or a reusable solderless breadboard block.
Pass through connectors allow multiple backpack boards to be stacked. The
backpack board is pin compatible with the Arduino shield boards. The CPU and
backpack boards can be stacked on top of the project board. This board provides
several convenient peripheral devices, connectors and sub-circuits. Many projects can
be built completely from the CPU and project boards alone.
Since the CPU is the heart of the HamStack, it is helpful to understand a bit more
about the chip itself and its IO pins.
-8-
Stacking interconnect bus and Arduino compatiblity
The HamStack establishes a standard physical PCB layout and electrical signal
assignments to the interboard connectors. This ensures hardware compatibility and
makes the re-use of modules very easy. Each pin in the stack has a specific purpose.
The hardware reference sections specify the exact pin assignment and what they are
used for. There are 7 interboard connectors. Four of them match the interboard
connectors of the Arduino Uno and similar boards. This means that you can take an
Arduino shield, like a relay board or a Zigbee RF module and plug it on top of a
HamStack CPU board and there is a good chance it will work. There are hundreds of
3rd party Arduino shield boards on the market and the HamStack will not be completely
compatible with all of them. The Arduino uses an Atmel CPU while we use a PIC so
there will be some differences on some boards. Having said that, we have mapped
the HamStack’s CPU IO pins as closely as possible to the Arduino pins so many
functions will be “plug and play”. Digital inputs, digital outputs, analog inputs, serial tx
and rx, I2C, and SPI pins should work on most boards. Of course, the Arduino
software is not compatible with the HamStack. However, many, if not all, Arduino IO
functions are available in either the Microchip C18 or Swordfish Basic compilers.
In addition to the 4 Arduino compatible connectors, there are two additional 8 pin
interboard connectors providing more IO. The seventh interboard connector is the
HamStack (PicKit compatible) in-circuit programming socket.
You will notice that there are two sets of solder pads for each interboard connector on
the CPU board. Each pin is duplicated on the board. This is done for two reasons.
First, the inner row of solder pads, those closest to the center of the PCB are used for
the vertical stacking of PCBs using the stacking interboard connectors. The outer row
of solder pads can be customized by the user. One use of these solder pads is to put
a set of female sockets on the bottom of the board to allow the CPU board to plug into
a larger “motherboard” that we call a project board” The project board spec uses male
header connectors to mate with the female sockets on the bottom of the CPU board.
The other use of the solder pads is to provide a place to solder wires directly to the
CPU board if you are embedding the CPU into your own project. You can choose to
solder wires to any IO pin, power and ground.
The HamStack comes with a 10 or 16 MHz crystal. The 18F4620 comes with a 10
MHz crystal and the 18F46K22 comes with a 16 MHz crystal. In both cases, the on-
board phase lock loop oscillator circuit (PLL) will multiply the crystal frequency by 4x.
This means that a 10 MHz crystal will clock your CPU at 40 MHz and the 16 MHz
crystal will clock the CPU at 64 MHz. You can also choose to clock the CPU at the
native (1x) crystal frequency but you might as well use the higher speed modes.
When you write your programs, you have the choice of what oscillator to use to clock
the CPU chip.
Most, if not all, of the examples in this book use the 18F4620 with a 10 MHz crystal
with the oscillator set to the native (1x) crystal frequency of 10 MHz. This is done to
keep the examples simple. We will explore how to use the 4x PLL mode in app notes.
-9-
Embedding the HamStack CPU into your own projects
The HamStack CPU can become the brain in your next ham radio project. When you
assemble the CPU board for embedding into your own project, you can use the IO
stacking connector sockets or make direct wire connections to the solder pads
provided. Installing the 6 pin programming jack will ensure that you can upgrade your
firmware in the future. Be careful not to exceed the current capability of the on-board
regulator.
!
Read Warning – Do not exceed the current capacity of the on-board regulator.
Me
The 78L05 5v voltage regulator on the HamStack CPU board can supply a maximum
of 100ma. The CPU board itself should consume less than half of that. Depending on
the input voltage, you can power one or two additional chips but that is about it. If your
input voltage to the CPU board is 13.8v and you are powering other devices with the
5v out of the CPU’s regulator, the device will get too hot. You can either reduce the
input voltage, to 6 or 7 volts or provide an external DC power source to the other
circuits.
The CPU board has a built in voltage converter chip that will match the (0/5v) level of
the CPU chip to the RS-232 voltage standard (+12v/-12v). The RS-232 signals are
present on J9, the 3 pin male connector and are also passed to two of the interboard
connector pins. The pins on the CPU board are Tx, Rx, ground when looking at the
connector from the edge of the board. To connect to a PC or other serial device, make
the following connections.
This configuration will plug into a male DB9 RS232 port on a computer or straight
through extension cable.
The reason we choose to put RS232 on the HamStack, rather than USB is that most
devices in the ham shack you would want to control use RS-232. It is also easier for
those new to programming microcontrollers to program a RS232 serial interface rather
than the more complex USB interface. If you want to add a USB interface to the
HamStack, that can be done as well but a different CPU chip will be required. For the
majority of ham applications, the RS232 interface is more useful.
- 10 -
CPU Board Pin Assignments
J6
J4 RS232
J2
Status
Power
Program Mode
Reset
Power
J5
J3
J1
J2-1 C0 (LED)
J2-2 PGD (Programming)
J2-3 PGC (Programming)
J2-4 B4
J1-1 User pin A J2-5 B3
J1-2 User pin B J2-6 B2
J1-3 RS232 Rx J2-7 B1
J1-4 RS232 Tx J2-8 B0
J1-5 E2
J1-6 A4
J1-7 C1 (PWM2) J4-1 Bias
Note
J1-8 C2 (PWM1) J4-2 Ground
In PCB version
J4-3 C3
1.0, J3-5 is not
J4-4 C5
connected to
J3-1 Reset J4-5 C4
ground. The pin is J4-6 A5
J3-2 3.3v
isolated. J4-7 D7
J3-3 5.0v
J3-4 Ground J4-8 D6
All later versions J3-5 Ground
are correct. J3-6 Voltage In
J6-1 D5
J6-2 D4
J5-1 AN0 J6-3 D3
J5-2 AN1 J6-4 D2
J5-3 AN2 J6-5 D1
J5-4 AN3 J6-6 D0
J5-5 RE0 J6-7 C6 (Tx serial)
J5-6 RE1 J6-8 C7 (Rx serial)
Gnd
Tx
Rx
- 11 -
CPU version 4b
- 12 -
CPU Board
Pin Assignments & Parts Placement Diagram
The CPU board is powered by the Remove jumper JP1 when Plug PICKit2 compatible
DEV-1 board so there is no need using the CPU board programmer into J9 or into
to plug a power supply into the DC plugged into the DEV-1 J5 on the DEV-1 board.
power jack board.
Some CPU pins are not used with the DEV-1 board including RC3, RC4, RC5,
and RD6. They are not pre-wired to any devices on the DEV-1 board. These pins
are available for the user to use for custom applications. Adding a stacking board
on top of the CPU board provides easy access these and all other pins. RC3 and
RC5 are the I2C bus which is very convenient for connection to all kinds of devices
including memories, sensors, IO expanders, etc.
J1-1 A User definable pin
J1-2 B User definable pin
J1-3 R2 RS232 UART1 Rx (Same as J9 pin 2)
J1-4 T2 RS232 UART1 Tx (Same as J9 pin 1)
J1-5 E2 CPU pin RE2, digital IO pin, or RS485 network control pin
J1-6 A4 CPU pin RA4, digital IO, and “Mode” button w/10k pull up
J1-7 C1/PWM2 CPU pin RC1, digital IO pin or PWM #2
J1-8 C2/PWM1 CPU pin RC2, digital IO pin or PWM #1
J2-1 C0/LED CPU pin C0, general IO pin and status LED, logic 1 = LED on
J2-2 PD CPU pin PGD. In-circuit programming pin
J2-3 PC CPU pin PGC. In-circuit programming pin w/ 10k pullup
J2-4 B4 CPU pin RB4, digital IO pin
J2-5 B3 CPU pin RB3, digital IO pin
J2-6 B2 CPU pin RB2, digital IO pin
J2-7 B1 CPU pin RB1, digital IO pin
J2-8 B0 CPU pin RB0, digital IO pin
J3-1 RST Pull this pin to ground to reset CPU. CPU MCLR pin #1 w/10k pullup
J3-2 3v3 3.3v DC supply rail output
J3-3 5v 5.0v DC supply rail output
J3-4 GND Ground
J3-5 GND Ground (Isolated on v1.0 PCB layout)
J3-6 Vin Input voltage. This is the external voltage input, typically 7.5 to 13.8 VDC.
J4-1 Bias Not used on the CPU board. Reserved for 2.5v DC supply rail
J4-2 GND Ground
J4-3 C3/SCK CPU pin RC3, digital IO pin, or SPI clock or I2C clock
J4-4 C5/SDO CPU pin RC5, digital IO pin or SPI data out pin
J4-5 C4/SDI CPU pin RC4, digital IO pin or SPI data in pin
J4-6 A5/SS CPU pin RA5, digital IO pin, or SPI select
J4-7 D7/Rx2CPU pin RD7, digital IO pin, or serial UART2 Rx pin (TTL level)
J4-8 D6/Tx2 CPU pin RD6, digital IO pin, or serial UART2 Tx pin (TTL level)
J5-1 AN0 CPU pin RA0, digital IO pin or analog input AN0
J5-2 AN1 CPU pin RA1, digital IO pin or analog input AN1
J5-3 AN2 CPU pin RA2, digital IO pin or analog input AN2
J5-4 AN3 CPU pin RA3, digital IO pin or analog input AN3
J5-5 RE0 CPU pin RE0, digital IO pin or analog input AN4
J5-6 RE1 CPU pin RE1, digital IO pin or analog input AN5
Inner pin
Board spacing
width for
2.3” Arduino Hole
shields
spacing
1.9” 2.1”
Hole spacing
2x O=0.125”
2.9”
- 15 -
Section 2
- 16 -
DEV-1 Development Board Features
OneWire PS2
Temperature Relay computer
RS232 Contacts
DC power in Probe jack keyboard Audio
7-14VDC output jack
Optional DS
temperature
Power LED sensor (not
supplied)
Speaker
Programming jack
Volume pot
IO Jumpers
HELLO WORLD
LCD Display
External A/D
converter input
CPU pin
Status LED
assignment
reference table 4x LEDs and push buttons Built-in AN0
Optional external connection Potentiometer
solder pads
DEV-1 Development Board
CPU Options
The DEV board can be used 2 ways. One option is to use the built-in solder pad
location for a 40 pin CPU chip. The other option is to leave the socket empty and
plug in a HamStack CPU board. The functionality is essentially the same.
The DEV board is supplied with a CPU chip (18F4620), a 40 pin socket and
associated components that will be installed next to the CPU chip.
You should install all these parts AND the CPU 40 pin socket.
If you are not planning on using a HamStack CPU board with your DEV board, at
least, not initially, you should assemble the whole board and plug the CPU chip
into the socket.
If you plan to use a HamStack CPU board that plugs into the HamStack
interconnect header pins, then you should install all parts EXCEPT the CPU chip
and then plug the CPU board on top.
Option 1 Option 2
Use the built-in CPU chip. Use a HamStack CPU board
HamStack
CPU Chip CPU
board
DEV-1 Development Board
Configuration Jumpers
These jumper blocks allow you disconnect some of the peripheral parts from the
CPU. This is a convenient way to free up extra CPU pins for use in your own
custom projects by simply removing the jumper shunts. The default configuration
is to install all jumper shunts for JU3 and JU4 and insert the JU2 jumper between
pins 1 and 2.
Audio Amplifier
+5V
R4
The audio amplifier takes the output of the CPU’s pin RC2, which has a hardware Pulse Width Modulator
output, and will shape the wave into a sine wave using the RC filter R8, R9, C11, C13. The raw filtered
signal is available at the 3.5mm jack J5. The audio then passes into an LM386 audio amplifier and to the
local speaker. The pot R21 is used to set the audio level. If fixed levels are needed, the user resistors R11
and R12 can be installed instead of the pot.
Note: components in the feedback loop, R13 and C10, are optional depending on the gain desired. The
default configuration includes C10 installed with a 10uf capacitor and a jumper wire in the R13 position.
Analog Input
External
Pot
Use jumper JU1 to select the analog
input. “Pot” connects the built in
potentiometer. “External” allows an
external voltage input. The analog to
digital converter (ADC) input can
measure from 0 to 5 VDC. This value is
+5v reported as a number between 0 and
1023.
RA0
+5v
+5v
OneWire RD7
Ground
CPU pin RD7 is used as the data pin for OneWire sensor devices. Typically used for sensors like digital
temperature devices, the OneWire interface connector J3 provides +5v, data and ground. There is also a TO-92
footprint on the PCB that can be used to install an optional DS18B20 temperature chip.
+5V
+5v
RA1
RA2
RA3
RA4
RE0
RE1
RE2
A
GND
RE0 Encoder A
RE1 Encoder B
RE2 Encoder push button
The rotary encoder has two outputs which creates wave forms
90 degrees out of phase. These signals are decoded to
produce a count up pulse or a count down pulse. For example,
if the last value was 00 and the current value is 01, the device
has moved one half step in the clockwise direction.
LCD and LED Displays
+5V +5V
RD5
RD4
RD3
RD2
RD1
RD0
JU4
RB3
RB2
RB1
RB0
RB4
SPDT Relay
The board includes a single pole double throw (SPDT)
relay. The relay control signal comes from CPU pin RB4.
When pin RB4 is high, +5v, it will turn on Q1 pulling the
collector of the transistor to ground. This will complete
the circuit allowing current to flow through the relay coil
and actuating the relay.
LED D8 will indicate when the relay is turned on.
Diode D5 is used to eliminate “counter EMF”. It’s the
voltage produced by the interaction of current in the coil
of the electromagnet its magnetic field, when one, or
both, is changing.
Power Supply
Section 3
Assembly Instructions
- 26 -
Assembling the DEV-1 Board
These assembly instructions are specifically for building the HamStack DEV-1
development board but the general principals apply to any of the HamStack boards.
For detailed assembly instructions of additional HamStack boards, refer to the
hardware manual for those boards.
- 27 -
Hardware Overview
The DEV-1 board provides several common hardware peripherals that are connected to a
HamStack CPU board plugged on top of the DEV-1 board. The connectors on the bottom of the
CPU board provide a path to the DEV-1 boards peripherals. This system is a handy platform for
software development and system prototyping.
Assembly
The DEV-1 board comes as a kit and can be easily assembled in an evening. While there is no
special s no special order of assembly we would recommend the following order.
Install the larger components including the connectors, speaker, encoder and knob.
This order is recommended because it allows you to put the lowest parts on first and ultimately the
heaviest components last.
Special notes…
LCD – The connection between the LCD and the circuit board is accomplished using wires
between the boards. Your kit includes 12” of buss wire that is cut into short pieces long enough to
connect a solder pad on the LCD board to the main PCB.
Encoder knob – Be careful when putting the knob on the rotary encoder to make sure you
don’t but the knob too low. The encoder includes a “button press” action and if you install the knob
too low, it will prevent the encoder “push button” from moving.
The input voltage to the board can be any DC voltage from 7-13.8 VDC.
Reference Designators Not On The Silkscreen
Some components on the board are not labeled with a reference designator. This
diagrams shows the proper placement of those parts.
J7, J8, J9 J7 J8 J9
- 29 -
Assembling the LCD Display Module
Install the two female SIP header sockets on the bottom of the LCD board. The
connectors will be pointing down.
Install two screws and standoffs on the bottom of the LCD PCB in the lower two holes.
HELLO WORLD
J10 J13 J14
J11
J15
HELLO WORLD
LCD PCB
7/16” Standoff
DEV-1 PCB
Nut
LCD PCB
Header connector
side view 7/16” Standoff
DEV-1 PCB
Nut
Side View
- 30 -
Builders Alerts
The builders alerts are important modifications that should be made to your DEV-1 board for
proper operation.
Bottom of
DB9
connector
□ Capacitor 0.047uf C1
□ Capacitor 10 uf electrolytic C11, C14
□ Capacitor 22 pf C12, C13
□ Capacitor 1 uf electrolytic C16, C17, C18, C19
□ Capacitor 0.022uf C2
□ Capacitor 0.1 C3, C4, C6, C9, C15, C20
□ Capacitor 330 uf electrolytic C5, C10
□ Connector 3.5mm stereo jack J1
□ Connector 8 pin female SIP connector J13
□ Connector 6 pin mini-DIN connector J2
□ Connector DB9-F J34
□ Connector 2.1mm DC coaxial power connector J4
□ Connector 1x6 pin female SIP connector J5, J16
□ Connector 1x8 pin female SIP connector J17
□ Connector 3 pin header right angle w/ ramp J6
□ Connector 1x8 pin male header J7, J8, J9, J10, J11
□ Connector 1x6 pin male header J13, J14, J15
□ Connector 1x2 pin male header JU1
□ Connector 1x3 pin male header JU2
□ Connector 2x4 pin male header JU3, JU4
□ Connector 2 pin pluggable terminal block P5
□ Connector 3 pin pluggable terminal block P6
□ Diode LED T1-3/4 RED D1, D2, D3
□ Diode LED T1-3/4 GREEN D4, D6, D7, D8
□ Diode 1N4148 D5
□ IC LM386 audio amplifier U1
□ IC 7805 +5v voltage regulator U2
□ IC PIC 18F4620 U5
□ IC MAX232 U7
□ IC Socket 8 pin DIP IC socket 0.3" U1-SOC, U4-SOC
□ IC Socket 40 pin DIP IC socket 0.6" U5-SOC
□ IC Socket 16 pin DIP IC socket 0.3" U7-SOC
□ Misc Rotary encoder with pushbutton ENC1
□ Misc Crystal insulator INS1
□ Misc Knob for rotary encoder KNOB1
□ Misc 2x16 LCD display LCD1
□ Misc 4-40 x 1/4" screw M1, M2, M3, M4, M5
□ Misc 4-40 nut M6, M7, M8
□ Misc Standoff, long M9, M10
□ Misc Jumper shunts QTY 10
□ Misc Speaker SPEAKER1
□ Misc Pushbutton SW1, SW2, SW3, SW4, S5
□ Relay SPDT 5v relay RY1
□ Resistor 10k Pot R1, R5, R19
□ Resistor 10 ohms R12, R20
□ Resistor 270 R14, R15
□ Resistor 270 resistor pack (5 resistors bussed) R17
□ Resistor 2.7k R18
□ Resistor 10k R2
□ Resistor 2.2k R3
□ Resistor 10k SIP resitor pack R4, R11, R13
□ Resistor 2k R8
□ Resistor 1k R9, R16
□ Resistor 10 MHz Crystal - 32 - Y1
□ Transistor PN2222 Q1
Assembling the CPU Board
These assembly instructions are specifically for building the HamStack CPU board but
the general principals apply to any of the HamStack boards. For detailed assembly
instructions of additional HamStack boards, refer to the hardware manual for those
boards.
Making the right decision now will save you potential headaches down the line.
All components are mounted to the top of the board. That is the side with the white
silkscreen lettering.
#1 DC Power Connections
The CPU kit includes both a 2.1mm coaxial DC power jack, the kind found on small AC
adapters. The kit also includes a two pin screw terminal block. You have the option to
install either of these connectors or solder wires directly to the PCB. As a general rule,
when embedding the CPU in your own projects, you would use the terminal block or
solder wires to the pads. If you are using the CPU board stand alone or with a
backpack board and want quick connect / disconnect of power, then you should use the
2.1mm DC power jack.
#3 Generally Speaking
Assembly is very straight forward but requires some basic soldering skills. If you are an
experienced builder, you can use the parts placement diagram as your guide and start
assembling the board. If you have never built an electronic circuit board, we suggest
you practice on another PCB to get the hang of it. There are many good resources on
the web to show you how to solder
- 34 -
CPU Board
Step by Step Assembly Instructions
and solder pin 1 first. Then solder pin 21. You now have one
Pin1
- 35 -
CPU Board Assembly – Continued
- 36 -
CPU Board Assembly – Continued
Place the socket into the holes on the PCB. Flip the
board over being careful that the socket does not fall
out. Now, solder one pin. Flip the board back over
and see if the socket is flush with the PCB and if it is
perpendicular to the board. The socket MUST be
flush and straight. Take you time. It is very
important to get these SIP sockets installed properly.
- 37 -
CPU Board Assembly – Continued
These six connectors are mounted on top of the PCB just like all the
other components so far.
When you look at the PCB, you will see two rows of solder pads for
every connector position J1 through J6. The inner solder pads are
used for these six sockets.
- 38 -
CPU Board Final Assembly
Congratulations !
- 40 -
Programming Software
As an open computing platform, the HamStack can support any development tool set
that is designed to support the 40 pin 18F series of Microchip CPU chips. Having said
that, we recommend the Microchip C18 C language compiler or the Swordfish Basic
compiler. To help those people new to programming with microcontrollers, we have
focused all the examples illustrated in this book on Swordfish Basic compiler. In
addition to the compiler tools, you will also need an incircuit programmer. The
HamStack USB programmer uses the Microchip PicKit2 programming software. A
dumb terminal program also helps debugging by providing an easy way to send data
back and forth between the CPU board and the PC.
We will focus in this book on the Swordfish Basic compiler because it is simple and
easy to start writing code and see results immediately. If you want to start learning C
for the HamStack, there are other documents on the HamStack website that will show
you how to get started.
Swordfish Basic
- Also a very powerful programming environment
- Simple, easy to use environment. You will be coding in just a few minutes
- The SE (Special Edition) version limits the maximum RAM variables to 256 bytes
- The upgrade to the commercial version has no restrictions
Ultimately, if you are scared off by the terse, obtuse C language syntax and all the curly
braces, then start with Basic. If you are comfortable with C and are willing to spend a
few evenings learning MPLAB then start with the C18 compiler. Either way, you have
great tools to use.
C18
basic
- 41 -
Introduction to Swordfish Basic
Swordfish is a highly structured, modular PIC® BASIC compiler for the PIC18 family of
PIC® microcontrollers. Swordfish is a true compiler that generates optimised, stand
alone code which can be programmed directly into the HamStack CPU board.
Extensive library support is provided with full source code, some of which include LCD,
GLCD, EEPROM, ADC, software and hardware SPI, software and hardware I2C,
software UART, USART, string manipulation, USB and math libraries. Support for
strings, arrays, structures, boolean, bit, unsigned and signed 8, 16 and 32 bit ordinal
types and 32 bit floating point is also provided. Swordfish is supplied with a powerful
and flexible Integrated Development Environment (IDE) which includes an advanced
code explorer, full syntax highlighting, third party programmer integration, serial
communicator and integrated boot loader application. Just a single mouse click, or key
press, will compile your program.
The HamStack comes with the free version of the compiler called Swordfish Special
Edition or Swordfish SE for short. The Special Edition has all the same features of the
full commercial version except that it can compile a program with a maximum of 256
bytes of RAM. Even with this limitation, you can develop significant applications. All
the examples in this book can be compiled with the SE version. If you need the full
RAM capacity of the commercial version, you can visit the HamStack web site to
purchase a copy.
Swordfish enables you to structure a program using subroutines and functions. Each
subroutine or function can have its own local declarations consisting of constants,
structures and variables. Procedural programming is a better choice than simple
sequential or unstructured programming, especially in situations which involve
moderate complexity or require significant ease of maintainability.
- 42 -
Typical screen shapshot of the Swordfish Integrated Development Environment (IDE)
Signed and unsigned ordinal, floating point, string and array constants
Boolean, bit, 8, 16 and 32 bit signed and unsigned, floating point, char and strings
Arrays and structures, including arrays of strings and structures
Alias and modifiers
Addressable EEPROM data constants
Conditional statements including if...then..elseif...else...endif and select...case
Repetitive statements including while...wend, repeat...until and for...next, break
Subroutines and Functions, support for local constants, structures and variables.
Inline subroutines and functions
Full support for passing by value and passing by reference.
Powerful frame recycling algorithm ensures optimal RAM usage
All constants and declaration types can be declared as private or public
Support for embedded assembler
Powerful hardware based interrupt support
Rich set of compiler directives including #ifdef, #constant, #variable, #define, etc.
Predfined subroutines and functions, including AddressOf, BitOf, Bound, Dec,
DelayMS, DelayUS, High, Inc, Input, Low, Output, Terminate and Toggle
Extensive library support is provided with full source code, some of which include LCD,
GLCD, EEPROM, ADC, software and hardware SPI, software and hardware I2C,
software UART, USART, Secure Digital (SD), string manipulation, math, interrupt based
RX and interrupt based timer libraries. Specific peripheral libraries are also included
with full source. Some examples include the DS18B20, DS18S20 and DS2405.
Comprehensive set of relational, mathematical and logical operators
- 43 -
Step by Step Instructions for Using the
Swordfish Basic IDE
After launching the Swordfish
Basic compiler IDE for the first
time, you are presented with an
empty text editor file. The IDE
assumes you will be using an
18F452 CPU chip.
As soon as you enter the device type, in this example, 18F4620, the compiler loads
the proper CPU parameters and updates the navigation bar on the left side.
Entering “clock = 10” tells the compiler that we are clocking the CPU at 10 MHz and to
adjust any timing specific behaviors accordingly. The 18F4620 can be clocked up to
40 MHz with the supplied 10 MHz crystal using the 4x clock mode called HSPLL (High
Speed Phase Locked Loop). However, all the examples use the native 10 MHz clock
to keep the examples simple
At this point you can compile your first program. Click on the “Build” button in the tool
bar. The compiler will generate the .hex file to be down loaded into the CPU chip.
This program won't actually do anything but you can see how the process works.
After compiling the program, the
After compiling, the screen looks like this... Results window will tell you how
much code you generated and how
much RAM will be used.
- 44 -
Swordfish Basic Compiler Commands
Swordfish Basic is a powerful structured Predefined Subroutines & Functions
programming language. Here are some of AddressOf
the types of constructs available. BitOf
Bound
Variables and data types Clear
Constants, array constants, variables, Dec
Boolean types, strings, char types, arrays, DelayMS
structures, unions, user types DelayUS
High
EEPROM Data Inc
Input
Conditional Statements Low
The If…Then Statement Output
The Select…Case Statement Terminate
Conditional Jump Toggle
Source code
' HamStack_blinky.bas
' Send a "Hello World" message and blink the status LED
- 46 -
Now lets look at what each command in this example does
Device = 18F4620
This command tells the compiler to generate code for a Microchip 18F4620. If you are
using another CPU chip, change the part number to match the CPU you are using.
Clock = 10
This command tells the compiler that the crystal oscillator is running at 10 MHz.
Include "usart.bas"
Swordfish Basic allows you to put commonly used program code into separate files that
can be inserted automatically at compile time. This makes your source code easier to read
and keeps you from accidently making changes to your library of good working
subroutines. To user the serial IO commands, you must include the “usart.bas” source
code file.
Dim x As Byte
Next, the variables used in the program are defined. Variables can be byte (8 bits), word
(16 bits), strings, etc. The command means “dimension variable named x as a byte”
TRISC.0 = 0
Next we need to define the behavior of the IO pins we are using. In this case, we are using
the pin PORTC pin 0, or “RC0” as we refer to it. The “TRIS” control register inside the CPU
controls the behavior and direction. If TRISC.0=1 then the pin is a digital input, if
TRISC.0=0 then its an output pin. Note that 0 is a zero.
X = 0
Here we initialize the variable to a value of zero. Although not necessary in our program,
its good programming practice to initialize all variables to avoid unexpected behavior.
SetBaudrate(br9600)
Sets the serial port baud rate to 9600.
Now that the setup is all done, we can get down to work. Most programs have a primary
control loop. The control loop typically reads a set of inputs, makes a set of decisions and
sets various outputs, then loops forever. In our case the control loop starts at a label called
“master_loop”
Inside master_loop, there is a For / Next block and a serial output command. The
basic control structure is simply a label, followed by some commands, then a jump back to
the master_loop starting point. This will cause the loop to execute forever.
- 47 -
Inside the master_loop is a for/next statement. This control structure is convenient for
doing something a certain amount of times. In our case, we want to blink the LED 10
times then send a serial port message.
For x = 1 To 10
High (PORTC.0)
DelayMS (500)
Low (PORTC.0)
DelayMS (500)
Next
For x = 1 to 10
This says that x starts out with a value of 1 and that all commands between this line
and the “Next” command will be executed 10 times.
High (PORTC.0)
Turns on output pin RC0, which is hooked to the anode of our status led that we want
to blink. When we say High, we mean put +5 volts on the output pin.
DelayMS (500)
Do nothing for 500 milliseconds.
Low (PORTC.0)
Turns off output pin RC0. This puts a value of 0 volts (ground) on the output pin thus
shutting off the status LED.
DelayMS (500)
Do nothing for 500 ms again.
Next
Go back to the last “For” command and start executing the code.
If the value of x as defined in the For statement is greater than 10, exit the for loop and
execute the next sequential command.
- 48 -
In-Circuit Programming
Now that your program is compiled and you have generated the .hex file, its time to
download the program into the CPU board. This is done using the HamStack USB
programmer and the Microchip PicKit2 programming software.
The idea is really simple. Once the software is installed, you plug the programmer into
the programming jack on the CPU or backpack board and go through these steps...
Installation
Download the latest version of the PicKit2 software from the Microchip web site or use
the version on the HamStack CD. Follow the simple instructions in the setup program.
When the software is installed, lets try downloading our firmware into the CPU.
Plug the HamStack USB programmer into your PC and launch the PicKit2 program.
- 49 -
Next, click on the “Erase” button to erase the contents of the program flash memory in
the CPU chip.
Now, open the .hex file. Select File / Import Hex then navigate to the file. In our
example the file is called HamStack_blinky.hex
Successful
import of the
.hex file
Now its time to download the firmware into the CPU chip. Click on the “Write” button
to download.
After successful
programming,
you will see this
message
- 50 -
HamStack In-Circuit Programmer
The connector on the end of the programmer's cable is a 6 pin female SIP connector.
The HamStack CPU board and backpack boards also have a 6 pin female SIP
connector. To connect the programmer to the CPU board or backpack, you will need a
6 pin male to male header adapter. This is included with the HamStack USB
programmer.
6 pin male / male header
Ribbon cable from
USB programmer
CPU or backpack
board with
programming
connector
- 51 -
HamStack In-Circuit Programmer
Pin 1 of the ribbon cable plugs into pin 1 of
the programming jack labled “M”.
M is the MCLR or reset signal for the CPU.
!
Read
Me
Remove or cut pin 2, the +5v DC power from the 6 pin programmer adapter header when
powering the CPU board directly and not from the programmer.
- 52 -
Section 4
- 53 -
Putting It All Together
Now lets walk through the process from start to finish. We will take the simple
example that illustrates the concepts of the control loop to blink the status LED and
send a message to the serial port. We will show the following steps in detail.
The Swordfish environment automatically inserts a default header of text at the top of
the file. You can edit this banner to include any text you want by going to View / Editor
Options / Program Header. You may want to go there now to enter your name and
any other info you want included in the very beginning of your programs.
- 54 -
To keep the comments to a minimum, we will delete the header comment block and
enter the following program.
Source code
Note:
This program assumes you have an
' My first program assembled HamStack CPU board
with the serial RS-232 cable plugged
Device = 18f4620 in and connected to your PC. If your
Clock = 10 PC does not have a RS-232 port you
can use a USB to serial RS-232
Include "usart.bas" dongle adapter.
Include "convert.bas"
x=0
SetBaudrate(br9600)
While true
x = x + 1
High (status_led)
USART.Write("Hello from HamStack #", DecToStr(x), 10,13)
DelayMS (500)
Low (status_led)
DelayMS (500)
Wend - 55 -
Step 2 – Compile the Program
Click the “Build” button to compile the program. This step will generate a .hex file that
will be downloaded into the CPU board.
At the bottom of the screen, the Results window will either list problems with the
program or show the “Compilation Success” window.
You must configure your “build” option before you compile any
!
programs.
Read
Me Select the little downward pointing triangle next to the “Build” button at
the top of the screen.
This tells the compiler to generate the .hex code but not to automatically download it
into your HamStack board. Then use the Microchip PicKit2 programming software to
do the firmware download into the CPU board.
You can always change this later if you use another programmer.
- 56 -
Step 3 – Downloading your program into the CPU chip
Make sure your HamStack USB programmer is plugged into your PC.
Then plug the programming ribbon cable into the HamStack board. Note the location
of the red wire on the ribbon cable. The pin on the red striped wire goes to the “M” pin
of the programming connector on the CPU board.
Red stripe
- 57 -
Launch the Microchip PicKit2 programming software.
Your screen should look like this...
If everything is working
properly, the PicKit software
should detect the CPU board
and report the type of CPU
chip it found.
Click the [Erase] button to erase the program from the CPU chip.
- 58 -
Now you should see the status window say “Hex file successfully imported.”
You can tell the file was imported because you can see the code displayed in the
“Program Memory” window.
All you have to do now is press the [Write] button and the program will be downloaded
into the CPU chip
If all goes well, you will see the message: “Programming Successful.”
- 59 -
4. Watch the LED blink monitor activity on the serial port.
Now, lets launch Termite, the terminal program to watch the serial data coming from
the CPU board.
Make sure the baud rate is set for 9600. Every computer is different so you will have
to figure out the right COM port. If you click the Port pull down menu, you will see the
available COM ports on your computer.
Then click [OK].
- 60 -
If everything is working properly, you should see the status LED blinking and text like
this in the Termite terminal window.
Now that you can see it all working together, this is a great time to experiment. Go
back to the source code and modify the program. Change the timing on the LED
delays, change the text in the serial output line, etc.
Take your new source code and run it through the whole process of compiling and
downloading a few times to get the hang of it.
The next step is to try some of the other examples in this book.
- 61 -
Section 5
Program Examples
- 62 -
Program Examples
These program examples are written for the standard HamStack CPU board and DEV-
1 development board. They are helpful to understand the basic hardware and
software development process using the HamStack and they can be combined to build
your own projects.
These examples use the native 10 MHz crystal frequency and not high speed PLL
mode. When making more complex projects, the PLL can be enabled to run the CPU
up to 40 MHz.
The HamStack CPU board also supports the 18F46K22 and newer CPU chips. The
standard HamStack CPU boards with these chips use a 16 Mhz crystal and can run at
64 MHz in 4x PLL clock mode. When using these faster chips, replace the first few
lines of each sample program in this section with the following code...
Device = 18F46K22 ' Assign CPU device type
Clock = 16 ' Set effective clock frequency
If you want to use the higher speed 4x PLL mode that can clock the chip at 64 MHz,
use this header...
- 63 -
Digital Output
Description Schematic
The simplest example of digital output is
blinking an LED. When a CPU output pin
goes high, logic state 1, the pin's voltage
is +5v. When the pin goes low, logic
state 0, the voltage at the output pin is 0
volts.
In this example output RBC toggles
between high and low logic states
blinking the LED.
Note: The CPU board already has the
status LED wired up to RC0. You can
just compile and load this program to see
it blink or add your own LED in parallel
witht the status LED and watch both
blink.
Notes
In the example above, the goto statement sends the program back up to the top to
create the loop. In the second example, the while statement performs the same task.
The Status LED on the HamStack CPU board is already connected to CPU pin C0.
This example will work with the HamStack CPU board by itself plugged into the DEV-1
board.
- 64 -
Digital Input
Description Schematic
GND
Device = 18F4620
Clock = 10
Dim button As Byte
TRISB.0 = 0 ' LED output pin
TRISA.1 = 1 ' Push button pin
LED LED LED LED master_loop:
button = (PORTA.1)'Read button
RB0 RB1 RB2 RB3 If button = 1 Then
High (PORTB.0) 'LED on
Else
Low (PORTB.0) 'LED off
EndIf
Switch Switch Switch Switch GoTo master_loop
RA1 RA2 RA3 RA4
Notes
- 65 -
Relay Control
Description Components
Device = 18F4620
Clock = 10
RB4 Dim relay As PORTB.4
Dim led As PORTC.0
TRISC.0 = 0 ' LED output pin
TRISB.4 = 0 ' Relay control
While true ' Do forever
High (relay) ' relay on
High (LED) ' LED on
DelayMS (500) ' Wait 500 ms.
Low (relay) ' relay off
Low (LED) ' LED off
DelayMS (500) ' Wait 500 ms.
Wend
Notes
When RB4 is set high, putting +5v on the pin, the transistor will turn on pulling the
collector close to ground. This causes current to flow through the relay’s coil actuating
the relay contacts. So a logic “1” will turn on this relay. In this example we will also turn
on the status LED to track the state of the relay.
- 66 -
Analog Input
Circuit
Pot
Description
Ext
An analog input pin can measure a DC
voltage between 0 and 5 volts. In this +5v
program, every 250 ms. we sample the
input pin AN0 which has been configured
as an analog input. Using the 10 bit A/D
converter in the CPU, the raw value of
the sample is between 0 and 1023 In
this example, sampled value is converted
to the voltage and sent to the serial port.
RA0
Device = 18F4620
Clock = 10
Include "usart.bas"
Include "ADC.bas"
Include "convert.bas"
- 67 -
RS-232 Output
example_serial_out.bas
Description Circuit
Device = 18F4620
Clock = 10
Include "usart.bas"
Include "convert.bas"
Dim x As Word
- 68 -
Using LCD Displays
Schematic
+5V +5V
RD5
RD4
RD3
RD2
RD1
RD0
- 69 -
Measuring Temperature with a DS18B20
Description Circuit
Device = 18F4620
Clock = 10
Include "usart.bas"
Include "DS18B20.bas"
Include "convert.bas"
- 70 -
Section 6
Mini Projects
CW beacon
- 71 -
Typical Program Structure
A complex Swordfish Basic program contains several sections. Most of these
sections must occur in a specific order to work properly. Here is the standard
program flow. Each section show one or two lines as examples.
4. Variable declarations
Dim x As Byte
Dim ainput0 As Word
5. Subroutines
Public Sub relay_on () High (relay) End Sub
9. Initialize variables
x = 0
- 72 -
Mini Project
Temperature Controlled Fan
Description
The program will also send the current sampled temperature out the serial port at 9600
baud.
Circuit
RD7
RB4
+12VDC
- 73 -
Mini Project
Temperature Controlled Fan
' fan_control.bas
Device = 18F4620
Clock = 10
Include "usart.bas"
Include "DS18B20.bas"
Include "convert.bas"
EndIf
- 74 -
Mini Project
CW Beacon
Description
This project shows how easy it is to generate CW. You set the cw_string variable to be
the text you want to send. The program will send that string in CW keying output RB4
which would be connected to a relay or an open collector output buffer transistor. The
program will send the string and loop forever.
Note: When the voltage is removed from a relay coil, an induced voltage transient may
be generated across that coil as its magnetic flux, which is linked by the coil
turns, collapses. This transient voltage spike can damage the transistor driving the coil.
To eliminate this spike, you can put a diode across the relay coils with the anode
connected to the ground side and the cathode connected to the voltage (+12v) supply
side.
RB4
- 75 -
Mini Project
cw_beacon.bas
CW Beacon
Swordfish Basic Code
- 76 -
Mini Project
CW Beacon
Select cw_char
Case "A" : cw_bits = ".-"
Case "B" : cw_bits = "-..."
Case "C" : cw_bits = "-.-."
Case "D" : cw_bits = "-.."
Case "E" : cw_bits = "."
Case "F" : cw_bits = "..-."
Case "G" : cw_bits = "--."
Case "H" : cw_bits = "...."
Case "I" : cw_bits = ".."
Case "J" : cw_bits = ".---"
Case "K" : cw_bits = "-.-"
Case "L" : cw_bits = ".-.."
Case "M" : cw_bits = "--"
Case "N" : cw_bits = "-."
Case "O" : cw_bits = "---"
Case "P" : cw_bits = ".--."
Case "Q" : cw_bits = "--.-"
Case "R" : cw_bits = ".-."
Case "S" : cw_bits = "..."
Case "T" : cw_bits = "-"
Case "U" : cw_bits = "..-"
Case "V" : cw_bits = "...-"
Case "W" : cw_bits = ".--"
Case "X" : cw_bits = "-..-"
Case "Y" : cw_bits = "-.--"
Case "Z" : cw_bits = "--.."
Case "0" : cw_bits = "-----"
Case "1" : cw_bits = ".----"
Case "2" : cw_bits = "..---"
Case "3" : cw_bits = "...--"
Case "4" : cw_bits = "...-"
Case "5" : cw_bits = "....."
Case "6" : cw_bits = "-...."
Case "7" : cw_bits = "--..."
Case "8" : cw_bits = "---.."
Case "9" : cw_bits = "----."
Case "/" : cw_bits = "-..-."
Case "=" : cw_bits = "-...-"
Case " " : cw_bits = " "
EndSelect
- 77 -
Mini Project
CW Beacon
' Now that all the dits and dahs are sent...
DelayMS(cw_time * 3) ' Delay the length of 3 dits
- 78 -
Section 7
8A relay module
- 79 -
Prototype Backpack Board
- 80 -
Prototype Backpack Board Options
A solderless breadboard
block can be attached to the
PCB providing a convenient
way to build and test new
circuits.
- 81 -
Prototype Backpack Board – Rev 1
The prototype backpack board is used to build custom projects and easily plug them on
top of the CPU board. Adding a solderless breadboard to the prototype backpack
board allows you to experiment with circuits before soldering them in place. The
prototype board has all the CPU IO pins brought up through stacking SIP connectors.
In addition there are also 3 LED and 2 push buttons. These extra components are not
connected to anything by default. The use of stacking connectors allow you to stack
multiple accessory boards on the HamStack. The physical dimensions and electrical
signals are compatible with the Arduino Uno and similar single board computers. While
there can never be 100% compatibility, most Arduino shield boards should be hardware
compatible with HamStack.
- 82 -
Prototype Backpack Board – Rev 1
In-circuit programming
jack connections
6 Ground pads
6 +5v power pads
Solder pads
connected together
Individual solder
pads not connected
to anything
Push button
jumper block LED jumper block
- 83 -
Prototype Backpack Board – Rev 2
- 84 -
Prototype Backpack Board – Rev 2
In-circuit programming
jack connections
6 Ground pads
Solder pads
connected together
Individual solder
pads not connected
to anything LCD Jack
Push button
LED connection
connection points
points
Pullup resistors
3 LEDs Resistor pack pull
2 Push buttons
down to ground
- 85 -
Backpack Prototype Board Assembly
When assembling the backpack board, the minimum components necessary are the
stacking connectors. These connectors provide all the power, CPU IO and other useful
signals from the CPU board to the prototype boards.
- 86 -
Backpack Solderless Breadboard
An option to prototyping new circuits is to use the solderless breadboard block. The
block comes with sticky tape on the bottom. Just peel off the paper and stick the block
to the prototype board. We recommend installing all the SIP sockets first to make sure
none of the holes are covered by the bread board block.
With these breadboard blocks, the five horizontal holes on each side are bussed
together. This allows easy placement of DIP components and other devices. Wire
jumpers are used to make the connections between the parts on the bread board and
the CPU IO pins that are brought up to the SIP header connectors on top of the
prototype backpack board.
When assembling the prototype board, the components you choose to install are
completely up to you. If you want to drill holes, add parts, do whatever you want. The
prototype board is made for experimentation and exploration.
- 87 -
Fully Assembled Breadboard
- 89 -
Dual 8A Relay Module
This relay module provides two single pole, double throw relays with a maximum current
rating of 8 AMPs. The relay 1 and 2 are connected to IO pins B3 and B2 respectively.
Setting the IO pin on the CPU to a high state will actuate the relay.
Connections are made to the relay board through screw terminal blocks or wires can be
soldered directly to the board.
The board is designed with an absolute maximum current capacity of 8A. If your
application will operate at the high end of the maximum current capacity, we
recommend that you add additional wire tack soldered to the bottom of the board to
ensure current spikes will not damage the circuit board traces.
The relays are rated well above the 8A maximum
1 – Use the supplied 12 volt relays and an external 12 volt power supply connected to
the +Vin screw terminal. This is a recommended method. Do not install any jumpers.
2 – Use the external +Vin from the CPU board. Assuming ther +Vin voltage is enough
to actuate the relay (~12 DC). The only dowside to this approach is that you will also be
powering the whole HamStack from the same supply. If you are using a lower supply
voltage, say +7.5v DC, this may not reliably actuate the relays.
3 – You can hack the board to use your own 5v relays. The jumper is provided to route
5v DC to the relays but you must make sure the relays don't draw too much current
- 90 -
8A Relay Module
The 8A relay module can be mounted to a chassis with the 4 screw holes or built into a
board stack. Due to the height of the relays, the 8A relay module must be the top
board when building a board stack.and only one board will fit on a stack at a time.
- 91 -
8A Relay Module
Front view
The relay contacts are brought out to
the front edge of the board. Each
relay's SPST connections are
represented by
NC – Normally closed
C - Common
NO – Normally open
The default wiring for control is from
RB3 to the left terminal block and
RB2 to the right terminal block.
Rear view
The terminal block on the rear of the
board is used to supply the coil
voltage for the relays. The supplied
relays are rated at a nominal 12v DC
to operate. They will engage as low
as 9v DC.
- 92 -
Serial to USB Adapter
The serial to USB interface converts the TTL signals from the CPU board to USB for
connection to a PC. When using the adapter, remove the MAX232 lever converter
chip on the CPU board.
- 93 -
Appendix
- 94 -
Prototype Backpack Board Rev 1 Worksheet
- 95 -
Prototype Backpack Board Rev 2 Worksheet
LCD
- 96 -
Component Identification Guide
- 97 -
Component Identification Guide
DC coaxial power jack Pushbutton
Momentary
contact
pushbutton.
Shunt RJ45
Tab up configuration
with built in LEDs.
Top view D
8 Amp power relay DS18S20
This power relay is designed to G V
Temperature sensor
switch medium power loads. Each V
using the DS OneWire interface in
set of contacts supports up to 8 G
Amps.
a TO-92 plastic case
D
100 uh inductor
This inductor is used in the switching
power supply.
- 98 -
Dec Binary Hex Char Char Dec Binary Hex Char Dec Binary Hex Char
0 0 0 NUL 32 100000 20 80 1010000 50 P
ASCII Table
1 1 1 ^A SOH 33 100001 21 ! 81 1010001 51 Q
2 10 2 ^B STX 34 100010 22 " 82 1010010 52 R
3 11 3 ^C ETX 35 100011 23 # 83 1010011 53 S
4 100 4 ^D EOT 36 100100 24 $ 84 1010100 54 T
5 101 5 ^E ENQ 37 100101 25 % 85 1010101 55 U
6 110 6 ^F ACK 38 100110 26 & 86 1010110 56 V
7 111 7 ^G BEL 39 100111 27 ' 87 1010111 57 W
8 1000 8 ^H BS 40 101000 28 ( 88 1011000 58 X
9 1001 9 ^I HT 41 101001 29 ) 89 1011001 59 Y
10 1010 A ^J LF 42 101010 2A * 90 1011010 5A Z
11 1011 B ^K VT 43 101011 2B + 91 1011011 5B [
12 1100 C ^L FF 44 101100 2C , 92 1011100 5C \
13 1101 D ^M CR 45 101101 2D - 93 1011101 5D ]
14 1110 E ^N SOH 46 101110 2E . 94 1011110 5E ^
15 1111 F ^O SI 47 101111 2F / 95 1011111 5F _
16 10000 10 ^P DLE 48 110000 30 0 96 1100000 60 `
17 10001 11 ^Q DC1 49 110001 31 1 97 1100001 61 a
18 10010 12 ^R DC2 50 110010 32 2 98 1100010 62 b
19 10011 13 ^S DC3 51 110011 33 3 99 1100011 63 c
20 10100 14 ^T DC4 52 110100 34 4 100 1100100 64 d
21 10101 15 ^U NAK 53 110101 35 5 101 1100101 65 e
22 10110 16 ^V SYN 54 110110 36 6 102 1100110 66 f
23 10111 17 ^W ETB 55 110111 37 7 103 1100111 67 g
24 11000 18 ^X CAN 56 111000 38 8 104 1101000 68 h
25 11001 19 ^Y EM 57 111001 39 9 105 1101001 69 i
26 11010 1A ^Z SUB 58 111010 3A : 106 1101010 6A j
27 11011 1B ^[ ESC 59 111011 3B ; 107 1101011 6B k
28 11100 1C ^\ FS 60 111100 3C < 108 1101100 6C l
29 11101 1D ^] GS 61 111101 3D = 109 1101101 6D m
30 11110 1E ^^ RS 62 111110 3E > 110 1101110 6E n
31 11111 1F ^_ US 63 111111 3F ? 111 1101111 6F o
64 1000000 40 @ 112 1110000 70 p
65 1000001 41 A 113 1110001 71 q
66 1000010 42 B 114 1110010 72 r
67 1000011 43 C 115 1110011 73 s
68 1000100 44 D 116 1110100 74 t
69 1000101 45 E 117 1110101 75 u
70 1000110 46 F 118 1110110 76 v
71 1000111 47 G 119 1110111 77 w
72 1001000 48 H 120 1111000 78 x
73 1001001 49 I 121 1111001 79 y
74 1001010 4A J 122 1111010 7A z
75 1001011 4B K 123 1111011 7B {
76 1001100 4C L 124 1111100 7C |
77 1001101 4D M 125 1111101 7D }
78 1001110 4E N 126 1111110 7E ~
79 1001111 4F O 127 1111111 7F •
- 99 -
Document Revision History
V1.1
Page 11, 12 - Noted on the CPU board revision 1, that J3 pin 5 should be
ground but is isolated.
V1.2
Various minor edits.
V1.3
Added prototype backpack rev 2.
V2.0
Several edits and minor corrections.
V3.0
Add DEV-1 board information.
- 100 -
CPU Board v1, v2, v3 Schematic
- 101 -
CPU Board V1, V2, V3 - Parts Placement
Parts List – Required Components J1, J2, J4, J6 Inner connector row 8 pin
female socket pointing up
C1 10uf electrolytic capacitor
J3, J5 Inner connector row 6 pin
C2, C3 0.1 uf capacitor (104)
female socket pointing up
C4, C5 22pf capacitor (22)
J7 3 pin male connector with tab
C6 0.1 uf capacitor (104)
J8 2.1mm DC power jack
C7, C8, C9, C10
J9 6 pin female socket pointing up
1 uf electrolytic capacitor
JP1 2 pin jumper and shunt
R1, R2 270 Ohm ¼ w resistor (270)
RN1 10k resistor pack (103)
Parts List – Optional Components
D1, D2 Red T1 LEDs
J1, J2, J4, J6 Outer connector row, 8 pin
S1, S2 Pushbutton switch
female socket pointing down
Y1 10 or 16 MHz crystal
J3, J5 Outer connector row, 6 pin
INS1 Crystal insulator
female socket pointing down
U1 78L05 5v voltage regulator
U2 CPU chip
U3 MAX232 RS232 level shifter IC
- 102 -
- 103 -