Windows Read Serial Support [php_serial.class.php ]

89 篇文章 0 订阅

 

http://code.google.com/p/php-serial/issues/detail?id=1

 

Issue 1:

Windows Read Serial Support
 3 people starred this issue and may be notified of changes.Back to list
Status: New
Owner: ----


Sign in to add a comment
 
Reported by david.ro...@gmail.com, Dec 30, 2009
Hi,

I have got windows to read from my serial port using the following code in
place of the 'not implemented' comment:

------
		elseif ($this->_os === "windows")
		{
        	$content = "";

			if ($count > 0)
			{
				$content = fread($this->_dHandle, $count);
			}

			return $content;
		}
-----

System: Vista 32bit with a Prolific USB to serial adapter cable.

I hope that it is of some help.

Cheers,

David

Comment 1 by THEREDR...@gmail.com, Jan 6, 2011
does this code really work ?

please confirm sir...

if yes i would take up my final year project related to web controlled arduino please reply sir...
Comment 2 by david.ro...@gmail.com, Jan 8, 2011
Why would I make a post saying it works if it didn't? give it a test for your hardware it will take all of 20 mins.

As an added bonus I have attached my working version of the class.

Have Fun!
php_serial.class.php
13.7 KB   View   Download
Comment 3 by gongqing...@gmail.com, May 27, 2011
It looks very good!I send the message to MCU.It's all right!
Comment 4 by honzapr...@gmail.com, May 31, 2011
Yes, it is working for me... :-)
Comment 5 by mustangc...@gmail.com, Nov 17, 2011
What version of pf PHP is this working on? Will it work running Apache, PHP5.2 on Windows 7 64Bit?  It works fine to write to the com port but I am still unable to read the comp port. 
Comment 6 by david.ro...@gmail.com, Nov 19, 2011
PHP Version 5.3.1 (XAMPP package)

Be worth checking php doco for issues using 'fread' and 64-bit, since the change uses it to read the data.
Comment 7 by sokmeng....@gmail.com, Mar 15, 2012
so it mean that if i use XAMPP package then i can read the data from COM port in my windows? please give me some advices, and thank in advance.
Comment 8 by david.ro...@gmail.com, Mar 15, 2012
It means if your php/apache is running with sufficient privelege to access your windows com ports then you should be able to read from it.
Comment 9 by vandenbe...@gmail.com, Apr 1, 2012
For me, write does work, read doesn't unfortunately. Even with the suggested change in code..
Comment 10 by cilok.e...@gmail.com, Jun 18, 2012
hai all,, I need Help..
I was try php_serial.class.php
code
$serial->sendMessage('Hallo');
why I cannot get reply with code
$result=$serial->readPort();
print $result;

regard newbie
  Sign in to add a comment
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值