This is a sample program that sends the specified string data via serial communication.
Sample specification |
※This is the initial value of the sample program. |
Program name |
./comsend |
Baud rate |
38400bps |
Data length |
8 |
Stop bit |
1 |
Parity |
None |
To run the sample program, you must compile
the source code.
For instructions on how to compile the source code, please refer to the
"How to compile C language samples" section in Sample
Programs topic.
1. Specify the name of serial port to send
data after the program starts.
Example : Serial port name when using only
one COM-1(USB)H
/dev/ttyUSB0
Example: Serial port name when using only
one COM-2(PCI)H and connecting it to CN2 on the device via cable.
/dev/ttyCom1
2. If you specify a serial port name, it
will wait for you to input the string to send.
3. After inputting the string data to be
sent using the keyboard, press the Enter key to confirm the string.
The character string entered from the keyboard
will be sent via serial communication with the character code "CR(Carriage
Return)" added to the end of the string.
If the string is sent successfully, the message
"Sending is over." will be displayed, and it will wait for you
to input the string to send again.
Example: Screen display when pressing the
Enter key after specifying "Test string" as the string to be
sent
4. If you send string data with the character 'z' at the beginning, the sample program will terminate.
Example: Screen display when pressing the
Enter key after specifying only "z" as the string to be sent