pull/1/head 0.4.1
John Long 12 years ago
parent 94772fcd7c
commit 82c6fcf1d1
  1. 11
      Phpmodbus/ModbusMasterUdp.php
  2. 12
      index.php
  3. 19
      readme.txt
  4. 1
      tests/IecType/output/test.iecByte.php.html
  5. 1
      tests/IecType/output/test.iecDInt.php.html
  6. 1
      tests/IecType/output/test.iecInt.php.html
  7. 12
      tests/IecType/output/test.iecReal.php.html
  8. 2
      tests/ModbusMasterUdp/output/test.fc15fc1.php.html
  9. 72
      tests/ModbusMasterUdp/output/test.fc16fc3.php.html
  10. 11
      tests/ModbusMasterUdp/output/test.fc16fc3bind.php.html
  11. 1
      tests/ModbusMasterUdp/output/test.fc26.php.html
  12. 11
      tests/ModbusMasterUdp/output/test.fc26bind.php.html
  13. 1
      tests/PhpType/output/test.bytes2mixed.php.html
  14. 1
      tests/PhpType/output/test.bytes2real.php.html
  15. 1
      tests/PhpType/output/test.bytes2signedint.php.html
  16. 1
      tests/PhpType/output/test.bytes2string.php.html
  17. 6
      tests/PhpType/output/test.bytes2unsignedint.php.html
  18. 1
      tests/PhpType/output/test.strangearray.size.php.html
  19. 1
      tests/PhpType/output/test.strangearray.textarray.php.html

