设定通信参数


设定RS-422/485通信参数的命令是uart

"set uart (parameter)"

parameter上输入如下形态的字符串。

"(baudrate)[parity[data bit[stop bit[flow control]]]]"

※ (): 必须使用, []: 可选

参数 说明范围 说明 基本值
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 7 or 8 data bit 8
stop bit 1 or 2 stop bit 1
flow control N or T flow control
(N: None, T: Use RS-485)
T
<?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: 115200N81T

spc_request_dev($sid, "set uart 115200N81T");
echo spc_request_dev($sid, "get uart"), "\r\n";   // output: 115200N81T

spc_request_dev($sid, "set uart 9600E72N");
echo spc_request_dev($sid, "get uart");           // output: 9600E72N
?>