deviceSet($ser_port); $serial->confBaudRate($ser_baud); $serial->confParity($ser_parity); $serial->confCharacterLength(8); $serial->confStopBits($ser_stopbits); $serial->deviceOpen(); $serial->sendMessage($ser_request . chr(13)); echo "{"; echo "\"request\":\"" . $ser_request . "\", "; echo "\"port\":\"" . $ser_port . "\", "; echo "\"baudrate\":\"" . $ser_baud . "\", "; echo "\"parity\":\"" . $ser_parity . "\", "; echo "\"stopbits\":\"" . $ser_stopbits . "\", "; echo "\"response\":\""; $res = $serial->readPort($ser_readcount); $res = str_replace (chr(13), "", $res); echo $res; echo "\"}"; $serial->deviceClose(); ?>