© 2000 Ubicom, Inc. All rights reserved.
- 23 -
www.ubicom.com
SX IrDA Virtual Peripheral Implementation
AN16
5.0
Serial Port / Debug
The demonstration PCB includes a RS232 serial port for
debug and external communication. The UART-Virtual
Peripheral supports full duplex communication at
115200bps (1 start bit, no parity, 1 stop bit) with no hand-
shaking (RTS/CTS hand-shaking is supported by the
hardware but has not been implemented in software).
A data byte can be transmitted using the following code:
mov
UartTxData, w
setb
UartTxStart
The register and bit are both global (no bank instruction
needed). Debug data is the same as UartTxData and
DebugSend is the same as UartTxStart. When the
data byte has been sent the global UartTxEmpty flag
will be set.
If the UART is idle then the transmission will start at the
next timer interrupt (108 cycles @ 50MHz), otherwise it
will start once the current byte is finished. There is no
additional buffering and so a second byte cannot be sent
until the first byte has started transmission (indicated by
UartTxStart being cleared).
When a data byte is received the global UartRxAvail
flag will be set. The received data byte is in the UartRx-
Data register in the IsrBank (not global).
5.
1
DEBUG MACROS
Table 5-1 shows three debug macros for showing debug
data.
The first parameter is a constant and must be 1 for the
macro to take affect.
Debug Information
The debug control registers in PROJECT.SRC can be
changed to show more debug information.
Table
5-1. Debug Macros
Name
Description
Example
Affects
Words
Cycles
Debug
Output the value in w
debug 1
none
2
2
Debugl
Output a literal value
debugl l, !
w
3
3
Debugf
Output the given register
debugf 1, reg
w, z
3
3