Configuring the designated UART port
void uart_setup(int $uart_id, int $baud [, string $ctrl = "N81N"])
ctrl | available values |
---|---|
parity | N: None, E: Even, O: Odd, M: Mark, S: Space |
data bit | 8 or 7 |
stop bit | 1 or 2 |
flow control | N: None, H: RTS/CTS, S: Xon/Xoff, T: TxDE(RS485) enable |
none
<?php
include "/lib/sd_340.php";
uart_setup(0, 9600, "E71N"); // set UART0 to 9600 bps, Even parity, 7 data bits, 1 stop bit, No-flowcontrol
uart_setup(1, 115200); // set UART1 to 115200bps
?>