Serial Module
MOTOROLA
MC68307 USER’S MANUAL
8-31
8.4.2.1 SERIAL MODULE INITIALIZATION. The serial module initialization routines con-
sist of SINIT and CHCHK. SINIT is called at system initialization time to check UART oper-
ation. Before SINIT is called, the calling routine allocates two words on the system stack.
Upon return to the calling routine, SINIT passes information on the system stack to reflect
the status of the UART. If SINIT finds no errors, the receiver and transmitter are enabled.
The CHCHK routine performs the actual checks as called from the SINIT routine. When
called, SINIT places the UART in the local loopback mode and checks for the following er-
rors:
Transmitter Never Ready
Receiver Never Ready
Parity Error
Incorrect Character Received
8.4.2.2 I/O DRIVER EXAMPLE. The I/O driver routines consist of INCH and OUTCH. INCH
is the terminal input character routine and gets a character from the receiver. OUTCH is
used to send a character to the transmitter.
8.4.2.3 INTERRUPT HANDLING. The interrupt handling routine consists of SIRQ, which is
executed after the serial module generates an interrupt caused by a change-in-break
(beginning of a break). SIRQ then clears the interrupt source, waits for the next change-in-
break interrupt (end of break), clears the interrupt source again, then returns from exception
processing to the system monitor.
8.5 SERIAL MODULE INITIALIZATION SEQUENCE
If the serial capability of the MC68307 is being used, the following steps are required to prop-
erly initialize the serial module.
NOTE
The serial module registers can be accessed by word or byte op-
erations, but only the data byte D7–D0 is valid.
Command Register (UCR)
Reset the Receiver and Transmitter.
Interrupt Vector Register (UIVR)
Program the Vector Number for a Serial Module Interrupt.
Interrupt Mask Register (UIMR)
Enable the Desired Interrupt Sources.
Auxiliary Control Register (UACR)
Select Baud Rate Set (BRG bit).
Initialize the Input Enable Control (IEC bit).
Select Timer Mode and Clock Source if Necessary.