I am trying to send data over ttyS2 and this is ok but the data I read
back is never right.  Is it something I am doing in my sample program
below?

[code]
<?php

exec('setbits -p g -b 5 -s 0');

function SetSerial() {
        global $handle;
        exec( 'setbits -p g -b 5 -s 1' );
        exec( 'stty -F /dev/ttyS2 9600 raw' );
        $handle = fopen("/dev/ttyS2", "r+");
}

SetSerial();

if ($handle) {
        echo "Data Sent! \n\r";
                fwrite($handle, "7E00040801534360");
        $data = fread($handle, 8);
}

if ($data) {
        echo "Data Collected \n\r";
        echo bin2hex($data) . "\n\r";
}

fclose($handle);

?>

[/code]

Thanks in advance,

Scott

Reply via email to