[help] read serial port by dio

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
mosphp
Forum Newbie
Posts: 1
Joined: Tue Jan 27, 2009 11:27 am

[help] read serial port by dio

Post by mosphp »

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);
}
Post Reply