PHP Serial extension reference

Website: http://www.easyvitools.com

Installation:
- download from website
- unzip php_ser.zip and place php_ser.dll file in PHP extension folder.
For PHP5 this is usualy: drive:\PHP_install_folder\ext\
Example: C:\PHP\ext\
- find php.ini file (usualy placed in C:\Windows folder) and open it
- fill extension_dir directive with extension folder, for example:
extension_dir= ".\ext"
- fill an extension directive to load php_ser automatically:
extension=php_ser.dll
- save and close php.ini file
- test with php_ser_test.php file (included in distribution), which lists functions

Functions reference:

string ser_version( void )
    Returns extension version as string, example 10032006.1.

void ser_open( string port, int baudrate, int databits, string parity, float stopbits, string flowcontrol )
    Opens serial port.
    port: a valid port name, in upper case, such as "COM3"
    baudrate: valid baudrates are: 110,300,600,1200,2400,4800,9600,14400,19200,38400,56000,57600,115200
    databits: valid databits are: 5,6,7,8
    parity: valid parities are: None,Odd,Even,Mark,Space
    stopbits: valid stopbits are: 1,1.5,2
    flowcontrol: valid flowcontrols are: None,Hardware,Software
    Example:
    ser_open( "COM1", 115200, 8, "None", 1, "None" );

string ser_isopen( void )
    Returns a string describing port properties if open, empty string if closed<.br>     Example:
    $str = ser_isopen();
    echo "Port: $str";

    Outputs following string on web page: Port: COM3 115200 8 None 1 None.

void ser_close( void )
    Closes serial port.

void ser_setDTR( bool Signal_state )
    Set DTR signal as specified by Signal_state parameter, true or false.
    Example:
    ser_setDTR( True );
    This procedure raises DTR.

void ser_write( string data )
    Writes data string to the serial ports.
    Example:
    ser_write( "Hello from PHP" );
    This procedure sends "Hello from PHP" to serial port.

string ser_read( int chars_no )
    Reads data from serial port until chars_no characters are received or timeout occurs.
    Example:
    ser_read(512);
    echo "Received: $str";

    Outputs following string on web page: Received: Hello from PHP.

Software is in continuous development, please check website for updates.

Copyright 2006, Cosmin Buhu