The command to set RS-232 communication parameters is uart.
"set uart (parameter)"
Specify a string of the following form in parameter.
"(baudrate)[parity[data bit[stop bit[flow control]]]]"
※ (): mandatory, []: optional
Paramater | Values | Description | Default Value |
---|---|---|---|
baudrate | 1200 ~ 115200 | baudrate(bps) | 115200 |
parity | N, E, O, M or S | parity bit (N: None, E: Even, O: Odd, M: Mark, S: Space) |
N |
data bit | 8 or 7 | data bit | 8 |
stop bit | 1 or 2 | stop bit | 1 |
flow control | N, H or S | flow control (N: None, H: RTS/CTS, S: Xon/Xoff) |
N |
<?php
include "/lib/sd_spc.php";
$sid = 14;
spc_reset();
spc_sync_baud(115200);
spc_request_dev($sid, "set uart 115200");
echo spc_request_dev($sid, "get uart"), "\r\n"; // output: 115200N81N
spc_request_dev($sid, "set uart 115200N81");
echo spc_request_dev($sid, "get uart"), "\r\n"; // output: 115200N81N
spc_request_dev($sid, "set uart 9600E72H");
echo spc_request_dev($sid, "get uart"); // output: 9600E72H
?>
※ Note: The flow control(H and S) and the setting of inter frame gap ("set ifg") cannot be used at the same time.