1. Theory Fundamentals
A section of Computer Science, 9608
Listing 10 of 304 questions
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. State one other type of sensor that could be used with this system. Justify your choice. Sensor Justification Describe why feedback is important in this system. 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. Explain how the parameter identified in part is used in the feedback process. 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. Give the denary value of the current reading for Sensor 5. The following table shows part of the instruction set for a processor. The processor has one general purpose register, the Accumulator (ACC). Instruction Explanation Op code Operand LDD Direct addressing. Load the contents of the location at the given address to ACC. AND #n Bitwise AND operation of the contents of ACC with the operand. AND Bitwise AND operation of the contents of ACC with the contents of . XOR #n Bitwise XOR operation of the contents of ACC with the operand. XOR Bitwise XOR operation of the contents of ACC with the contents of . OR #n Bitwise OR operation of the contents of ACC with the operand. OR Bitwise OR operation of the contents of ACC with the contents of . can be an absolute address or a symbolic address. LSL #n Bits in ACC are shifted n places to the left. Zeros are introduced on the right hand end. LSR #n Bits in ACC are shifted n places to the right. Zeros are introduced on the left hand end. The reading for Sensor 5 is used in a calculation. The calculation is carried out by two assembly language instructions. The first instruction loads the contents of the 16-bit location that contains the value for Sensor 5. The second instruction moves the bits in Sensor 5 so that the 16-bit value is the value of Sensor 5. Complete the two instructions in the following code. Use the instruction set provided. LDD // load the contents of the 16-bit location containing the value for Sensor 5 into the Accumulator // move the bits in the Accumulator so that the Accumulator stores the value of Sensor 5 as an unsigned 16-bit binary integer
9608_w17_qp_32
THEORY
2017
Paper 3, Variant 2
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 The current contents of addresses 601 to 603 are: Most significant Least significant State the information that the current contents of addresses 601 to 603 will provide to the driver. 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. 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 LDD Load the contents of the location at the given address to ACC STO Store the contents of ACC at the given address AND #n Bitwise AND operation of the contents of ACC with the numeric operand CMP #n Compare the contents of ACC with the number n JPE Following a compare instruction, jump to or if the compare was True JMP Jump to or : Labels an instruction Note: # denotes immediate addressing B denotes a binary number, for example B01001010 & denotes a hexadecimal number, for example &4A 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. 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 temperature is high, the program jumps to the label for the error-handling routine HIGHTEMP. The error-handling routine instructions have not been provided. A programmer has written most of the instructions for the program in the following table. There are four missing operands. Complete the assembly language program by writing the four missing operands. Label Op code Operand CHECKFLAGS: LDD AND &0F STO TEMP AND &01 CMP &01 JPE HIGHTEMP LDD TEMP AND &02 CMP JPE LOWOIL LDD TEMP AND CMP &04 JPE LOWBATT LDD AND &08 CMP &08 JPE LOWFUEL JMP TEMP:
9608_w20_qp_32
THEORY
2020
Paper 3, Variant 2
Questions Discovered
304