hi all,
dio_open() [function.dio-open]: cannot open file COM1: with flags 2 and permissions 0: Permission deni
i am try to write some to read my serial port by dio, but never can sucess.... do any can help me !!!!!!
Thanks,
my code is :
function read_device(){
exec('mode COM1: baud=9600 data=7 stop=1 parity=o');
$fd = dio_open('COM1:', O_RDWR | O_NOCTTY | O_NONBLOCK);
if(!$fd) {
die("Port not opened.");
}else {
$string= "E01N";
$string1= "S0001";
$data = dio_write($fd, $string);
//$data = dio_read($fd, 1);
//echo $data.",";
if ($data) {
echo "connection success.".$data;
}else {
echo "connection failure.";
}
}
dio_close ($fd);
}
[help] read serial port by dio
Moderator: General Moderators