beautypg.com

Tty port communication program – Solvline PB2xxxUG User Manual

Page 94

background image

}

}

2. TTY Port Communication Program

TTYxx port communication is most generally used serial communication method under the Linux/Unix
environment.

1) Function Description

open() -------------- Open a communication port.
|
read(), write() --- Read or write data from the open communication port.
|
close() ------------- Close the open communication port.

2)

Result

Application repeatedly transmits “This is LoopBack Data!” through the ttyS0 port at 3 second
intervals and displays data from ttyS0 on screen.

3) Running Method

Plug the loopback connector to the first serial port of Portbase.
Run Redirector and select Portbase to register the first serial port as ttyS0.

(Refer to Chapter 7 TTY Port Redirection)

If you run the program, the following screen appears and “This is LoopBack Data!“ is

repeatedly displayed on the edit box at 3 sec. Intervals.

94