SER.set_speed(speed, <char format>, <flow control>)

This command sets the serial port TXD/RXD speed. The default serial port TXD/RXD speed is 115200.

The first input parameter speed is a Python string which is the value of the serial port speed. It can assume values in the range from '300' to '115200'.

The second optional parameter <char format> is a Python string that represents the character format to be used:

the first character is the number of bits per char (7 or 8), then the parity setting (N - none, E- even, O- odd) and in the end the number of stop bits (1 or 2). The default value is "8N1". For version 18.11.004 only "8N1" value is available

The third optional parameter <flow control> is only available from version 12.00.xx4, version 13.00.xx5 and version 18.11.004 and is a Python string that represents the flow control mode to be used:

"none" set no flow control enabled,

"hw" set hardware flow control enabled.

The default value is "none".

The return value is a Python integer which is -1 if an error occurred otherwise is 1.

 

Example:

 

b = SER.set_speed('9600')

 

sets the serial port USIF0 speed to 9600, assigning the return value to b.

 

Note: Sending the +IPR command to the device does not affect the physical serial port, you must use this function to set the speed of the port when using the Python engine.