怎么读取地磅的称重
如何读取地磅的称重
地磅的显示器通过RS232的串口连接到电脑到,现在要使用PHP来获取地磅上的物品的重量,实时的数据。
$fd=dio_open('COM1:', O_RDWR);
if(!$fd)
{
die("Error when open COM1");
}
$ff=dio_stat($fd);print_r($ff);到这里是成功的。
dio_read($fd, $len);到这里就不行了
请问读取实时的重量的数据,怎么实现?谢谢
------解决方案--------------------
我以为你应该先向端口写个什么启动指令吧?
不然他就是毫无目的的发?
读取也要在循环里读吧
先看看地磅的说明书再说
------解决方案--------------------
他这个不就是循环吗?
while(($t++)
循环不循环的,不是造成读取失败的理由啊 ????
是吗?
你读的时候他正好没发,他发的时候你却没去读
------解决方案--------------------
那是应为那个口始终都没有数据过来
------解决方案--------------------
“(PHP 4 >= 4.2.0, PHP 5 ------解决方案--------------------
应该还是没有数据过来.
它(厂家)有没有给光盘? 有没有带例子?
有成功的例子吗? 比如c的?
------解决方案--------------------
给厂家打电话吧,没有说明书,怎么知道该如何做

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

Working with database in CakePHP is very easy. We will understand the CRUD (Create, Read, Update, Delete) operations in this chapter.

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

To work on file upload we are going to use the form helper. Here, is an example for file upload.

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

Validator can be created by adding the following two lines in the controller.

Logging in CakePHP is a very easy task. You just have to use one function. You can log errors, exceptions, user activities, action taken by users, for any background process like cronjob. Logging data in CakePHP is easy. The log() function is provide

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c
