Practice Question 1 Topic: Monitoring and Control System / Bit Manipulation
Practice Question 1 Topic: Monitoring and Control System / Bit Manipulation
A farmer grows vegetables in a greenhouse. For the vegetables to grow well, the temperature needs to
always be within a particular range.
The farmer is not sure about the actual temperatures in the greenhouse during the growing season. The
farmer installs some equipment. This records the temperature every hour during the growing season.
...............................................................................................................................................[1]
(b) Identify three items of hardware that would be needed to acquire and record the temperature data.
Justify your choice for each.
Item 1 ........................................................................................................................................
Justification ...............................................................................................................................
...................................................................................................................................................
Item 2 ........................................................................................................................................
Justification ...............................................................................................................................
...................................................................................................................................................
Item 3 ........................................................................................................................................
Justification ................................................................................................................................
...............................................................................................................................................[6]
(c) The equipment records temperatures in the greenhouse. It does this for seven locations.
Each recording is stored as two successive bytes. The format is shown below:
The location is indicated by the setting of one of the seven bits in byte 1. For example, location 4 is
indicated by setting bit 4.
Bit 0 of byte 1 acts as a flag:
Complete the boxes below to show the two bytes for this recording. The reading has not yet been
processed.
(d) (i) The accumulator is loaded with the value of byte 1 from location 106.
Write the assembly language instruction to check whether the reading in byte 2 came from location 4.
................................................................................................................................................................[4]
(ii) Write the assembly language instruction to set the flag (bit 0) of the byte contained in the
accumulator to 1.
......................................................................................................................................................................