How flowcharts and microcontrollers (PICs) are used in control systems

Part ofDesign and TechnologyElectronic and microelectronic control systems

Key points

  • Flowcharts use symbols like 'start', 'stop', 'decision', 'compare', and 'macro' to visually represent program logic.
  • Microcontrollers (PICs) are compact ICs that control inputs and outputs, used in various applications including robotics.
  • Bit patterns in flowcharts represent the binary states of input and output devices, showing how microcontrollers interact with the system.
  • Flowcharts help design and explain microcontroller programs, illustrating the sequence of operations and decision points.
  • Amplification, using transistors, is required when output devices need more power than a microcontroller can provide.
  • Microcontrollers are used in circuits with digital inputs and outputs, and these circuits can be designed and interpreted using flowcharts and bit patterns.
Back to top

Flowcharts, PICs and bit patterns

Drawing and analysing flowchart diagrams involves elements like count, compare, macro, do macro, end, increments, decrements, and expressions. Microcontrollers (PICs) are used in control systems, identified by their circuit symbols, and applied in robotic control.

Bit patterns show the states of input and output devices. Circuits with digital inputs and outputs are designed and interpreted, and amplification is needed to drive certain output devices from a PIC.

Back to top

Useful flowchart symbols

Flowchart start symbol - stadium shape
Image caption,
Start

Start

  • start is a cell that indicates the beginning of the flowchart program
  • is needed start the program
Flowchart start symbol - stadium shape
Image caption,
Start
Stop flowchart symbol - stadium shape
Image caption,
Stop

Stop

  • stop is a cell that signifies the end of the flowchart
  • if used, the circuit would need reset to allow the program to restart again
Stop flowchart symbol - stadium shape
Image caption,
Stop
Flowchart output symbol - trapezium
Image caption,
Output

Output

  • output is a cell that sends a signal to an output device to tell it to turn on or off
  • activates devices like LEDs, buzzers, or motors
Flowchart output symbol - trapezium
Image caption,
Output
Symbol for output in a flow chart
Image caption,
Output

Wait

  • wait is a cell that pauses the program for a specified amount of time
  • delays actions to allow for timing control
Symbol for output in a flow chart
Image caption,
Output
Flowchart decision symbol - rhombus shape
Image caption,
Desicion

Decision

  • decision is a cell that makes a choice based on a condition
  • directs the flowchart to different paths based on true or false conditions
  • example: has a push to make (PTM) switch been pressed? Yes or no?
Flowchart decision symbol - rhombus shape
Image caption,
Desicion
Flowchart compare symbol - rhombus shape
Image caption,
Compare

Compare

  • compare is a cell that checks if a specific condition is met by comparing two values
  • directs the flowchart based on whether the condition is true or false
  • example: is the temperature being read by a thermistor above 27 degrees Celsius?
Flowchart compare symbol - rhombus shape
Image caption,
Compare
Flowchart macro symbol - rectangle with two dashed lines at end
Image caption,
Macro

Macro

  • macro is a set of instructions grouped together to perform a specific task
  • simplifies the flowchart by grouping complex sequences into a sub-routine
  • the macro is activated by running the do macro command in the main flowchart
Flowchart macro symbol - rectangle with two dashed lines at end
Image caption,
Macro
Flowchart do macro symbol - rectangle with two lines at end
Image caption,
Do macro

Do macro

  • do macro is a cell that executes the instructions defined in a macro cell
  • allows the flowchart to perform grouped tasks as needed
  • allows the grouped instructions in a macro to be repeated whenever needed in the main flowchart
Flowchart do macro symbol - rectangle with two lines at end
Image caption,
Do macro
Flowchart end macro symbol - rectangle with two dashed lines at end
Image caption,
End macro

End

  • end macro is a cell that signifies the termination of the macro sub-routine running
  • indicates that the process has completed all necessary actions and should return to follow the main flowchart
Flowchart end macro symbol - rectangle with two dashed lines at end
Image caption,
End macro
Flowchart count symbol - rectangle
Image caption,
Count

Count

  • count is a cell that keeps track of the number of times an event occurs
  • increments a counter each time the event happens
  • could be used by a sensor to detect items going past on a conveyor belt
Flowchart count symbol - rectangle
Image caption,
Count
Flowchart increment symbol - rectangle
Image caption,
Increment

Increment

  • increment is a cell that increases the value of a variable by a set amount
