Jump to content

PHP Serial port communication


ninad

Recommended Posts

php_serial .class.php being used.The

$ser=new phpSerial;//works

$ser=deviceSet(COM1);//doesnt work on windows XP

$ser->deviceOpen;//shows warning.

What is the problem here? ??? All hardware and software/driver requirements are met.

full code is:

function monitor(){

try{

$ser= new phpSerial;

$ser->deviceSet("COM2");//COM4

$ser->deviceOpen();//"r+b"

$ser->confBaudRate(38400);//9600

$ser->confParity("none");  //this is the "N" in "13-N-1"

$ser->confCharacterLength(13); //Character length

$ser->confStopBits(1);  //this is the "1" in "13-N-1"

$ser->confFlowControl("none");

$buffer= array();

$buffer= $ser->readPort();

 

 

 

while(1){//fgetc($ser)!='#'

$buffer= $ser->readPort();

if(ereg('^#[0-9]{12}',$buffer))

break;

}

//$ser->ReadPort(12);#ReadPort(<$count=0>)

echo $buffer;

}

monitor();

Link to comment
https://forums.phpfreaks.com/topic/164204-php-serial-port-communication/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.