Creating Flow Diagrams in Logicator

Logicator is one of the easiest bits of programming software that you could hope to use. It is icon-driven which means you just need to click and drag icons onto the screen to build a flow diagram.

The first thing that you need to do when constructing a flow diagram is to sketch it out in rough first. Thinking it through and planning it on paper will save time and frustration later on.

Open PIC-Logicator. You will need to choose the type of PIC chip that you are programming. Go to ‘PIC’, ‘Select PIC Type’. If you’re not sure, then check with your teacher. It is likely that you will be using either PICAXE08M or PICAXE18X. To the right it shows you how many outputs and how many inputs the chip has. You can change the arrangement for PICAXE08M.

Every flow diagram has to begin with a ‘Start’ and you will notice that the kind software developers at Logicator have made sure that yours does too.

I will now go through a really simple flow diagram so that you can see the basic principles.

Drag the ‘Outputs’ icon into the cell below the ‘Start’ box. You now need to say which one of the outputs you are going to turn on (or off).

Double click on the ‘Output’ box and the Cell Details window should appear, with the word ‘Outputs’ highlighted in the ‘Optional Cell Label’ box. You can now re-title the box by typing ‘light on’.

This, of course, is not enough to guarantee that a light will come on. You need to choose the output pin to which the light is connected and then set that pin, or ‘Port’ as it is called to ‘1’. Note that you have the possibility of up to 8 output ports with PICAXE18 and up to 4 with PICAXE08.

For the purpose of this exercise we will say that the light is connected to pin 0. Click on the red ‘0’ to the left of port number ‘0’ and it will switch to a green ‘1’. Click ‘OK’.

Now drag the ‘Wait’ icon into the cell below the ‘light on’ cell. Double click on the cell and you will get the Cell Details window. You can now either type in the wait time (in seconds) or scroll down the list.

Choose ‘3’ seconds as a delay and click ‘OK’.

After this 3 second delay let’s turn the light off.

Drag an output icon into the cell below Wait, get the cell details on the screen and give this output cell the imaginative title of ‘light off’.

You will notice that all the outputs are showing ‘0’ or off which is what we want. Click ‘OK’.


Decision Boxes in Logicator

So far, so good, but we will now introduce an element to the flow diagram that responds to an input.

Drag a ‘Decision’ icon into the cell below the ‘light off’ output cell. You will notice that this icon is the shape used for decisions, ie. where the next step of the flow diagram depends upon a choice.

Double click on the ‘Decision’ cell to bring up the Cell Details. Give this cell the label ‘is switch 1 on?’

You now have to say which input pin or port the switch is connected to. Note that you have the possibility of up to 5 input ports with PICAXE18 (up to 4 with PICAXE08).

Let’s say that we have connected a push-button switch to pin 0 and that we want the decision box to do something when the switch is pressed (and therefore there is a current flowing to pin 0).

Click on the white ‘-’ to the left of input port number ‘0’ and it will switch to ‘1’. Click ‘OK’.

Now let’s imagine that when the switch is pressed we want the PIC chip to emit a sound. Unlikely, I know, but try it anyway.

The ‘Sound’ icon is towards the bottom of the list of icons on the right-hand side (it is possible that you may have to scroll down). Drag it into the cell beneath the ‘is switch 1 on?’ cell.

Double click on it for details. You need to establish 3 things. What pitch or note is going to play, how long it is going to sound for and what pin the speaker is connected to.

Clearly the speaker cannot be connected to output pin 0 because you will remember that earlier we said that a light was connected to it. Pick ‘pin 1’ and select any note and any time you fancy. Test it by clicking on the ‘Test’ button.

Repeat the previous steps, this time dragging a ‘Sound’ icon into the cell to the left of the ‘is switch 1 on?’ cell. Pick a different note and a different length of time but make sure that you keep the pin set to ‘1’.

Now drag a ‘Stop’ icon into the cell beneath the first ‘Sound’ cell.

The final thing that you will need to do is connect the cells. Right-click on the ‘Start’ cell and then move the cursor down to the ‘Stop’ cell. Repeat this process from the ‘Decision’ box to the ‘Sound’ and from ‘Sound’ back to ‘Light On’.

By clicking on the ‘Digital Panel’ icon, you can see the state of the inputs / outputs.

Click on the ‘Run Flowsheet’ icon to run your flow diagram.