Monitoring and control systems – A Level Computer Science (old syllabus, to 2021) (9608)
Question text
7
A large apartment block has 20 floors. On each floor there is one security camera and four sensors.
The image from each security camera is output to a display screen for that floor.
•
There are 20 display screens in the reception area on the lowest floor.
•
The data from the sensors are read and processed by a computer system.
•
Warning messages can also be displayed on each display screen.
(a) (i)
Identify the type of system described.
… [1]
(ii)
Justify your answer to part (a)(i).
…
…
…
… [2]
(iii)
Identify two types of sensor that could be used by this system.
State a reason for the use of each sensor.
Sensor 1 …
Reason …
…
Sensor 2 …
Reason …
…
[4]
(b) A program regularly checks each sensor’s readings. If the value of the reading is out of range,
a warning message is displayed on the screen for that floor.
A pseudocode algorithm to output the warnings has been written using these identifiers.
Identifier
Data type
Description
FloorNumber
INTEGER
Floor number
SensorNumber
INTEGER
Sensor number
Always
BOOLEAN
Value to ensure continuous loop
The pseudocode algorithm uses:
•
the function CheckSensor(Floor, Sensor) that returns TRUE if the sensor reading
is out of range and FALSE otherwise
•
the procedure ScreenOut(Floor, Sensor) that outputs the warning message
"Problem on Floor" to the appropriate screen.
(i)
Complete the pseudocode algorithm.
…
01 Always
02 REPEAT
1 TO …
03
FOR FloorNumber
1 TO …
04
FOR SensorNumber
05
IF CheckSensor(FloorNumber, SensorNumber)
06
THEN
07
ScreenOut(FloorNumber, SensorNumber)
08
ENDIF
09
ENDFOR
10
ENDFOR
11
12 // delay loop
13 // delay loop
14 UNTIL …
[4]
(ii)
Write a delay loop in pseudocode for lines 12 and 13 of the pseudocode algorithm.
…
…
… [2]
(c) If a sensor reading is out of range, a bit is set in a memory location allocated to that floor. The
addresses for the memory locations are 401 to 420.
For example, memory location 401 is used to store the status of the sensors 1 to 4 on floor 1,
memory location 402 is used t
Question text
8
A large car park has 6 floors.
There is a large screen at the entrance to the car park. This screen displays the number of empty
parking spaces on each floor.
•
There are 256 parking spaces for cars on each floor.
•
Each parking space has a sensor that detects if a car is parked on it.
•
Data from the sensors are read and processed by a computer system.
(a) (i)
Identify the type of system described.
… [1]
(ii)
Justify your answer to part (a)(i).
…
…
…
… [2]
(iii)
Identify two types of sensor that could be used by this system.
Sensor 1 …
Sensor 2 …
[2]
(b) A program regularly checks each sensor’s readings.
The number of empty parking spaces is displayed on the screen for each floor. If there are no
empty parking spaces on a floor, a message is displayed on the screen to show that the floor
is full.
The pseudocode algorithm to display this information has been written using these identifiers.
Identifier
Data type
Description
FloorNumber
INTEGER
Floor number
SpaceNumber
INTEGER
Parking space number
SpaceAvailable
INTEGER
Counts number of empty parking spaces
on a floor
ForEver
BOOLEAN
Value to ensure continuous loop
The pseudocode algorithm uses the function CheckSpace(Floor, Space). This function
returns TRUE if the parking space is empty and FALSE otherwise.
(i)
Complete the following pseudocode algorithm to check the number of parking spaces
available.
…
01 ForEver
02 REPEAT
1 TO …
03
FOR FloorNumber
0
04
SpaceAvailable
1 TO …
05
FOR SpaceNumber
06
IF CheckSpace(FloorNumber, SpaceNumber)
07
THEN
SpaceAvailable + 1
08
SpaceAvailable
09
ENDIF
10
ENDFOR
11
IF SpaceAvailable > …
12
THEN
13
OUTPUT "Floor ", … ,
" empty parking spaces " …
14
ELSE
15
OUTPUT "Floor ", … , " full"
16
ENDIF
17
ENDFOR
18
19 // delay loop
20 // delay loop
21 UNTIL …
[6]
(ii)
Write a delay loop in pseudocode for lines 19 and 20 of the pseudocode algorithm.
…
…
…
… [2]
(iii)
State why a delay loop is used in this system.
…
… [1]
(c) When a car is parked in a parking space, a bit is set in the appropr
Question text
7
A company has a number of lorries that deliver items around the country. The items in each lorry
are its load. Each lorry has a monitoring system that provides information to the driver about the
state of the load and other data from each trip.
•
Data is stored in three memory locations with addresses 801 to 803.
•
Location 801 contains the distance travelled in kilometres for the current trip, stored as a
binary integer.
•
Location 802 contains the quantity of fuel used in litres for the current trip, stored as a
fixed-point binary number with six places before the binary point and two places after the
binary point.
•
The four most significant bits of location 803 are flags used to identify problems with the load,
for example it is too heavy. A flag is set to 1 if there is a problem, or 0 if not.
The problems are:
•
Bit 7 – load too heavy
•
Bit 6 – load too high
•
Bit 5 – load unstable
•
Bit 4 – load not secured (risk of the load falling off)
•
Bits 0 to 3 are not used
(a) The current contents of addresses 801 to 803 are:
Most significant bit
Least significant bit
0
1
1
0
1
1
0
0
801
0
0
1
0
1
0
0
1
802
0
0
1
0
0
0
0
0
803
State the information that the current contents of addresses 801 to 803 will provide to the
driver.
…
…
…
… [3]
(b) A lorry has a load that is too heavy and is not secured. It has travelled 120 kilometres and
used 35.25 litres of fuel.
Complete the contents of the addresses to record this information.
801
802
803
[3]
(c) The following table shows the instructions for the lorry load monitoring system in assembly
language. There is one general purpose register, the Accumulator (ACC).
Table 7.1
Instruction
Explanation
Label
Op code
Operand
LDM #n
Load the number n to ACC
Load the contents of the location at the
LDD <address>
given address to ACC
Store the contents of ACC at the given
STO <address>
address
Bitwise AND operation of the contents of
AND #n
ACC with the operand
CMP #n
Compare the contents of ACC with number n
Following a compare instruction, jump to
JPE <address>
<address> or <label> if the compare was
True
JMP <address>
Jump to the given address or label
<label>:
<op code> <operand>
Labels an instruction
Note:
# denotes immediate addressing
B denotes a binary number, for example B01001010
& denotes a hexadecimal number, for example &4A
(i)
Write assembly language instructions to set the contents of addresses 801 and 802 to
zero, and set all four most significant bits of the contents of address 803 to one.
Use the instruction set from Table 7.1.
…
…
…
…
…
… [3]
(ii)
A program written
Question text
8
A car monitoring system provides information to the driver about the car’s performance and alerts
the driver to possible problems.
•
Data about the car’s performance is stored in three memory locations with addresses 601 to
603.
•
Location 601 contains the distance travelled in kilometres for the current trip as a binary
integer.
•
Location 602 contains the quantity of fuel used in litres for the current trip, as a fixed-point
binary number with 5 places before the binary point and three places after the binary point.
•
The four least significant bits of location 603 are flags used to identify problems with the car,
for example, the fuel is low. A flag is set to 1 if there is a problem, or 0 if not. These problems
are:
•
Bit 0 - high engine temperature
•
Bit 1 - low oil pressure
•
Bit 2 - low battery
•
Bit 3 - low fuel
•
Bits 4 to 7 are not used
(a) The current contents of addresses 601 to 603 are:
Most significant
Least significant
0
0
1
0
1
1
0
0
601
0
0
1
0
1
0
0
1
602
0
0
0
0
0
1
0
0
603
State the information that the current contents of addresses 601 to 603 will provide to the
driver.
…
…
…
… [3]
(b) A car has low oil pressure and low fuel. It has travelled 80 kilometres and used 7.25 litres of
fuel.
Complete the contents of the addresses to record this information.
601
602
603
[3]
(c) The following table shows the assembly language instructions for the car performance
monitoring system. There is one general purpose register, the Accumulator (ACC).
Table 8.1
Instruction
Explanation
Label
Op code
Operand
LDM
#n
Load the number n to ACC
Load the contents of the location at the given
LDD
<address>
address to ACC
STO
<address>
Store the contents of ACC at the given address
Bitwise AND operation of the contents of ACC
AND
#n
with the numeric operand
CMP
#n
Compare the contents of ACC with the number n
Following a compare instruction, jump to
JPE
<address>
<address> or <label> if the compare was True
JMP
<address>
Jump to <address> or <label>
<label>:
<op code>
<operand>
Labels an instruction
Note:
# denotes immediate addressing
B denotes a binary number, for example B01001010
& denotes a hexadecimal number, for example &4A
(i)
Write assembly language instructions to set the contents of addresses 601 and 602 to
zero, and set all four least significant bits of the contents of address 603 to one.
Use the instruction set from Table 8.1.
…
…
…
…
…
… [3]
(ii)
A program continuously checks the flags. If a flag is set, the program moves to the
error-handling routine at the specified label. For example, if the engine tem
Question text
9
A train cannot move if any of the eight automatic train doors are open. The train door monitoring
system, set out below, checks that all the doors are closed before the train can move.
•
If a monitoring system detects that a door is open, it sets a specific bit in address 500 to 1.
•
If the bit for door one is equal to 1, the binary value for hexadecimal FF is sent to address
501. The contents of address 501 are changed to make door 1’s light flash when the door is
open.
•
If the bit for door two is equal to 1, the binary value for hexadecimal FF is sent to address
502. The contents of address 502 are changed to make door 2’s light flash when the door is
open.
This is repeated for each door from 3 to 8.
•
Each door sets its bit in address 500 to zero when the door closes, and the contents of the
corresponding door address are set to zero.
•
The train manager can identify which door is open from the flashing light.
The current contents of address 500 are:
Door number
1
2
3
4
5
6
7
8
1
0
0
1
0
0
1
0
Address 500
(a) Complete the following table by writing the values stored in addresses 503 to 508. Use the
contents of address 500 shown above. Note that addresses 501 and 502 are complete.
1
1
1
1
1
1
1
1
501
Door 1
0
0
0
0
0
0
0
0
502
Door 2
503
Door 3
504
Door 4
505
Door 5
506
Door 6
507
Door 7
508
Door 8
[2]
(b) The following table shows assembly language instructions for the processor controlling the
train door monitoring system that has one general purpose register, the Accumulator (ACC).
Instruction
Explanation
Label
Op code
Operand
LDM
&n
Load the hexadecimal number n to ACC
Load the contents of the location at the given address
LDD
<address>
to ACC
STO
<address>
Store the contents of ACC at the given address
Bitwise AND the contents of ACC with the hexadecimal
AND
&n
number n
Compare the contents of ACC with the hexadecimal
CMP
&n
number n
Following a compare instruction, jump to <address> or
JPE
<address>
<label> if the compare was True
<label>:
<op code>
<operand>
Labels an instruction
Macro to wait one second before the next instruction is
WAIT
executed
After rechecking the doors, address 500 now contains 10101010.
(i)
Complete the table by writing the values of the Accumulator (ACC) and the contents of
address 501 as these instructions are executed once to check door 1.
Instruction
501
ACC
Label
Op code
Operand
CHECK1:
LDD
500
AND
&80
CMP
&00
JPE
DOOR1
LDM
&FF
DOOR1:
STO
501
WAIT
LDM
&00
STO
501
WAIT
JMP
CHECK1
[4]
(ii)
Write the assembly language instructions to check door 2.
Instruction
Label
Op code
Operand
[4]
(c) Explain how the check door routines show a flashing light or no light.
…
…
…
… [2]
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of the Cambridge Assessment Group. Cambridge As
Question text
5
A weather station uses monitoring and control systems.
(a) Describe the difference between a monitoring system and a control system.
…
…
…
… [2]
(b) (i)
The weather station records how the outside temperature changes over a period of time.
The system will read the temperature once every hour, over a period of 100 days.
The temperature readings are automatically stored in a file. No other data are stored.
Explain why the weather station has decided to use serial organisation for the file.
…
…
…
… [2]
(ii)
Serial files can be accessed using sequential access.
Explain how sequential access could be used for the temperature readings file.
…
…
…
… [2]
(iii)
Name and describe a method of file organisation other than serial or sequential.
Method …
Description …
…
…
…
…
…
[4]
Question text
6
Monitoring and control systems have many different applications.
(a) Explain the importance of feedback in a control system.
…
…
…
…
…
… [3]
(b) An indoor swimming pool is to be kept at a constant temperature of 28 degrees.
Describe the use of feedback in this control system.
…
…
…
…
…
…
…
… [4]
(c) Give one example of a monitoring system. Explain why this is a monitoring system.
Monitoring system …
…
Explanation …
…
…
…
[3]
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of the Cambridge Assessment Group
Question text
6
A company sells plant watering systems that automatically turn on water sprinklers when the soil
becomes too dry.
The plant watering system has a processor and connecting cables.
Identify two other hardware devices that are required in this system. State the purpose of each
device.
Device 1 …
Purpose …
…
Device 2 …
Purpose …
…
[4]
Question text
7
A museum stores antique items that need to be kept at constant temperature.
The museum is not sure about the actual temperatures. The museum installs some equipment.
This records the temperatures every hour and ensures the temperature stays within a set range.
(a) Identify the type of system described.
… [1]
(b) The system has a temperature sensor.
Identify two other items of hardware that the museum can use for the type of system identified.
Describe the purpose of each item.
Item 1 …
Purpose …
…
Item 2 …
Purpose …
…
[4]
(c) The equipment records the temperature in all seven rooms in the museum.
Each recording is stored as two successive bytes in memory. The format is as shown.
Temperature
Room
7
6
5
4
3
2
1
0
Byte 1
Byte 2
The room is indicated by the setting of one of the bits in Byte 2 to 1. For example, room 7 is
indicated by setting bit 7 to 1.
Bit 0 of Byte 2 is a flag:
•
The flag’s initial value is zero.
•
When the reading has been processed, the flag’s value is set to 1.
Byte 1 contains the temperature reading as an unsigned integer.
One reading returns the following binary data.
Temperature
Room
7
6
5
4
3
2
1
0
1
0
1
1
0
0
1
1
0
0
1
0
0
0
0
1
Byte 1
Byte 2
(i)
Analyse the data contained in the two bytes.
…
…
…
…
… [3]
(ii)
The system receives a temperature reading of 238 from room number 4.
Complete the bytes to show the two bytes for this recording. The reading has not yet
been processed.
7
6
5
4
3
2
1
0
Byte 1
Byte 2
[2]
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge International
Examinations Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download at www.cie.org.uk after
the live examination series.
Cambridge International Examinations is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of University of Cambridge Local
Question text
6
(a) There are five scenarios on the left and two types of system on the right.
Draw a line to link each scenario to its correct type of system.
Scenario
System
Car speed display
Aeroplane autopilot
Control
Rollercoaster
Monitoring
Recording the rainfall at
a weather station
Robot loading a part onto
a conveyor belt
[2]
(b) Mary has six fish tanks. The temperature of the water in each tank needs to be within a
specific range.
Identify three items of hardware that Mary can add to her tanks to help maintain the
temperature. Describe the purpose of each item.
Item 1 …
Purpose …
…
Item 2 …
Purpose …
…
Item 3 …
Purpose …
…
[6]
(c) A temperature reading is taken from each tank once per minute. The temperature reading is
stored as two successive bytes. The format is shown:
Fish tank
Temperature reading
7
6
5
4
3
2
1
0
Byte 1
Byte 2
The fish tank number is indicated by setting one of the bits in Byte 1 to 1. For example, fish
tank number 5 is indicated by setting bit 5 to 1.
Bit 7 of Byte 1 is a flag:
•
the flag’s initial value is zero
•
when the reading has been processed, the flag’s value is set to 1
Bit 0 of Byte 1 is unused.
Byte 2 contains the temperature reading as a two’s complement integer.
(i)
After a temperature reading has been taken, the bytes contain the following data.
7
6
5
4
3
2
1
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
1
1
Byte 1
Byte 2
Analyse the data contained in the two bytes.
…
…
…
…
…
… [3]
(ii)
The system receives a temperature reading of − 2 from fish tank number 4.
Complete the bytes to show the values for this reading after it has been processed.
7
6
5
4
3
2
1
0
Byte 1
Byte 2
[2]
(d) A hardware device to affect the temperature of each tank is on or off depending on the value
of a bit in memory location 6753.
If bit 4 is 1, then the hardware device in fish tank 4 is on.
Write assembly language instructions to set bit 4 of memory location 6753 to 1 without
cha
Question text
6
A large warehouse stores goods that must be kept above a temperature of 15 degrees Celsius.
The warehouse has six temperature sensors which are each placed at a different location in the
warehouse.
A computer system is programmed to turn on appropriate heaters when one of the sensors is
below the minimum temperature.
(a) (i)
State the name given to the type of system described.
… [1]
(ii)
Justify your answer to part (i).
…
… [1]
(b) Sensors and heaters are two types of device used in this system.
State two other devices that are used. Justify your choice.
Device 1 …
Justification …
…
Device 2 …
Justification …
…
[4]
(c) The computer system stores the temperature readings for the six sensors in six 8-bit memory
locations.
Six of the bits in an 8-bit register, LOWREG, are used to indicate whether a particular reading
is below the minimum temperature. A value of 1 means the reading is below the minimum
temperature.
For example:
This pattern of bits in LOWREG shows that sensor 5, sensor 4 and sensor 1 have readings
below the minimum temperature.
6
5
4
3
2
1
Not used
Not used
0
1
1
0
0
1
The following table shows part of the instruction set for a processor which has one general
purpose register, the Accumulator (ACC), and an Index Register (IX).
Instruction
Explanation
Op code
Operand
Direct addressing. Load the contents of the given address to
LDD
<address>
ACC.
Immediate addressing. Load the number n to IX.
LDR
#n
Indexed addressing. Form the address from <address> +
the contents of the index register. Copy the contents of this
LDX
<address>
calculated address to ACC.
Store the contents of ACC at the given address.
STO
<address>
Add 1 to the contents of the register (ACC or IX).
INC
<register>
Add the contents of the given address to the ACC.
ADD
<address>
Bitwise OR operation of the contents of ACC with the contents
OR
<address>
of address.
Compare the contents of ACC with number n.
CMP
#n
Compare the contents of ACC with the contents of <address>.
CMP
<address>
Jump to the given address.
JMP
<address>
Following a compare instruction, jump to <address> if the
JPE
<address>
compare was True.
Following a compare instruction, jump to <address> if the
content of ACC is greater than or equal to the number used in
JGE
<address>
the compare instruction.
Question 6(c) continues on the next page.
Part of the assembly language code for updating LOWREG is:
Label
Op code
Operand
LOWTEMP:
15
LOWREG:
B00000000
COUNTER:
1
START:
LDR
#0
LOOP:
LDX
8000
CMP
LOWTEMP
JGE
TEMPOK
LDD
LOWREG
OR
COUNTER
STO
LOWREG
TEMPOK:
LDD
COUNTER
Q1:
CMP
#32
JPE
HEATON
ADD
COUNTER
STO
COUNTER
INC
IX
JMP
LOOP
HEATON:
LDD
LOWREG
(i)
The code uses six memory locations to store the temperature readin
Question text
6
The environment in a very large greenhouse is managed by a computer system. The system uses
a number of different sensors that include temperature sensors. In addition, the system controls a
number of heaters, windows and sprinklers.
(a) State one other type of sensor that could be used with this system.
Justify your choice.
Sensor …
Justification …
…
[2]
(b) Describe why feedback is important in this system.
…
…
…
…
…
… [3]
(c) (i)
The system makes use of a number of parameters. These parameters are used in the
code that runs the system.
State one of the parameters used in controlling the temperature in the greenhouse.
… [1]
(ii)
Explain how the parameter identified in part (c)(i) is used in the feedback process.
…
…
…
… [2]
(d) There are eight temperature sensors numbered 1 to 8. Readings from these sensors are
stored in four 16-bit memory locations. The memory locations have addresses from 4000 to
4003. Each memory location stores two sensor readings as two unsigned binary integers.
Sensor 1 reading is stored in bits 8 to 15 of address 4000; Sensor 2 reading is stored in bits
0 to 7 of address 4000 and so on. The diagram shows that the current sensor 1 reading has
a value of 97.
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
4000
0
1
1
0
0
0
0
1
0
0
1
1
1
0
0
1
4001
1
1
0
0
0
0
0
0
1
0
1
0
0
0
0
0
4002
0
0
0
1
0
1
0
0
0
0
0
0
1
1
0
1
4003
1
0
0
0
0
0
1
0
1
1
0
0
0
1
0
1
(i)
Give the denary value of the current reading for Sensor 5.
…
…
…
… [1]
9608/32
Question text
6
A computer system is used to manage some of the functions in a vehicle. The vehicle has a
number of sensors and actuators. One sensor is used to monitor the moisture on the screen. If the
moisture exceeds a pre-set value, the windscreen wiper motor turns on automatically.
The software used in the computer system is dedicated to the sensor management functions.
When the system starts, the software runs some initial tasks. It then loops continuously until the
system is switched off.
(a) (i)
State the name given to the type of system described.
… [1]
(ii)
Explain your answer to part (i).
…
… [1]
(b) Within the software loop, the value of each sensor is read in turn. The value read from the
sensor is then processed.
State two drawbacks with this method of reading and processing sensor data.
Drawback 1 …
…
Drawback 2 …
…
[2]
(c) An alternative method of reading and processing sensor data is to use interrupts. Each sensor
is connected so that it can send an interrupt signal to the processor if its value changes.
On receipt of an interrupt signal, the processor carries out a number of steps as shown in the
following diagram.
Interrupt
1. Disable interrupts
2. Save current task
3. Identify source of
interrupt
4. Jump to Interrupt
Service Routine
5. Restore task
Return to task
6. Enable interrupts
(i)
State the purpose of step 1.
…
…
… [1]
(ii)
State the purpose of step 6.
…
…
… [1]
(iii)
Explain how the current task is saved in step 2.
…
…
…
… [2]
(iv)
State two benefits of using interrupts to read and process the sensor data.
Benefit 1 …
Question text
6
A large office building has many floors. On each floor there are security sensors and security
cameras. There is the same number of sensors on each floor. The building has a single security
room.
The images from the security cameras are output on monitors (one monitor for each floor) placed
in the security room.
The data from the sensors are read and processed by a computer system. Sensor readings and
warning messages can be displayed on the monitors.
(a) (i)
State the name given to the type of system described.
… [1]
(ii)
Explain your answer to part (i).
…
… [1]
(iii)
State two sensors that could be used in this system.
Sensor 1 …
Sensor 2 …
[2]
(b) A software routine:
•
checks the readings from the sensors
•
outputs readings and warning messages to the monitors
•
loops continuously.
The routine uses the following pseudocode variables:
Identifier
Data type
Description
FloorCounter
INTEGER
Loop counter for number of floors
SensorCounter
INTEGER
Loop counter for number of sensors
NumberOfFloors
INTEGER
Stores the number of floors
NumberOfSensors
INTEGER
Stores the number of sensors
ForEver
BOOLEAN
Stores value that ensures continuous loop
(i)
Complete the following pseudocode algorithm for the routine.
…
01 ForEver
02 REPEAT
03
FOR FloorCounter
1 TO NumberOfFloors
1 TO …
04
FOR SensorCounter
05
READ Sensor(SensorCounter)on Floor(FloorCounter)
06
IF Sensor value outside range
07
THEN
08
OUTPUT “Problem on Floor ”, FloorCounter
09
ENDIF
10
ENDFOR
11
ENDFOR
12
//
13
// Delay loop
14
// Delay loop
15
//
16 UNTIL …
[3]
(ii)
A delay needs to be introduced before the loop is processed again.
Write a FOR loop, in pseudocode, to replace lines 13 and 14.
…
… [1]
(iii)
Give a reason for this delay in the system.
…
… [1]
(c) An alternative method of reading and processing sensor data is to use interrupts. Each sensor
is connected so that it can send an interrupt signal to the processor if its value changes.
On receipt of an interrupt signal, the processor carries out a number of steps as shown in the
following diagram.
Interrupt
1. Disable interrupts
2. Save current task
3. Identify source of
interrupt
4. Jump to Interrupt
Service Routine
5. Restore task
Return to task
6. Enable interrupts
(i)
State the purpose of step 3.
…
…
Question text
6
An intruder detection system for a large house has four sensors. An 8-bit memory location stores
the output from each sensor in its own bit position.
The bit value for each sensor shows:
•
1 – the sensor has been triggered
•
0 – the sensor has not been triggered
The bit positions are used as follows:
Sensor 4 Sensor 3 Sensor 2 Sensor 1
Not used
The output from the intruder detection system is a loud alarm.
(a) (i)
State the name of the type of system to which intruder detection systems belong.
… [1]
(ii)
Justify your answer to part (i).
…
… [1]
(b) Name two sensors that could be used in this intruder detection system. Give a reason for
your choice.
Sensor 1 …
Reason …
…
Sensor 2 …
Reason …
… [4]
The intruder system is set up so that the alarm will only sound if two or more sensors have been
triggered.
An assembly language program has been written to process the contents of the memory location.
The table shows part of the instruction set for the processor used.
Instruction
Explanation
Op code
Operand
Direct addressing. Load the contents of the given address to
LDD
<address>
ACC
STO
<address>
Store the contents of ACC at the given address
INC
<register>
Add 1 to the contents of the register (ACC or IX)
ADD
<address>
Add the contents of the given address to the contents of ACC
Bitwise AND operation of the contents of ACC with the
AND
<address>
contents of <address>
CMP
#n
Compare the contents of ACC with the number n
JMP
<address>
Jump to the given address
Following a compare instruction, jump to <address> if the
JPE
<address>
compare was True
Following a compare instruction, jump to <address> if the
JGT
<address>
content of ACC is greater than the number used in the
compare instruction
END
End the program and return to the operating system
(c) Part of the assembly code is:
Op code
Operand
SENSORS:
B00001010
COUNT:
0
VALUE:
1
LOOP:
LDD
SENSORS
AND
VALUE
CMP
#0
JPE
ZERO
LDD
COUNT
INC
ACC
STO
COUNT
ZERO:
LDD
VALUE
CMP
#8
JPE
EXIT
ADD
VALUE
STO
VALUE
JMP
LOOP
EXIT:
LDD
COUNT
TEST:
CMP
…
JGT
ALARM
Dry run the assembly language code. Start at LOOP and finish when EXIT is reached.
(i)
BITREG
COUNT
VALUE
ACC
B00001010
0
1
[4]
The operand for the instruction labelled TEST is missing.
(ii)
State the missing operand.
… [1]
(iii)
The intruder detection system is improved and now has eight sensors.
One instruction in the assembly language code will need to be amended.
Identify this instruction …
Write the amended instruction … [2]
BLAN