Home
Up

A view of KLB School from Wotton Hill - click to return to the website homepage

5.2.4 Software: Control Languages



Revision Points:
  • Candidates should be able to create instructions to respond to data from sensors;
  • Candidates should be able to write a sequence of instructions to control a screen image or external device such as lights, buzzers, sound or turtle, using repeated instructions, procedures and variables as appropriate;
  • Candidates should be able to identify typical applications involving the use of control and data logging software.

You are not expected to have a detailed understanding of programming languages at GCSE level. However, the exam paper is likely to have a question on using or interpreting Logo commands.


Control:

A typical model that might be controled using Control SoftwareControl technology is used to allow a computer to respond to data that has been captured or recorded using sensors.

An example would be a control system to maintain the correct conditions in a greenhouse automatically.

  • Sensors could measure the temperature and amount of light.
  • A control program would make decisions if the readings got outside a certain range.
  • Motors could open windows if the temperature got too high or switch on heaters if it got too low.
  • Motors could close blinds if the light was too much or relays could switch on lights if it was too dark.

The control program is a series on instructions written in a particular programming language. This language has commands to read input sensors, process the data in some way and make decisions and then control outputs such as motors, lights, relays etc.

Many control languages have the following additional features:

  • They can use and alter variables. This is a way of giving a number a label (such as A=12). The value of the variable can be easily altered (i.e. A = A + 1 would add 1 to whatever A was before) or used in a program in decisions (i.e. IF A >= 10 MOTOR OFF).
  • The can use LOOPS to make part of a program repeat until a certain condition is met
    (i.e.  REPEAT
             T = TEMPERATURE READING (from a sensor)
             UNTIL T = 90)
  • The can use procedures (or macros) . These a self-contained bits of program that are used for commonly repeated tasks in the main program. This avoids having the same bits of instruction coded repeated in lots of different places in one program.  A procedure is usually given a simple name by the programmer and then the main program uses this name to run it.

Types of Control Languages:

  • Command Line languages:
    • These use a wide range of different commands and they are usually typed into the computer line by line.
    • When the program runs it starts at the first line and then either moves through the program one line at a time or is directed from one set of instructions to another depending on the way the program is written.
    • The way the commands are entered has to be exactly right (this is called the SYNTAX) and it can take a long time to learn.
    • Unfortunately, many different control languages will use a different syntax to do exactly the same job.  For example:
Program 1 Program 2
REPEAT 10
T=TEMPERATURE
IF T>10 THEN END
END REPEAT
LOOP
T=TEMPERATURE
UNTIL T>10
END
  • Logo:
    • This is simple command line computer language that is usually used to draw shapes on a computer screen but it can also be used to move a motorised buggy or "turtle" around the floor.
    • Example Logo instructions:
      • REPEAT 4 [FORWARD 20 RIGHT 90 ]
    • These instructions would make the 'turtle' draw a square. It would repeat 4 times the commands to move forward 20 and then turn right 90 degrees.
  • Flowsheets:
    • An example of this is Logicator. To construct a program, commands are dragged and dropped onto a screen and connected by lines.
    • When the program starts it moves from one command to the next along the connecting lines.
    • The individual commands can be edited and include Input commands, output commands and decision commands etc.
    • Flowsheet programs are usually easier to follow than command line programs.

<Click to move to the top of the page>