ECE243 Practice Question Website


Main Assembly Programming Input/Output Memory Computer Architecture Advanced Topics

Input/Output Questions





Question 5

Two devices are connected by a asynchronous serial link (UART) as discussed in class and in the text and lab manual. For all parts of this question, the sender is configured at 28000 baud, 7 data bits, 2 stop bits. Note that ASCII codes are in Appendix E, page 791.

The ASCII code of a ‘B’ is send continuously from this same sender using the following 68000 code:

	TXBSY	equ	$FFFFFA00
	TXOUT 	equ 	$FFFFFA02
	.
	. 	;initialization etc. in here
	.
		moveq 	#$42,d0		;’B’ to d0
	chkser	btst.b 	#0,TXBSY	;check busy bit
		bne 	chkser		;back if still busy
		move.b 	d0,TXOUT	;the ‘B’ output
		bra 	chkser		;back until again not busy
	
If the timing of the instructions can be determined by the number of memory cycles, calculate the approximate proportion of time actually spent putting data into the UART to the amount of time just testing to see if the UART is busy. Assume each memory cycle takes 100nsec.

Answer

btstb 5 memory cycles = 500 nsec
bne 1 mem cycle = 100 nsec
move.b 4 mem cycles = 100 nsec
bra 1 mem cycle = 100 nsec

time for each transmit = 1/2800 sec = 3.6*10-4 sec = 360 usec

Approx proportion of time for transmit (and we are using the fact that it is approximate so we can avoid worrying about averaging things in – in the marking we were very liberal here so you didn’t even have to calculate the number of cycles of the first 2 instructions):

In an interval of 360 usec we spend 200 nsec transmitting and the rest polling, so the proportion is 200:360000 or 2:3600 or 1:1800