beautypg.com

2 serial port – Oki JOB60851 User Manual

Page 62

background image

Chapter 4 Software Development

page 4-27

Table 4.5.1. Library Functions Calling read() and write()

I/O Library Function

Required Low-Level Function

fgetc,fgets,fscanf,getc,getchar,gets,scanf

read

fflush,fprintf,fputc,fputs,fwrite,printf,putc,putchar,puts,
vfprintf,vprintf

write

For further details on these and other library functions, refer to the RTL665S Run-Time Library
Reference.

The source code file stdrw573.c contains the source code and settings for these two low-level
functions. Including it on the compiler command line provides the user program with access to the
standard library I/O functions.

Command Line

cl665s /T m66573 /H /WIN [user program] stdrw573.c l66ks50s.lib

4.5.2

Serial Port

Including the source code file stdrw573.c provides the user program with access to this standard I/O.
This Section discusses the MSM66Q573 internal serial port that the JOB60851 board uses for this
purpose, with the structure outlined in Figure 4.5.2.

Baud rate
generator

(BRG)

SIO0 (UART)

I/O control

circuitry I/O

buffers

MSM66Q573 internal bus

Transmit data: TXD0 (Port7_1)

Receive data: RXD0 (Port7_0)

External clock: RXC0 (Port7_2)

I/O data

Figure 4.5.2. Serial Port Structure

Port 7_1 on the is the MSM66Q573 TX pin transmitting the standard output data to the terminal
emulator running on the host personal computer; Port 7_0, the RX pin receiving the standard input
data in the reverse direction. (The JOB60851 board does not use Port 7_2.)

The baud rate generator (BRG) uses the overflow signal from MSM66Q573 internal timer 3.