Oki JOB60851 User Manual
Page 64
Chapter 4 Software Development
page 4-29
Receive end interrupt flag
"0"
(3) Configuring TX and RX pins
These pins represent secondary functions for Port 7 pins 1 and 0, respectively, so write the
following values to the corresponding bits in the Port Mode (P7IO) and Port Secondary
Function Control (P7SF) Registers.
Port Mode (P7IO):
"1" (output) for P7_1 and "0" (input) for P7_0
Port Secondary Function Control (P7SF):
"1" (secondary) for both P7_1 and P7_0
This completes the serial port setup procedure.
4-5-3.
read() and write() Functions
For full particulars on these two functions, refer to the comments in the source code file stdrw573.c.
This section gives just broad outlines.
(1) read() function
Figure 4.5.3 gives a flowchart for function operation.
Read character from receive buffer
Character is carriage
return
Character is not carriage
return
Echo character to
terminal
Save character in
memory
Echo character (carriage
return) to terminal
Echo line feed to
terminal
Save newline (line feed)
in memory
Figure 4.5.3. read() Operation
The function reads the character in the single-byte receive buffer.
If that character is not a carriage return, the function echoes it back to the terminal emulator and
stores it as is in memory (as specified by the user application program), incrementing a buffer