Cambridge AS & A Level9608

Monitoring and control systems

Computer Science 9608 Chapter Notes

What this chapter covers

Monitoring and control systems
ShareWhatsAppPost
Monitoring and control systems notes

Unable to load PDF

The notes viewer could not load. Please refresh the page.

Read online free. Download a watermarked copy with a free account.

Read the notes

The full Monitoring and control systems notes as text: skim, search, and jump between subtopics.

~11 min read

1. Monitoring vs. Control Systems

Understanding the difference between monitoring and control systems is fundamental. A monitoring system simply observes and reports on the state of an environment. It uses sensors to gather data about physical properties like temperature, pressure, or light levels, and then displays this information or logs it. It does not take any action on its own. Think of a patient's heart rate monitor in a hospital; it shows the heart rate but doesn't intervene. A control system goes one step further. It not only monitors the environment but also actively makes changes to it. It uses the data from sensors, compares it to a desired state (a setpoint), and if there's a difference, it uses actuators to take corrective action. A home heating system is a classic example: it monitors the room temperature and controls a boiler to maintain it.

Key term

Control System: A system that monitors an environment and automatically takes action to maintain or change the state of that environment based on sensor data.

Examiner insight

Examiners look for a clear distinction: monitoring is passive (observe and report), while control is active (observe, compare, and act).

Common pitfall

Simply stating that a control system 'controls things' is too vague. A good answer must mention that it takes action based on sensor input to maintain a desired state.

Worked example 12 marks

