Re: How to write and read serial or parallel port
| From: | Alex Nikitin | Date: | Thu, 26 Jul 2012 12:37:34 +0000 |
| Subject: | Re: How to write and read serial or parallel port | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-318566@lists.php.net to get a copy of this message | ||
On Thu, Jul 26, 2012 at 6:24 AM, Lester Caine <lester@lsces.co.uk> wrote:
> viper wrote:
>>
>> is it possible to write and read data on a COM or LPT port?
>> is there any function or class in PHP?
>>
>> anyone has already done something similar?
>
>
> Talking in and out of the serial port is not too difficult but is OS
> dependent, so what are you wanting to run on? Most of the time you are just
> copying files in and out, although one can use the control signals as simple
> I/O if you only need a couple of controls.
>
> Parallel port is a minefield on Windows as access is specifically blocked in
> XP onwards. You need a modified device driver to bypass the blocks windows
> puts in. I've not tried that with PHP as I'm normally accessing the parallel
> port direct from other windows programs.
>
> Linux is lot easier, and most of the examples you will find via google are
> geared towards that. It works like DOS used to :)
>
> --
> Lester Caine - G8HFL
> -----------------------------
> Contact - http://lsces.co.uk/wiki/?page=contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk
> Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
So for serial for example, you can just open the port up and work with
it like a socket; read/write binary data. As far as parallel port
goes, trickier, you may need to call out to an external program, or
write a module if you need direct interaction in php. Real question is
why in the world would you want to use PHP for this to begin with. I
mean sure you can write your own vfat implementation in PHP, etc, etc,
but it doesn't mean that it's a good idea to do so.
-- Alex
--
The trouble with programmers is that you can never tell what a
programmer is doing until it’s too late. ~Seymour Cray