Hardware Reference
In-Depth Information
Errors could happen during the data transmission process. The most common errors
include framing, receiver overrun, and parity errors. A framing error occurs when the start and
stop bits improperly frame a received character. A framing error is detected by a missing stop
bit. A receiver-overrun error occurs when one or multiple characters are received but not read
by the processor. A parity error occurs when an odd number of bits change value.
Some HCS12 members have two identical serial communication interface (SCI) subsys-
tems. Since the TIA-232 standard uses a voltage level different from those to represent logic 1
and logic 0, a transceiver is required to do the voltage translation so that the SCI subsystem can
interface with the TIA-232 circuit. Due to the widespread use of the TIA-232 standard, trans-
ceiver chips are available from many vendors. The DS14C232 from National Semiconductor is
used as an example to illustrate the SCI hardware interfacing.
9.11 Exercises
E9.1 Sketch the output of the letters k and p at the TxD pin when they are transmitted using
the format of 1 start bit, 8 data bits, and 1 stop bit.
E9.2 Write an instruction sequence to configure the SCI1 to operate with the following
parameters:
19200 baud (E-clock is 24 MHz)
One start bit, 8 data bits, and 1 stop bit format
Enable both transmit and receive interrupts
Idle line wake-up
Disable wake-up initially
Long idle line mode
Enable receive and transmit
No loop back
Enable parity
E9.3 Write a subroutine to send a break to the communication port controlled by SCI1. The
duration of the break must be approximately 480,000 E-clock cycles.
E9.4 Write a subroutine to output the contents of accumulator A as two hex digits to channel
SCI0.
E9.5 Modify Example 9.4 so that the putcSCI0 routine will expand the CR character into the
CR/LF pair and expand the LF character into the LF/CR pair. You can add a fl ag to indicate
whether the expansion should be performed.
E9.6 Add an echo fl ag (1 byte) and modify Example 9.5 so that the received character will be
echoed back to the SCI0 when the fl ag is 1. Otherwise, no echo will be performed.
E9.7 Write a subroutine to input two hex digits from the SCI0 module and echo them back to
SCI0. When this routine is run on a demo board, it will allow you to input two hex digits from
the keyboard and echo them on the terminal screen.
E9.8 Modify the getcSCI0 routine in Example 9.5 so that it will handle the backspace character
like this:
Check if the input character is the backspace character (ASCII code $08).
If the entered character is the backspace character, then echo it, output a space
character, and output another backspace character. Why would you do this?
 
Search WWH ::




Custom Search