This is only a preview of the April 2007 issue of Silicon Chip. You can view 36 of the 104 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "Build A Jacob's Ladder":
Items relevant to "GPS-Based Frequency Reference; Pt.2":
Items relevant to "Programmable Ignition System For Cars; Pt.2":
Items relevant to "Dual PICAXE Infrared Data Communication":
Purchase a printed copy of this issue for $10.00. |
Introducing the
SPLat CC16
. . . the world’s lowest cost “industry-ready”
OEM controller!
By PETER SMITH
SPLat Controls, an Australian company that
produces a range of home-grown industrialstrength controllers, recently added the
credit-card sized ‘CC16’ to their line-up. This
new controller sells for less than $100 yet
includes many of the features of SPLat’s more
sophisticated controllers.
T
HE CC16 BOASTS 16 digital input/output (I/O) lines. All inputs
feature over-voltage protection and are
designed to work with industrial style
“NPN” type sensors. The outputs are
capable of sinking up to 400mA and
can directly drive solenoids, contactors and small stepper motors – so
for many applications, no additional
interfacing circuits are required.
Like all SPLat controllers, the CC16
utilises a proprietary programming
22 Silicon Chip
language. Unlike other controllers
that use C, BASIC or ladder logic, the
SPLat language was designed from
the ground up for industrial control
and is therefore exceptionally easy to
use. While it is possible to create rudimentary programs in minutes using
a subset of the SPLat language called
“Fast-track”, much more sophisticated
control functions can also be built
that include maths, state machines,
heuristics and look-up tables.
A major selling point of the controller is its multi-tasking abilities, which
are an integral part of the SPLat language. Up to 32 concurrent tasks coupled with an execution rate of about
15,000 high-level SPLat instructions
per second provide enough scope for
a wide variety of applications. Add
to that the large program memory
(approx. 12,000 instructions) and it’s
hard to imagine a job that these little
devices couldn’t tackle!
SPLat’s claim that their programming language is the “easiest in the
world” for embedded OEM applications piqued our curiosity. While
it might be easy for an experienced
programmer to use, how would someone with no programming experience
fare?
To learn more, we obtained a CC16DK Developer’s Kit which includes the
CC16 controller, a CD-ROM with PC
software and technical information, a
siliconchip.com.au
Fig.1: the CC16 features 16 digital input/
output (I/O) lines. Here’s the basic structure of
a single I/O line, showing how one input and
one output are connected together and brought
out to a single point. Each output is capable
of sinking up to 400mA, made possible by
ULN2803A high-voltage Darlington driver ICs.
When used as inputs, 330kW resistors divide
the applied voltage by two. The 330kW series
resistor also limits current flow in the micro’s
internal protection diodes to provide overvoltage protection. A logic low is specified as
0-3V on an input and a logic high as 7-32V. For
those interested, the complete schematic can be
downloaded from www.splatco.com.au – look
in “Outline drawings & other files” under the
“Support” section.
serial cable and five friction lock connectors for I/O and power hook-up. A
power supply is not included in the kit
but a plugpack or any DC supply that
can provide 10-24V will work.
Getting started
The first step is to install the Windows-based development software,
“SPLat/PC”. While we installed ours
from the CD, it is also available for free
download from www.splatco.com.
au. The software provides a means of
entering and testing your SPLat programs and includes a comprehensive
help system.
The serial cable mentioned earlier
connects the CC16 to a free serial
port on your PC, allowing SPLat/PC
to communicate with the controller
for debugging and programming.
USB-to-serial adapters are available
separately if your system lacks the
necessary port.
Once testing is complete, a couple
of keystrokes see a “tokenised” version
of your program uploaded to the flashbased memory in the CC16’s on-board
microcontroller. The controller is then
ready for use and can be disconnected
from the PC.
Note: for the technically curious, the
microcontroller embedded in all SPLat
controllers is factory programmed
with run-time firmware that interprets
and executes your tokenised program.
This means that your program is not
compiled to machine code; rather, it is
converted to a “shorthand” language
(and all comments stripped away) to
conserve space in the micro’s Flash
memory. SPLat provide free updates to
the on-board firmware as new features
siliconchip.com.au
are implemented. A simple system
called “reFlash” is used to apply the
updates to all later model controllers,
including the CC16.
When SPLat/PC is first launched,
a message appears encouraging you
to follow a “mini-tutorial”. This tutorial describes the basics of the system
and gives a rudimentary, hands-on
programming example. Let’s look at a
few of the simple examples given in
the tutorial to get an idea of how the
SPLat programming system works.
Programming
The Editor window opens immediately when SPLat/PC is started (see
Fig.2). This window functions as a
basic text editor, where you enter and
edit your SPLat program. It also acts as
the central control point for all other
functions. From within this window,
you can write your programs, test them
and then download them to the CC16
controller.
The program shown in Fig.2 makes
use of SPLat’s simplified Fast-track
instruction subset. It waits for input
0 to turn on (go to a logic “low” level)
and then turns on output 5. It then
waits for input 0 to turn off (go high)
again before turning output 5 off and
then looping back to the start.
Having entered this simple program,
we can then download it directly to
the controller and check if it works
as intended. However, unlike this
ridiculously simple example, most
real programs will have a few problems and will not operate as expected
without “debugging”.
This is where the real power of
SPLat’s development environment
comes in. We can step through our
program one line at a time, get it to
stop at any line we desire or run it
uninterrupted to help track down any
anomalies (Fig.3).
To see the state of the outputs, it’s
just a matter of opening the Input/
Output window from the toolbar
(Fig.4). This window (Fig.5) gives a
graphical representation of the state
of each output line in the form of a
graphical “LED”.
The Input/Output window also includes a graphical “switch” for each
input line, allowing the state of any input to be viewed and altered with just
a mouse click – so it’s easy to simulate
a real switch on any of the controller’s input lines. This enables you to
test and debug your program without
even having the real-word sensors or
switches wired to the controller!
Fig.2: SPLat/PC’s Editor window
looks a lot like Windows Notepad
and works in a similar fashion.
Here we’ve typed in a very simple
program (borrowed from the
mini-tutorial) using just a few
instructions from the Fast-Track
instruction subset. The operation
of the program is largely selfexplanatory (see text).
April 2007 23
Fig.3: once you’ve entered your program, you can use the
debugging functions on the Run menu to pause execution
at a particular line or to step through one line at a time.
This makes it much easier to track down bugs and is
invaluable as a training aid.
Fig.4: a whole host
of other windowed
functions can be opened
from the Editor’s
Window menu to assist
in the development and
debugging of a program.
In this short review, we
mention only the “Input/
Output” window (see
Fig.5).
A 64-pin MC9S08AW60 surface-mounted microcontroller IC (the
small square black device) accounts for the vast majority of the
CC16’s operation. All connections to the board are made via friction
lock connectors on a 2.54mm pitch. The four 6-way connectors on the
left side each carry four I/O lines, power and ground. The 3, 4 and
8-way connectors at the right and bottom sides provide for power
input, serial communications and I/O expansion, respectively.
As you’ve probably gathered by
now, SPLat/PC simulates the entire
operation of the controller; you don’t
even need to have the CC16 connected
to test your program! However, if it
is connected, the controller acts as a
“dumb” I/O device. This means that
input/output instructions executed in
SPLat/PC act indirectly on the controller’s port lines (albeit slower than in
real time), allowing in-situ testing and
debugging.
Using just 14 instructions that make
up Fast-track (see Table 1), we’ve no
doubt that just about anyone could
write a rudimentary SPLat program
in short order. And once you’ve got
those down pat (or if you’re already
a programming expert), you’ll be able
to build up your repertoire from some
24 Silicon Chip
400 instructions that make up the
complete instruction set!
Multi-tasking
Multitasking is a common requirement in industrial automation, so it
makes sense to build support for this
right into the programming language.
SPLat’s integrated multi-tasking capabilities are called “MultiTrack” and
are almost as easy to use as Fast-track!
Remember our programming example from Fig.2? Imagine for a moment
that this simple section of code controls a bottle capper on an assembly
line. What changes might be required
to drive a multi-headed capper, where
each head operates asynchronously?
Believe it or not, the necessary
program is barely more complicated
than the original, once we’ve added
a few MultiTrack instructions – see
Fig.6. Moreover, the program is easily
expanded to handle many more channels or other “simultaneous” tasks.
Don’t be fooled by the simplicity
of our example. MultiTrack can be
used to build sophisticated routines
with inter-task communication and
multiple 24-bit timers, with the latter limited only be available memory
space. MultiTrack also provides a useful framework for libraries of common
functions. According to SPLat, sample
library style programs will be available
in the future for a range of common
functions.
Expansion
If your application demands more
than 16 I/O lines, the CC16 is easily
expanded via its SPI-like serial bus.
SPLat offers a range of compatible
8-bit and 16-bit expansion boards,
one of which features eight heavyduty 20A relays and eight optically
isolated inputs.
Additionally, the CC16 supports the
industry standard Modbus protocol
and can act as a Modbus RTU slave.
Presumably, this would function over
the TTL level “Comms” interface, as
the low-cost CC16 doesn’t include an
RS232 interface.
Check it out
As mentioned earlier, SPLat/PC
siliconchip.com.au
Table 1: Fast-Track Instruction Set
WaitOn i
Wait for input i to turn on
WaitOff i
Wait for input i to turn off
WaitOnT i,tttt
Wait for input i to turn on, timeout after tttt x 10ms
WaitOff i,tttt
Wait for input i to turn off, timeout after tttt x 10ms
GoTo line
Go to line
GoIfT line
Go to line if the expected input did occur in the
preceding WaitOnT or WaitOffT instruction
GoIfF line
Go to line if the preceding WaitOnT or WaitOffT timed out
Pause tttt
Pause the program tttt x 10ms
On o
Turn on output o
Off o
Turn off output o
SetMem m,cc
Set memory location m to value cc
DecMGoIfNZ m,line
Decrement memory location m, go to line if the result is
not equal to zero
GoIfInOn i,line
Go to line if input i is on
GoIfInOff i,line
Go to line if input i is off
simulates the controller in software,
so you can use simple code examples
to learn more about the system even
without a controller attached. Note
that as the same software drives all
of SPLat’s controllers, you must first
specify the controller that you wish to
simulate. This is done via the File ->
Configure -> Board Type menu in the
Editor; simply choose “CC16” from
the drop-down list.
The on-line mini-tutorials (accessible from the Help menu) are definitely
worth a look too – they’ll have you
writing your own code in less than
a couple of hours! SPLat/PC can be
Fig.5: the Input/Output window
indicates the status of all of the
CC16’s output lines using graphical
“LEDs” and inputs using graphical
“slide switches”. Any input can be
simulated as high or low by altering
the respective switch position with
a mouse click. Inputs can also
be momentarily set (simulating a
pushbutton switch) by simultaneously
holding down the Shift key.
downloaded from www.splatco.com.
au.
Special offer
Until 31st May 2007, SPlat Controls are offering a very special deal
for SILICON CHIP readers interested in
purchasing the CC16 development
kit. To find out more, check out this
“special offer” web address: www.
splat-sc.com.
SPLat Controls design, manufacture
and support their products in Australia. They are situated in Seaford,
Victoria and can be contacted on (03)
SC
9773 5082.
Fig.6: multitasking is built into the
CC16 and it allows separate “slices”
of a program (in this case TaskA
and TaskB) to run simultaneously
and independently of one another.
Essentially, SPLat’s simple multitasking instructions allow less
experienced users to write more
sophisticated programs.
The CC16BB Breakout Board is a useful add-on device to have during development, as it provides convenient screw
terminal connections for power and all I/O connections, plus indicator LEDs on all I/O lines and DIP switches for
activating inputs. It simply plugs into the four I/O connectors on the CC16 board.
siliconchip.com.au
April 2007 25
|