Systems approach to Designing - Flowchart Programming

Copyright © A.F.Billington 2022. All rights reserved.

​​​​​​Mr BILLINGTON

Flowchart Programming

2

- START/END



- DECISION



- OUTPUT


- PROCESS


A ​microcontroller has to be programmed for it to carryout any processing within a circuit. There are two languages used in school to program, Basic, which is text based, and Flowchart, which is symbol based. Both can be downloaded to the flash memory on the microcontroller via USB and can be rewritten thousands of times to change its function


Flowchart programming uses a set of symbols to visually communicate the flow of information the microcontroller will receive. These symbols are translated into binary numbers by Circuit Wizard which can be understood by the chip. Binary is a series of 0's and 1's which are stored as 8-bit (8 numbers) inside the chips memory which is 10KB 


Each type of command is given a specific symbol as shown on the left. The symbol will denote how the software will convert the program into binary. The start/end command is as the names suggests, used at the beginning and end of a flowchart. The 'decision' command requires the microcontoller to consider a variable and decide if it is met (YES) or not (NO). The 'output' command requests the microcontroller to control an output signal, which can either be digital or analogue. Finally the 'process' command requires the chip to perform a calculation based on variables in the program

​----------------------------------------------------------------------------------------------------------

The 'decision' command is used in every flowchart as it requires the chip to react to input signals from components in the circuit. It can either check for digital signals or analogue depending on the command used


When checking for digital signals, mainly from switches, you must specify which inputs on the microcontroller to check and the state each should be to meet 'YES' to continue the flowchart. If not met, 'NO',  there must be an alternative route for the program to take


When checking for analogue signals only one input can be used and it must be one that is setup for this (A/D..). You must specify a range from 0-255 which will be the 'YES' criteria and the remaining range will be considered 'NO'. The number 255 is the maximum and therefore the highest voltage signal that can be received at the input. The value can be checked using the 'calibrate sensor' setting discussed later

----------------------------------------------------------------------------------------------------------

The 'Output' command is used to send a binary signal to any of the output pins (Q) on the microcontroller. The command will only send a 0 (no voltage) or 1 (voltage) via an output voltage of around 3V. You must specify which output pins you need to turn on by selecting  the green 1 state, and which you need to turn with the red 0. A time period can then be added for how long you require the outputs to be on/off in seconds


Importantly you must then use the output command to turn the outputs off or they will continue to be on for the remainder of the program

​​----------------------------------------------------------------------------------------------------------

Often in a program there maybe a repeating sectionof commands such as a flashing light pattern. If each command was to be connected one after another it would be inefficient and may take up too much storage. The 'While', 'For' and 'Until' commands can be used to create a repeating loop which can be set to repeat up to 255 times.


  • The 'while' command will ensure the loop continues whilst certain conditions are met regarding input signals or stored variable
  • The 'for' command will continue to loop for set period of time in seconds or a specified number of times from 1-255
  • The 'until' command will loop the program until a certain condition is met by either a changing input signal or stored variable. 


All of the command must have an 'end loop' at the end of the repeating sequence for the program to continue