Beruflich Dokumente
Kultur Dokumente
b) What is a stack underflow and when does it occur? What happens if the system stack pointer register has not
been initialised and a subroutine is called after the subroutine returns and the stack pointer happens to be
pointing to non-volatile memory? [6]
c) The following signed comparisons between two 8-bit integer variables a and b take place. The comparison
operation is a – b with the difference not being stored but the result being used to update the status flags.
Determine the required state of the five arithmetic status flags for the signed comparisons to be true.
i) a > b ii) a = b iii) a < b iv) a >= b v) a <= b vi) a <> b [9]
QUESTION TWO
a) Listing Q.2 is that of an MC6809 assembly language program. Convert the program into machine code by
hand and compile the Intel hex format and Motorola S format records. [20]
; IX points to NULL terminated source standard string
; IY points to NULL terminated comparison string
; subroutine compares the two strings: source - comparison and:
; ACCA returns $00 for equal strings
; ACCA returns $80 if source string comes before destination string alphabetically
; ACCA returns $7F if source string comes after destination string alphabetically
ORG $DDC0
STRING_COMPARISON LDA 0,X+
BEQ SAME_PREFIX ; branch on string terminator
CMPA 0,Y+ ; compare corresponding characters
BEQ STRING_COMPARISON
BLT COMES_BEFORE
COMES_AFTER LDAA #$7F
RTS
COMES_BEFORE LDAA #$80
RTS
SAME_PREFIX CMPA 0,Y+ ; if destination is NOT NULL source
BNE COMES_BEFORE ; string comes first
RTS ; strings equal – return $00
Listing Q.2
b) Compare and contrast signed and unsigned comparisons. Apply the two comparisons for the following pairs
of numbers: $FE and $93 ii) $07 and $76 iii) $F3 and $5B iv) $51 and $DC
1
QUESTION THREE
a) An MC68HC11 microcontroller is driven by a 2 MHz crystal. The configuration register TMSK2 is initialised
to $03 after power on reset. What is the interval between the main timer counter or TCNT overflows which
result in the flag bit TOF being set in TFLG2? Assume that TOI, the corresponding interrupt enable bit in
TMSK2 is also set. Describe how that flag bit must be cleared in the corresponding interrupt service routine.
[10]
b) Describe what happens when an input capture channel is programmed to capture both channels and any edge
occurs on the corresponding input capture pin. [4]
c) Describe what causes an output comparison channel to change state when it is programmed to toggle, i.e.
always change state when the programmed event occurs. [4]
d) Assuming Index Register Y points to the address of an internal EEPROM location to be programmed and
ACCB brings in the data to be programmed at that location, write a stand alone subroutine which programmes
the byte. Assume the existence of a 10 ms subroutine called DELAY_10ms. Do not assemble by hand the
corresponding assembly language subroutine. [7]
QUESTION FOUR
a) 116 bytes are to be written into the 25LC640 serial EEPROM starting at address $0AE9. Come up with a
schedule, i.e. describe all the operations which are required to achieve the desired objective as a sequence of
write operations and any other operations required to enable the write operations. [13]
b) An MC68HC11 microcontroller is driven by a 5.5296 MHz crystal. The configuration register BAUD
($102B) is initialised with the value $52 after power on reset during initialisation. What is the configured data
bit rate? [4]
c) Figure Q.4 shows the display which is required to be made on an LCD matrix display. Assuming that the LCD
has been initialised, write down the sequence of commands sent to the LCD display together with a sequence
of data sequences or strings sent to the display to create the display of figure Q.4. Assume that at the
beginning the LCD display is full of some other prior display which must be cleared before the screen shot of
figure Q.4. Note the letter o is used in place of the degree sign. [8]