DN Staff

April 12, 2011

6 Min Read
Coding Tool Goes with the Flow

The Flowcode 4 software fromUK-based Matrix Multimediasimplifies programming tasks by substituting drag-and-drop flow-chart elementsfor C-language code statements. This approach works well and can get engineers,teachers and students off to a quick start with microcontrollers. So far, MatrixMultimedia offers Multiprogrammer boards for MCUs in the Microchip PIC anddsPIC families, and in the Atmel AVR and ARM AT91SAM7S families. The companyalso supplies a large variety of E-Blocks hardware modules that attach to theMCU boards. I enjoyed working with the Flowcode 4 software and PIC-basedhardware the company provided. This software and add-on hardware allows people tocreate useful microcontroller programs and devices without forcing them tolearn C-language syntax; at least to start. They can do productive work rightaway.

Coding Tool Goes with the Flow

Coding Tool Goes with the Flow_A


The Flowcode software installedeasily from a CD-ROM, and Matrix Multimedia responded quickly by e-mail with aninstallation code that let me run the Professional version of the software. Theaccompanying PIC Multiprogrammer board took more time than expected to figureout because the board's power connector doesn't indicate either the necessaryvoltage or polarity. I discovered that polarity doesn't matter and the boardneeds 13.5V from the power cube, which a voltage-output selector switch let mechoose. People should not have to dig deeply for this type of basic setupinformation. They want to start quickly without fear of blowing out theprogrammer board with an incorrect voltage or polarity.

The PIC Multiprogrammer came withan 18-pin PIC16F88 installed and it can also accept 8-, 14-, 20-, 28-, or40-pin DIP PIC MCUs. I connected the board to my lab PC and installed theneeded USB drivers. After that, I followed instructions in the "GettingStarted Guide" to create a simple program.

The user interface displays alayout with a BEGIN and an END block already in place. When you drag a functionblock and drop it between blocks it inserts itself in into the program flow. Anexercise in the "Getting Started Guide" explains how to select theMCU you have in a socket, enter the MCU's clock frequency, select an outputport, set an output pin to a logic 1, monitor the state of that pin on thescreen, 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 theboard's two 40-pin male headers give you all of an MCU's signals.

Even without further instructionsI quickly set up an 8-bit binary counter in an endless loop and introduced ashort delay so I could see the count on an E-Blocks 8-LED board. Programmingcan't get any simpler. At first I tried to use the statement MY_OUTPUT++ to increment the count, but Flowcode didn't recognizethat as a valid math operation. Remember, you don't use the C-language syntaxat the flow-chart level. The statement MY_OUTPUT = MY_OUTPUT + 1 did the trick. The Flowcode building blocks letpeople write C-language code if they wish, but they put that code in specialblocks created just for that purpose. Flowcode comes with many blocks ready tocontrol MCU UARTs, external LCDs, and other add-on devices and circuits.

The flow-chart approach toprogramming makes sense. Often I mistakenly type a semicolon after a C-languageif-else statement and it causes debugging problems, eventhough I know where to look for my typing mistakes. With Flowcode, I move aconditional-branch "diamond" into the program flow and think aboutthe condition to test, not my typing skills. You can still make mistakes inprogram flow, use of variables, and an overall algorithm, but Flowcode takescare of the syntax and simplifies moving blocks. That's a time saver.

Flowcode lets you examine the Cand assembly-language code it produces. The C code has comments, but they donot carry over to the assembly-language listings. You can add comments toFlowcode diagrams, though.

While looking through theC-language counter-example code I noticed the MY_OUTPUTvariable has changed to FCV_MY_CODE, which I assumed meant a Flowcode variable (FCV). I triedto create a C-language block but couldn't get it to work, probably because Ididn't properly define my variables via a Variables window I discovered afterworking with Flowcode for a while. It might take me a bit more time to masterdeclaring and using variables in the Flowcode programming environment.

Next I imported a sample projectthat used the PIC UART in a loop-back test. The resulting C code seems to coverevery UART configuration as well as several compiler types and options.Thankfully all the pages of UART C code turn into only about 20assembly-language statements. I had no idea what bit rate the UART used until Imeasured it (9,600 bits/sec), but the chief technical officer at Flowcode gotme squared away. When you choose a function, such as a UART, flowcodegraphically represents that function at the bottom of the screen. Chick on thatgraphic and you get to a window that lets you set parameters such as a UART'sbit rate. That's a nice way to change attributes without messing up Flowcode'sbehind-the-scenes C functions.

While working with the UART on thePIC16F88 chip I found several discrepancies between the MCU pin-functiondiagram in the PIC Multiprogrammer data sheet and those shown in the Microchipdata book. Rely on the Microchip information. Also, the information that camewith the UART example did not explain what people should see when running theUART program, so I put together another program and finally understood how toprogram UART functions. The UART block will transmit or receive a character ora string. But combining those actions in one block increases its C-languagecomplexity.

I downloaded the information in"An Introduction to Microcontroller Programming," offered by MatrixMultimedia in the online-training section of its website. Unfortunately, thefree version of this information does not include the lab exercises.

After experimenting with the UARTI 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 azero-insertion-force (ZIF) socket if you plan to program more than one or twoMCUs in one session. Although the board provides many sockets, you can onlyprogram one MCU at a time.

The PIC16F876A MCU provides moreI/O pins than the 16F88, so I could connect an E-Blocks LCD module and drive itfrom Port B. The display, pushbutton-switch, and other modules require a powerconnection to the Multiprogrammer board, as shown in the photo. The LCD-controlblock worked well and I used it to display information from a simple counterprogram.

When I first tried to program the16F876A I got a warning message, "Hex file has config2 word, but selectedchip does not." I clicked Yes tocontinue and later discovered I hadn't reconfigured Flowcode - a simpleoperation - for the new MCU type. The Flowcode software and E-Blocks hardwareprovide an excellent way to start programming and create new devices withoutthe headaches of debugging C- or assembly-language code. Engineers can use theMatrix Multimedia multiprogrammer boards or create their own boards and stilluse the Flowcode 4 software to write programs.

Sign up for the Design News Daily newsletter.

You May Also Like