A weather station is set up to measure temperature, wind speed, and rainfall. The data is displayed on a website for public viewing. Is this a monitoring or a control system? Justify your answer.

  1. 1
    1. Identify the system's function: The system measures physical properties (temperature, wind speed, rainfall).
  2. 2
    1. Identify the system's output: The system displays the data on a website.
  3. 3
    1. Determine if action is taken: The system only reports the data; it does not take any action to change the weather (e.g., it doesn't start a fan to reduce wind speed).
  4. 4
    1. Conclusion: Since the system only observes and reports without taking action, it is a monitoring system.

Worked example 23 marks

An automated greenhouse is designed to keep the temperature at a constant 22°C. If the temperature drops, a heater turns on. If it rises, a fan turns on. Explain why this is a control system.

  1. 1
    1. Identify the monitoring component: The system uses a temperature sensor to monitor the greenhouse's internal temperature.
  2. 2
    1. Identify the control component: The system uses actuators (a heater and a fan) to change the temperature.
  3. 3
    1. Explain the process: The system compares the sensor reading to the desired setpoint (22°C).
  4. 4
    1. Explain the action: Based on the comparison, it takes corrective action by activating the appropriate actuator to bring the temperature back to the setpoint.
  5. 5
    1. Conclusion: Because the system monitors and then automatically acts to change the environment, it is a control system.

Recap

  • A monitoring system only gathers and reports data from sensors.
  • A control system gathers data and takes action using actuators.
  • Monitoring systems do not have actuators or a feedback loop to change the environment.
  • Control systems always include a comparison between the current state and a desired state (setpoint).

Quick check

  1. Give one example of a monitoring system and one example of a control system.2 marks

2. System Hardware: Sensors and Actuators

Monitoring and control systems are the bridge between the digital world of the computer and the physical world. This requires specialized hardware. Sensors are the 'senses' of the system. They are input devices that measure a physical quantity (like temperature, light, pressure, motion) and convert it into an electrical signal. Since computers only understand digital data, this signal often needs to be converted. An Analogue-to-Digital Converter (ADC) is used to change the continuous analogue signal from a sensor into a discrete digital value the microprocessor can read. Actuators are the 'muscles' of the system. They are output devices that take a signal from the computer and convert it into a physical action. Examples include turning on a heater, opening a valve, or spinning a motor. If the actuator requires an analogue signal to operate (e.g., to control the speed of a motor), a Digital-to-Analogue Converter (DAC) may be needed to convert the computer's digital output into an analogue voltage.

Key term

Sensor: A device that detects and measures a physical property and converts it into a signal that can be read by a computer or other electronic device.

Common pitfall

Confusing sensors (input) with actuators (output). Remember: Sensor = Senses (input), Actuator = Acts (output).

Fun fact

The airbag system in your car is a high-speed control system. An accelerometer (the sensor) detects a sudden deceleration, and the microprocessor triggers an actuator (a chemical charge) to inflate the bag in just 20-30 milliseconds.

Worked example 13 marks

A computer-controlled security light turns on when it gets dark. Identify the sensor, the actuator, and any necessary converter.

  1. 1
    1. Sensor: The system needs to detect the level of light. A Light Dependent Resistor (LDR) is a suitable sensor for this.
  2. 2
    1. Actuator: The system needs to perform an action to provide light. The actuator is the switch or relay that turns on the lamp (or the lamp itself).
  3. 3
    1. Converter: The LDR provides a continuous range of resistance (an analogue value). The microprocessor needs a digital value to compare against a threshold. Therefore, an Analogue-to-Digital Converter (ADC) is required between the sensor and the microprocessor.

Recap

  • Sensors are input devices that measure physical properties.
  • Actuators are output devices that cause a physical change.
  • An Analogue-to-Digital Converter (ADC) converts sensor data for the microprocessor.
  • A Digital-to-Analogue Converter (DAC) may be needed to control some actuators.
  • Common sensors include thermistors, LDRs, pressure sensors, and moisture sensors.
  • Common actuators include motors, heaters, lamps, solenoids, and speakers.

Quick check

  1. What is the function of an actuator?1 mark
  2. Why is an ADC often needed in a monitoring system?1 mark

3. Software, Feedback, and Real-Time Processing

The software is the brain of a monitoring and control system. It's responsible for reading data from sensors, processing it, and sending commands to actuators. A key feature of this software is that it runs in a continuous loop, often called an infinite loop (e.g., using `REPEAT...UNTIL FALSE` or `WHILE TRUE`). Inside this loop, the process is simple: read sensor data, compare it to a preset value (the setpoint), and if necessary, take action. This cycle is known as a feedback loop. The action taken by the actuator (the output) changes the environment, which is then measured by the sensor in the next cycle (the new input). This is called a closed-loop system, and it's what allows a control system to be self-regulating. The software must operate in real-time, meaning it must process data and respond quickly enough to effectively control the physical system. To prevent the loop from running too fast and overwhelming the processor or actuators, a time delay is often introduced at the end of each cycle.

Key term

Feedback Loop: A process in a control system where the output of an action is used as input for the next action, creating a self-regulating cycle.

Examiner insight

Marks are often awarded for explaining how the output from the system feeds back to become a new input, creating a self-regulating cycle. Use the term 'feedback loop' in your answers.

Worked example 14 marks

A central heating system is controlled by a microprocessor. The desired temperature is 20°C. The sensor reading is 18°C. Describe one cycle of the feedback loop.

  1. 1
    1. Input: The microprocessor reads the digital value from the temperature sensor via an ADC. The value corresponds to 18°C.
  2. 2
    1. Process: The microprocessor compares the input value (18°C) with the stored setpoint value (20°C).
  3. 3
    1. Decision: The software determines that 18°C is less than 20°C.
  4. 4
    1. Output: The microprocessor sends a signal to the actuator (a relay or valve) to turn the boiler on.
  5. 5
    1. Feedback: The boiler heats the water, which circulates and raises the room temperature. This new, higher temperature will be the input for the next cycle of the loop.

Worked example 22 marks

A program for a control system uses a loop `FOR i ← 1 TO 999999` at the end of each cycle. Explain the purpose of this loop.

  1. 1
    1. The loop does not perform any useful processing related to the control task.
  2. 2
    1. Its only purpose is to consume processor time, creating a delay.
  3. 3
    1. This prevents the main control loop from repeating too frequently, giving the physical system time to respond to the actuator's action before the next sensor reading is taken.

Recap

  • Control system software runs in a continuous, infinite loop.
  • The core process is: read sensor, compare to setpoint, actuate if necessary.
  • A feedback loop is where the system's output influences its next input.
  • Control systems must operate in real-time to be effective.
  • A time delay is often added to the loop to control the frequency of monitoring.

Quick check

  1. What is a 'setpoint' in the context of a control system?1 mark

4. Bit Manipulation for Device Control

At a low level, a microprocessor controls hardware by changing the values stored in specific memory locations or ports. Each bit in a special-purpose byte of memory can be wired to control a different part of a device. For example, in an 8-bit memory location, bit 0 could control a fan, bit 1 a light, bit 2 a pump, and so on. Setting a bit to 1 might turn the device on, while setting it to 0 turns it off. To control these devices, we need to manipulate individual bits without disturbing the others. This is done using logical bitwise operations, typically in assembly language. The main operations are: AND for checking or clearing bits, OR for setting bits, and XOR for flipping bits.

To SET a bit: `VALUE = VALUE OR MASK` (where MASK has a 1 at the desired bit position)

To CLEAR a bit: `VALUE = VALUE AND MASK` (where MASK has a 0 at the desired bit position)

To CHECK a bit: `IF (VALUE AND MASK) <> 0 THEN ...` (where MASK has a 1 at the desired bit position)

Key term

Bit Masking: Using a pattern of bits (a mask) with a bitwise operation to change or read specific bits in a byte or word.

Common pitfall

Using the wrong logical operator for the task, for example using OR to check a bit's status instead of AND. Remember: OR to 'add' a 1, AND to 'check for' a 1.

Worked example 15 marks

A device is controlled by the 8-bit memory location at address 1000. Bit 3 controls a motor (1=on, 0=off). The current value at address 1000 is B'11001010'. Write the assembly-like instructions and show the bitwise operations needed to turn the motor ON without affecting any other bits.

  1. 1
    1. Goal: Set bit 3 to 1. We must use the OR operation.
  2. 2
    1. Create the mask: To set bit 3, we need a mask with a 1 at bit position 3 and 0s elsewhere. Mask = B'00001000'.
  3. 3
    1. Load the current value: `LDP 1000` (Loads the value B'11001010' into the accumulator).
  4. 4
    1. Perform the OR operation: `OR #B'00001000'` (Performs a bitwise OR with the mask).
  5. 5

    11001010 (Current Value)

  6. 6

    OR 00001000 (Mask)

  7. 7

    ---------

  8. 8

    11001010 (Result)

  9. 9

    (Wait, the bit was already 1. Let's assume the initial value was B'11000010' to make it a better example).

  10. 10

    11000010 (New Initial Value)

  11. 11

    OR 00001000 (Mask)

  12. 12

    ---------

  13. 13

    11001010 (Result)

  14. 14
    1. Store the new value: `STO 1000` (Stores the result B'11001010' back into address 1000). Bit 3 is now 1, and all other bits are unchanged.

Worked example 24 marks

The device from the previous example is controlled by address 1000. We need to check if the motor (bit 3) is currently ON. The value at address 1000 is B'11001010'. Show the operation to check the status of bit 3.

  1. 1
    1. Goal: Check the status of bit 3. We must use the AND operation.
  2. 2
    1. Create the mask: To isolate bit 3, we use a mask with a 1 at bit position 3. Mask = B'00001000'.
  3. 3
    1. Load the value: `LDP 1000` (Loads B'11001010').
  4. 4
    1. Perform the AND operation: `AND #B'00001000'`.
  5. 5

    11001010 (Current Value)

  6. 6

    AND 00001000 (Mask)

  7. 7

    ---------

  8. 8

    00001000 (Result)

  9. 9
    1. Check the result: The result of the AND operation is not zero. This means the original bit must have been 1. Therefore, the motor is ON.

Recap

  • Individual bits in a memory location can be used to control separate hardware components.
  • Use the OR operator with a mask to set a bit (turn something on).
  • Use the AND operator with a mask to check the status of a bit.
  • Use the AND operator with an inverted mask to clear a bit (turn something off).
  • A mask is a bit pattern designed to isolate or modify specific bits.

Quick check

  1. Which logical operator is used to set a specific bit to 1?1 mark
  2. What is the 8-bit binary mask to isolate bit 5?1 mark

End-of-chapter exercise

Test yourself on the whole chapter. Work through these before moving on.

  1. Explain the difference between a monitoring system and a control system, using the example of a burglar alarm.4 marks
  2. An automated irrigation system for a farm needs to water crops when the soil is dry. Name one sensor and one actuator that would be required for this system and justify your choice.4 marks
  3. Describe the role of a feedback loop in a computer-controlled car cruise control system.3 marks
  4. A control system's software contains the line `UNTIL 1=0;` at the end of a REPEAT loop. Explain the purpose and effect of this line.2 marks
  5. Why is an Analogue-to-Digital Converter (ADC) essential for a system that uses a thermistor to monitor temperature?3 marks
  6. A microprocessor controls eight LEDs using the 8-bit memory location at address $F001. A value of 1 in a bit position turns the corresponding LED on. The current value is B'01010101'. State the bitwise operation and the mask required to turn on the LED connected to bit 6, without affecting any other LEDs.3 marks
  7. Following on from the previous question, show the result of the operation in binary after the instruction is executed.2 marks
  8. A system needs to check if a valve, controlled by bit 2 of memory location $C300, is open (bit value = 1). The current value at $C300 is 117 (denary). Show the calculation, using bitwise logic, to determine if the valve is open.5 marks
  9. A complex chemical process is managed by a control system. It must respond to pressure changes within 50 milliseconds. What is the term for this type of processing requirement, and why is it critical in this scenario?3 marks
  10. Design a pseudocode algorithm for a simple fan controller. The fan (an actuator) should turn on if a temperature sensor's reading goes above 25 degrees and turn off if it falls to 22 degrees or below. Your algorithm should run continuously.6 marks

Go deeper

Practise and revise with member-only material for this chapter.

Free notes are just the start.

Unlock every Workbook and Chapter at a Glance, and generate your own worksheets and predicted papers.

Explore plans

Related chapters