Zend - The PHP Company




External

Add Code


Input Output Library  

Type: application
Added by: e1130
Entered: 02/03/2006
Last modified: 03/12/2005
Rating: - (fewer than 3 votes)
Views: 4908
This extension allows the direct access the parallel and serial(rs232) port in reading and writing by the DLL inpout32.dll under WIN9x/NT/2000/XP for any assembly. An example of concret application? Complete house automation with Web interface and php, connection hardware of any nature with the ports like assemblies simple or to complicate. One idea simple but quite practical... Extension and source was compiled with Delphi 6, sources and example included.


Link to download the complete project :
http://www.phpcs.com/code.aspx?ID=36224

Functions : 
  
int iol_input(integer pattern) 
boolean iol_output(integer pattern, integer pattern) 
string iol_info() 
  
iol_input(port) 
iol_output(port, value) 
iol_info() 
  
Exemple : 
  
File iol_ouput.php,
<?php 
    
require_once("class/php_iol.class.php"); 
    
$DemoPhpIOL = new php_iol(); 
  
    for(
$i=0$i<255$i++) { 
        
$DemoPhpIOL->WriteIOOutput(888$i); // 888dec of 378hex 
        
usleep(1550); 
    } 
  
    echo 
"Output port 888(378h) value 0 : "
    if(
$DemoPhpIOL->WriteIOOutput(8880)) {echo "Ok";}else{echo "Error";} 
?> 
  
File iol_input.php,
<?php 
    
require_once("class/php_iol.class.php"); 
    
$DemoPhpIOL = new php_iol(); 
    
$RcvByte $DemoPhpIOL->GetIOInput(889); // Base(378h) + 1 = 889 
  
    
echo "<b>Input value : ".$rcv."</b><br>"
    if(
$RcvByte 127) { 
    
$RcvByte $RcvByte -128
    echo 
"Busy : true<br>"
    }else{ 
    echo 
"Busy : false<br>"
    } 
  
    if(
$RcvByte 63) { 
    
$RcvByte $RcvByte -64
    echo 
"Ack : true<br>"
    }else{ 
    echo 
"Ack : false<br>"
    } 
     
    if(
$RcvByte 31) { 
    
$RcvByte $RcvByte -32
    echo 
"Pe : true<br>"
    }else{ 
    echo 
"Pe : false<br>"
    } 
     
    if(
$RcvByte 15) { 
    
$RcvByte $RcvByte -16
    echo 
"Select : true<br>"
    }else{ 
    echo 
"Select : false<br>"
    } 
     
    if(
$RcvByte 7) { 
    
$RcvByte $RcvByte -8
    echo 
"Error : true<br>"
    }else{ 
    echo 
"Error : false<br>"
    } 
?> 


Usage Example


See the example


Rate This Script





Search



This Category All Categories