Flowchart increment symbol - rectangle
Image caption,
Increment
Flowchart decrement symbol - rectangle
Image caption,
Decrement

Decrement

  • decrement is a cell that decreases the value of a variable by a set amount
Flowchart decrement symbol - rectangle
Image caption,
Decrement
Flowchart expression symbol - rectangle
Image caption,
Expression

Expression

  • expression is a cell that performs mathematical or logical operations on variables
  • calculates values or evaluates conditions within the flowchart
  • can be used with devices requiring calculated inputs, like variable resistors or digital displays
Flowchart expression symbol - rectangle
Image caption,
Expression

Example flowchart for a simple pedestrian crossing:

Example flowchart for a simple pedestrian crossing
Figure caption,
Flowchart for a simple pedestrian crossing
  1. Starts the flowchart.

  2. Checks the pedestrian crossing switch to stop the cars. If pressed, red light is on for 15 seconds and checks again for switch

  3. If the switch is not pressed, run amber flash macro five times.

  4. Turn on the green LED for 60 seconds

  5. Check if pedestrian crossing switch pressed, if not loop to keep green LED on for another 60 seconds.

  6. If pressed, switch amber LED on for 3 seconds

  7. Loop back to switch on the red LED for 15 seconds.

Amber flash macro

Flowchart for a macro - part of a simple pedestrian crossing
Figure caption,
Flowchart for amber flash macro: part of a simple pedestrian crossing
  1. Macro to run amber flash sub-routine
  2. Switch on amber LED
  3. Wait 05 seconds
  4. Switch off amber LED
  5. Wait 05 seconds
  6. End amber flash macro
Back to top

Microcontrollers

A microcontroller is a low power (5V), compact integrated circuit (IC) designed to run a program to control a range of inputs and outputs. It combines memory, processing units, and input/output interfaces in one chip.

Input devices - Microcontroller - output devices flowchart
Figure caption,
Systems diagram showing the microcontroller as a control device

Uses: microcontrollers can be used for various applications, such as household appliances, alarm systems, medical devices, vehicle systems, and electronic instruments.

Sizes: microcontrollers are available in different sizes, including 8-pin, 14-pin, 18-pin, 20-pin and 28-pin versions. The size determines the number of input/output connections and the complexity of tasks it can handle.

A collection of black microcontrollers of varying sizes and length of pins.
Image caption,
Microcontrollers in different sizes with varying numbers of pins
Symbol for a microcontroller
Figure caption,
Symbol for a microcontroller

Robotic control: in robotics, microcontrollers process sensor inputs and control actuators, enabling robots to perform tasks autonomously. They are crucial for the precise control and coordination of robotic movements.

Flowcharts: flowcharts are used to design and explain the sequence of operations in a microcontroller program. They help visualize the steps and decision points in the control process.
Other programming methods are available such as text-based programming languages (BASIC, C++ etc) or simple block-based programming editors.

A simple flowchart showing the process of a microcontroller
Figure caption,
A simple flowchart showing the process of a microcontroller

Bit patterns: bit patterns in a flowchart program represent the states of input and output devices using binary (1/on or 0/off), showing how the microcontroller interacts with other components in the system by switching them on or off at particular stages.

Illustration of the bit pattern for inputs and LED outputs
Figure caption,
Bit pattern for the circuit below

Bit patterns:

1 = ON
0 = OFF
x = Ignore/no change

zw9v239
Figure caption,
Circuit diagram with a microcontroller
Flowchart
Figure caption,
Flowchart describing the previous circuit

Can you describe how the circuit works?

Back to top

Amplification

Some output devices require more power than the 5V a microcontroller can provide

Examples include:

  • motors
  • relays
  • solenoids
  • buzzers

Amplifiers, such as NPN transistors, are used to boost the signal from the microcontroller to drive these high-power devices effectively. In the circuit diagram below, a transistor is being used to amplify the signal coming from the microcontroller to make the relay energise so that it can switch on the secondary 24V lamp circuit.

Circuit diagram with microcontroller as an amplifier
Figure caption,
Circuit diagram describing amplifier circuit with a microcontroller
Flowchart describing amplifier circuit with a microcontroller
Figure caption,
Flowchart describing amplifier circuit with a microcontroller

Can you describe how the circuit works?

Back to top

Test yourself

Back to top

More on Electronic and microelectronic control systems

Find out more by working through a topic