The Flowcode 4 software from
UK-based Matrix Multimedia
simplifies programming tasks by substituting drag-and-drop flow-chart elements
for C-language code statements. This approach works well and can get engineers,
teachers and students off to a quick start with microcontrollers. So far, Matrix
Multimedia offers Multiprogrammer boards for MCUs in the Microchip PIC and
dsPIC families, and in the Atmel AVR and ARM AT91SAM7S families. The company
also supplies a large variety of E-Blocks hardware modules that attach to the
MCU boards. I enjoyed working with the Flowcode 4 software and PIC-based
hardware the company provided. This software and add-on hardware allows people to
create useful microcontroller programs and devices without forcing them to
learn C-language syntax; at least to start. They can do productive work right
away.
 |
The Flowcode software installed
easily from a CD-ROM, and Matrix Multimedia responded quickly by e-mail with an
installation code that let me run the Professional version of the software. The
accompanying PIC Multiprogrammer board took more time than expected to figure
out because the board's power connector doesn't indicate either the necessary
voltage or polarity. I discovered that polarity doesn't matter and the board
needs 13.5V from the power cube, which a voltage-output selector switch let me
choose. People should not have to dig deeply for this type of basic setup
information. They want to start quickly without fear of blowing out the
programmer board with an incorrect voltage or polarity.
The PIC Multiprogrammer came with
an 18-pin PIC16F88 installed and it can also accept 8-, 14-, 20-, 28-, or
40-pin DIP PIC MCUs. I connected the board to my lab PC and installed the
needed USB drivers. After that, I followed instructions in the "Getting
Started Guide" to create a simple program.
The user interface displays a
layout with a BEGIN and an END block already in place. When you drag a function
block and drop it between blocks it inserts itself in into the program flow. An
exercise in the "Getting Started Guide" explains how to select the
MCU you have in a socket, enter the MCU's clock frequency, select an output
port, set an output pin to a logic 1, monitor the state of that pin on the
screen, and download the program to the MCU chip. These steps went smoothly.
The Multiprogrammer board routes all MCU I/O ports to 9-pin connectors and the
board's two 40-pin male headers give you all of an MCU's signals.
Even without further instructions
I quickly set up an 8-bit binary counter in an endless loop and introduced a
short delay so I could see the count on an E-Blocks 8-LED board. Programming
can't get any simpler. At first I tried to use the statement MY_OUTPUT++ to increment the count, but Flowcode didn't recognize
that as a valid math operation. Remember, you don't use the C-language syntax
at the flow-chart level. The statement MY_OUTPUT = MY_OUTPUT + 1 did the trick. The Flowcode building blocks let
people write C-language code if they wish, but they put that code in special
blocks created just for that purpose. Flowcode comes with many blocks ready to
control MCU UARTs, external LCDs, and other add-on devices and circuits.
The flow-chart approach to
programming makes sense. Often I mistakenly type a semicolon after a C-language
if-else statement and it causes debugging problems, even
though I know where to look for my typing mistakes. With Flowcode, I move a
conditional-branch "diamond" into the program flow and think about
the condition to test, not my typing skills. You can still make mistakes in
program flow, use of variables, and an overall algorithm, but Flowcode takes
care of the syntax and simplifies moving blocks. That's a time saver.
Flowcode lets you examine the C
and assembly-language code it produces. The C code has comments, but they do
not carry over to the assembly-language listings. You can add comments to
Flowcode diagrams, though.
While looking through the
C-language counter-example code I noticed the MY_OUTPUT
variable has changed to FCV_MY_CODE, which I assumed meant a Flowcode variable (FCV). I tried
to create a C-language block but couldn't get it to work, probably because I
didn't properly define my variables via a Variables window I discovered after
working with Flowcode for a while. It might take me a bit more time to master
declaring and using variables in the Flowcode programming environment.
Next I imported a sample project
that used the PIC UART in a loop-back test. The resulting C code seems to cover
every UART configuration as well as several compiler types and options.
Thankfully all the pages of UART C code turn into only about 20
assembly-language statements. I had no idea what bit rate the UART used until I
measured it (9,600 bits/sec), but the chief technical officer at Flowcode got
me squared away. When you choose a function, such as a UART, flowcode
graphically represents that function at the bottom of the screen. Chick on that
graphic and you get to a window that lets you set parameters such as a UART's
bit rate. That's a nice way to change attributes without messing up Flowcode's
behind-the-scenes C functions.
While working with the UART on the
PIC16F88 chip I found several discrepancies between the MCU pin-function
diagram in the PIC Multiprogrammer data sheet and those shown in the Microchip
data book. Rely on the Microchip information. Also, the information that came
with the UART example did not explain what people should see when running the
UART program, so I put together another program and finally understood how to
program UART functions. The UART block will transmit or receive a character or
a string. But combining those actions in one block increases its C-language
complexity.
I downloaded the information in
"An Introduction to Microcontroller Programming," offered by Matrix
Multimedia in the online-training section of its website. Unfortunately, the
free version of this information does not include the lab exercises.
After experimenting with the UART
I removed the PIC16F88 chip and substituted a 28-pin PIC16F876A I had on hand.
The PIC Multiprogrammer board supplies high-quality sockets, but even so,
inserting this large chip took a lot of force. Consider using a
zero-insertion-force (ZIF) socket if you plan to program more than one or two
MCUs in one session. Although the board provides many sockets, you can only
program one MCU at a time.
The PIC16F876A MCU provides more
I/O pins than the 16F88, so I could connect an E-Blocks LCD module and drive it
from Port B. The display, pushbutton-switch, and other modules require a power
connection to the Multiprogrammer board, as shown in the photo. The LCD-control
block worked well and I used it to display information from a simple counter
program.
When I first tried to program the
16F876A I got a warning message, "Hex file has config2 word, but selected
chip does not." I clicked Yes to
continue and later discovered I hadn't reconfigured Flowcode - a simple
operation - for the new MCU type. The Flowcode software and E-Blocks hardware
provide an excellent way to start programming and create new devices without
the headaches of debugging C- or assembly-language code. Engineers can use the
Matrix Multimedia multiprogrammer boards or create their own boards and still
use the Flowcode 4 software to write programs.