|PHP stuff page|
PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. And much more ...
On this page you will find a some scripts or tools I have written quick'n'dirty for use with PHP. They are used in real-world environment and are considered very useful for a long period. This may not necessarily be the case for everyone else than me, but they may at least be a starting point for you and leave room for your own modifications.
A replacements for the Windows 'mode' command.
The main problem using PHP for serial communication on a Windows PC is the fact that there's no way to set up the port timeouts correctly. A PHP script that opens a COM port for communication with a serial device such as a modem will always wait for a timeout that is set to 60000ms by 'mode' when expecting data coming in. Setting the stream to non-blocking doesn't help.
SerConf has the ability to set up the port timeouts. It's in fact a setup tool for the SetCommState and SetCommTimeouts Windows functions. It does no console setup and offers no lpt redirection as 'mode' does.
serconf com3 baud=38400 stop=1 parity=none handshake=both rtimeout=10 wtimeout=10
help (called without parameter):
SERCONF version 0.3 Usage: serconfDownload the SerConf tool