@ -442,7 +442,6 @@ class ModbusMasterUdp {
*/ */
private function writeMultipleCoilsPacketBuilder($unitId, $reference, $data){ private function writeMultipleCoilsPacketBuilder($unitId, $reference, $data){
$dataLen = 0; $dataLen = 0;
$endianness = 0;
// build bool stream to the WORD array // build bool stream to the WORD array
$data_word_stream = array(); $data_word_stream = array();
$data_word = 0; $data_word = 0;
@ -567,7 +566,6 @@ class ModbusMasterUdp {
*/ */
private function writeMultipleRegisterPacketBuilder($unitId, $reference, $data, $dataTypes){ private function writeMultipleRegisterPacketBuilder($unitId, $reference, $data, $dataTypes){
$dataLen = 0; $dataLen = 0;
$endianness = 0;
// build data section // build data section
$buffer1 = ""; $buffer1 = "";
foreach($data as $key=>$dataitem) { foreach($data as $key=>$dataitem) {
@ -576,11 +574,11 @@ class ModbusMasterUdp {
$dataLen += 2; $dataLen += 2;
} }
elseif($dataTypes[$key]=="DINT"){ elseif($dataTypes[$key]=="DINT"){
$buffer1 .= iecType::iecDINT($dataitem, $endianness); // register values x $buffer1 .= iecType::iecDINT($dataitem, $this->endianness); // register values x
$dataLen += 4; $dataLen += 4;
} }
elseif($dataTypes[$key]=="REAL") { elseif($dataTypes[$key]=="REAL") {
$buffer1 .= iecType::iecREAL($dataitem, $endianness); // register values x $buffer1 .= iecType::iecREAL($dataitem, $this->endianness); // register values x
$dataLen += 4; $dataLen += 4;
} }
else{ else{
@ -690,7 +688,6 @@ class ModbusMasterUdp {
*/ */
private function readWriteRegistersPacketBuilder($unitId, $referenceRead, $quantity, $referenceWrite, $data, $dataTypes){ private function readWriteRegistersPacketBuilder($unitId, $referenceRead, $quantity, $referenceWrite, $data, $dataTypes){
$dataLen = 0; $dataLen = 0;
$endianness = 0;
// build data section // build data section
$buffer1 = ""; $buffer1 = "";
foreach($data as $key => $dataitem) { foreach($data as $key => $dataitem) {
@ -699,11 +696,11 @@ class ModbusMasterUdp {
$dataLen += 2; $dataLen += 2;
} }
elseif($dataTypes[$key]=="DINT"){ elseif($dataTypes[$key]=="DINT"){
$buffer1 .= iecType::iecDINT($dataitem, $endianness); // register values x $buffer1 .= iecType::iecDINT($dataitem, $this->endianness); // register values x
$dataLen += 4; $dataLen += 4;
} }
elseif($dataTypes[$key]=="REAL") { elseif($dataTypes[$key]=="REAL") {
$buffer1 .= iecType::iecREAL($dataitem, $endianness); // register values x $buffer1 .= iecType::iecREAL($dataitem, $this->endianness); // register values x
$dataLen += 4; $dataLen += 4;
} }
else{ else{

@ -0,0 +1,12 @@
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title>PhpModbus</title>
</head>
<body>
<a href="examples/">Examples</a><br>
<a href="tests/">Tests</a><br>
<a href="tests/">Tutorials</a><br>
</body>
</html>

@ -1,19 +0,0 @@
Copyright (c) 2004, 2009 Jan Krakora, Wago (http://www.wago.com)
All rights reserved.
Phpmodbus library
####################
Phpmodbus for PHP is a small and easy-to-use Modbus UDP master library. For more
see project at http://phpmodbus.googlecode.com
Release notes
===============
0.1 -> 0.2.r20
---------------
+ Added new class for conversion from received bytes to PHP data types (PhpType class)
+ Added new data conversion using PhpType example
+ Added new alias methods fc3, fc16 and fc23 (ModbusMasterUdp class)
* Fixed problems with the endianess when data written (IecType class)
* Improved commentaries for documentation

@ -0,0 +1 @@
125<br>98<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>255<br>255<br>255<br>255<br>158<br>88<br>97<br>168<br>

@ -0,0 +1 @@
Endianing off <hr>0 --> Packet: 0000_0000_</br>1 --> Packet: 0001_0000_</br>-1 --> Packet: ffff_ffff_</br>2147483647 --> Packet: ffff_7fff_</br>-2147483648 --> Packet: 0000_8000_</br>Endianing on <hr>0 --> Packet: 0000_0000_</br>1 --> Packet: 0000_0001_</br>-1 --> Packet: ffff_ffff_</br>2147483647 --> Packet: 7fff_ffff_</br>-2147483648 --> Packet: 8000_0000_</br>

@ -0,0 +1 @@
Endianing off <hr>0 --> Packet: 0000_</br>1 --> Packet: 0001_</br>-1 --> Packet: ffff_</br>32767 --> Packet: 7fff_</br>-32768 --> Packet: 8000_</br>Endianing on <hr>0 --> Packet: 0000_</br>1 --> Packet: 0001_</br>-1 --> Packet: ffff_</br>32767 --> Packet: 7fff_</br>-32768 --> Packet: 8000_</br>

@ -0,0 +1,12 @@
Endianing off <hr>
0 --> Packet: 0000_0000_<br>
1 --> Packet: 0000_3f80_<br>
-2 --> Packet: 0000_c000_<br>
0.33333333333333 --> Packet: aaab_3eaa_<br>
25 --> Packet: 0000_41c8_<br>
Endianing on <hr>
0 --> Packet: 0000_0000_<br>
1 --> Packet: 3f80_0000_<br>
-2 --> Packet: c000_0000_<br>
0.33333333333333 --> Packet: 3eaa_aaab_<br>
25 --> Packet: 41c8_0000_<br>

@ -0,0 +1,2 @@
Fatal error: Call to undefined method ModbusMasterUdp::writeMultipleCoils() in D:\Projects\20081010_phpmodbus\src\trunk\tests\ModbusMasterUdp\test.fc15fc1.php on line 11

@ -0,0 +1,72 @@
Array
(
[0] => 0
[1] => 0
[2] => 0
[3] => 1
[4] => 0
[5] => 1
[6] => 0
[7] => 255
[8] => 0
[9] => 255
)
Array
(
[0] => 0
[1] => 0
[2] => 0
[3] => 1
[4] => 255
[5] => 255
[6] => 127
[7] => 255
[8] => 128
[9] => 0
)
Array
(
[0] => 0
[1] => 0
[2] => 0
[3] => 0
[4] => 0
[5] => 1
[6] => 0
[7] => 0
[8] => 255
[9] => 255
[10] => 255
[11] => 255
[12] => 255
[13] => 255
[14] => 127
[15] => 255
[16] => 0
[17] => 0
[18] => 128
[19] => 0
)
Array
(
[0] => 0
[1] => 0
[2] => 0
[3] => 0
[4] => 0
[5] => 0
[6] => 63
[7] => 128
[8] => 0
[9] => 0
[10] => 192
[11] => 0
[12] => 170
[13] => 171
[14] => 62
[15] => 170
[16] => 0
[17] => 0
[18] => 65
[19] => 200
)

@ -0,0 +1,11 @@
Warning: socket_bind(): unable to bind address [0]: Požadovaná adresa není v tomto kontextu platná.
in D:\Projects\20081010_phpmodbus\src\trunk\Phpmodbus\ModbusMasterUdp.php on line 78
Fatal error: Uncaught exception 'Exception' with message 'socket_bind() failed.</br>Reason: ()Požadovaná adresa není v tomto kontextu platná.
' in D:\Projects\20081010_phpmodbus\src\trunk\Phpmodbus\ModbusMasterUdp.php:80
Stack trace:
#0 D:\Projects\20081010_phpmodbus\src\trunk\Phpmodbus\ModbusMasterUdp.php(290): ModbusMasterUdp->connect()
#1 D:\Projects\20081010_phpmodbus\src\trunk\tests\ModbusMasterUdp\test.fc16fc3bind.php(13): ModbusMasterUdp->writeMultipleRegister(0, 12288, Array, Array)
#2 {main}
thrown in D:\Projects\20081010_phpmodbus\src\trunk\Phpmodbus\ModbusMasterUdp.php on line 80

@ -0,0 +1 @@
writeMultipleRegister (FC26): DONE

@ -0,0 +1,11 @@
Warning: socket_bind(): unable to bind address [0]: Požadovaná adresa není v tomto kontextu platná.
in D:\Projects\20081010_phpmodbus\src\trunk\Phpmodbus\ModbusMasterUdp.php on line 78
Fatal error: Uncaught exception 'Exception' with message 'socket_bind() failed.</br>Reason: ()Požadovaná adresa není v tomto kontextu platná.
' in D:\Projects\20081010_phpmodbus\src\trunk\Phpmodbus\ModbusMasterUdp.php:80
Stack trace:
#0 D:\Projects\20081010_phpmodbus\src\trunk\Phpmodbus\ModbusMasterUdp.php(410): ModbusMasterUdp->connect()
#1 D:\Projects\20081010_phpmodbus\src\trunk\tests\ModbusMasterUdp\test.fc26bind.php(14): ModbusMasterUdp->readWriteRegisters(0, 12288, 6, 12288, Array, Array)
#2 {main}
thrown in D:\Projects\20081010_phpmodbus\src\trunk\Phpmodbus\ModbusMasterUdp.php on line 80

@ -0,0 +1 @@
32098<br>0<br>0<br>-1<br>-25000<br>25000<br>

@ -0,0 +1 @@
-1<br>0<br>1<br>-2147483648<br>2147483647<br>

@ -0,0 +1 @@
eHll oowlr!da<br>Hello world!<br>

@ -0,0 +1,6 @@
float(4294967295)
<br>int(0)
<br>int(1)
<br>float(2147483648)
<br>int(2147483647)
<br>

@ -0,0 +1 @@
Exception 'Data are not in array 2 or 4 bytes'<br>25602<br>Exception 'Data are not in array 2 or 4 bytes'<br>25602<br>Exception 'Data are not in array 2 or 4 bytes'<br>
Loading…
Cancel
Save