
This is a sample program for sending and 
 reading data via serial communication.
You can also change the communication parameter settings.
Sample specification  | 
		※This is the initial value of the sample program.  | 
	
Program name  | 
		./comwriteread.py  | 
	
Baud rate  | 
		9600bps  | 
	
Data length  | 
		8  | 
	
Stop bit  | 
		1  | 
	
Parity  | 
		None  | 
	
This is a sample program that uses the pySerial 
 module (https://pythonhosted.org/pyserial/).
If you want to run this sample program, please install pySerial beforehand.
Python is an interpreted programming language.
Therefore, there is no need to compile the source code beforehand.
1. Input serial port names to be used after 
 the program starts.
    
Example : Serial port name when using only 
 one COM-1C2-USB
              /dev/ttyUSB0
Example: Serial port name when using only 
 one COM-2(PCI)H and connecting it to CN1 on the device via cable.
              /dev/ttyCom0
2. If you specify the serial port name, a 
 command menu will be displayed and the program will wait for keyboard 
 input.
    Select the desired command by entering the corresponding 
 number on your keyboard.
    
3. You can set serial communication parameters 
 by selecting the "0:Set Parameter" command from the command 
 menu.
    If you do not want to change the serial communication 
 parameters, there is no need to select this command.
    For each parameter, 
 a list of configurable parameters is displayed and then keyboard input 
 is waited for.
    Select the desired parameter by entering the corresponding 
 number on the keyboard.
    When all parameters 
 are selected, "Set Parameter OK" will be displayed.
    After that, a list of the set communication parameters 
 will be displayed, and then the command menu will be displayed again, 
 waiting for keyboard input.
Example: baud rate: 38400bps, data length(byte 
 size): 8 bits, stop bit: 1, no parity, full duplex, no flow control

4. When you select the "1.Write" 
 command from the command menu, "Input Write Data:" is displayed 
 and the program waits for keyboard input.
    If you are not sending a character string via serial 
 communication, there is no need to select this command.
    
    After entering the 
 string data to be sent on the keyboard, press the Enter key and the string 
 data will be sent via serial communication.
    If the string is sent successfully, "Send 
 OK" will be displayed and the command menu will be displayed again, 
 waiting for keyboard input.
Example: Screen display when pressing the 
 Enter key after specifying "Test string" as the string to be 
 sent

5. When you select the "2.Read" 
 command from the command menu, the message "Read Data: b" will 
 be displayed, followed by the character string received via serial communication.
    If you are not receiving character strings via 
 serial communication, there is no need to select this command.
The received string will be displayed, and then the command menu will be displayed again, waiting for keyboard input.
    The maximum string 
 that can be received at one time is 50 characters.
    Timeout time is 1 second.
Example: If no character string is received, 
 the following screen will be displayed

Example: Screen display of "Test string" 
 string received via serial communication

6. Selecting the "3.Exit" command from the command menu will terminate the sample program.
[ Supplement: List of configurable serial communication parameters ]
All serial communication parameters must 
 match on the sending and receiving sides.
If there is a mismatch in communication parameters, communication will 
 not work properly.
Communication Parameter Name  | 
		Parameter Setting Screen  | 
		Overview  | 
	
Baud Rate  | 
		
  | 
		Baud rate can be set from 300bps to 921600bps.  | 
	
Byte Size  | 
		
  | 
		Data length(byte size) can be set from 5 to 8.  | 
	
Stop Bit  | 
		
  | 
		Stop bit can be selected from 1, 1.5, or 2.  | 
	
Parity  | 
		
  | 
		Select the parity. None : None (no parity check)  | 
	
Flow Control  | 
		
  | 
		Select the hardware flow control. None : No flow control  |