CE121L - Microprocessor System Design
Laboratory 4
Week of February 10, 1997
In this laboratory, you will using the serial interface. As you write
more and more complex programs, be sure to make your code modular to
simplify change and reuse. In particular, use symbolic constants
rather than addresses in your code.
- Read section 9 of the HC11 manual.
- Read section 9 once more, very carefully.
- Carefully consider the setting of every serial interface
configuration register. Turn off interrupts (we will use polling to
start with), and enable the transmitter and receiver.
- Decide what settings are required to send data at 1200 baud.
- Add an initialization program for the UART to your HC11 boot
routine. Transmit data with 8 bits, no parity, with one stop bit (see
steps 1 and 2).
- To test the serial I/O, you will be connecting the TxDA
and RxDA pins, making the UART receive its own data.
Referring to steps 1 and 2, determine how to connect the
remaining pins. Do not do the loopback through your level converter.
- With the read/write loop cycling, observe the TxD line on a
scope. Always check the status registers before reading or
writing to the UART. Draw a diagram of the scope output for 1 byte of
transfer, and confirm your baud rate setting.
- Connect the RS-232C level converters. RS-232C levels are
dangerous to your circuit. Always turn off power when you are
changing wiring or, next week, when you are plugging or unplugging the
PC's RS-232C cable into your kit. Do not do a loopback between
the level-converter's driver and receiver.
- Extra: Find another group that has gotten to this point and has
8 LEDs or a seven-segment display on their board. Connect your
RS232-C output to their input, and vice-versa. Don't forget the third
wire in a 3-wire connection. Run your programs that continuously
writes a number to the UART. Is it received by the other group?
- Write a program that will continuously poll the receiver port.
Whenever it receives a character, if it an ascii letter, make it an
upper case letter and write it out the transmit port as soon as the
transmitter is ready. Hook this up to a PC and give it a try.
You will run MSKermit on the PC to emulate a dumb terminal. The
appropriate commands within MSKermit are:
set port 2 ; use I/O port 2 on the PC
set baud 1200 ; port 2 to 1200 baud
connect ; begin VT52 terminal emulation
Output from the keyboard will be sent directly to your HC11, and
input to the PC will be sent directly to the screen. Use 1200 baud,
8-bits, no parity when talking to the PC. As a minimum,
you should echo characters to the screen to confirm what you have
typed.
Richard Hughey
Tue Feb 4 19:56:36 PST 1997