Oki JOB60851 user manual Read and write Functions, read Operation

Models: JOB60851

1 67
Download 67 pages 46.77 Kb
Page 64
Image 64

Chapter 4 Software Development

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

Character is not carriage

return

return

Echo character (carriage

Echo character to

return) to terminal

terminal

Echo line feed to

 

terminal

 

Save newline (line feed)

Save character in

in memory

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

page 4-29

Page 64
Image 64
Oki JOB60851 user manual Read and write Functions, read Operation