Writing pins to the RS232
Paul Watson
pwatson at redlinepy.com
Sat Nov 26 11:18:47 EST 2005
jay.dow at gmail.com wrote:
> I want to write to the pins of an RS232 without using the serial
> protocol. The use would be every pin could act to complete a circuit
> in customized hardware. I could use python to communicate serially to
> a BASIC stamp or a Javelin stamp and then use the stamp to set however
> many pins as 0's or 1's but should it be that hard to do with python.
> I've looked through how python does serial with the "serial" module but
> it just uses Java's javax.comm libraries. Is there anyway to do very
> low level device writing to COM ports?
>
> In summary I'm looking for something like:
> ser = serial.Serial(0)
> ser.pin0 = 1
> ser.pin1 = 1
> ser.pin2 = 1
> ....
>
>
> or
> ser.write('0xFF')
> which would set 8 pins on the RS232 cable to 1's
>
Accessing hardware at this level is almost always managed by some form
of device driver in any real operating system. Even Microsoft Windows
has device drivers for serial and parallel ports. This is not your
father's MS-DOS any more. It would be a security breach to allow user
applications direct access at the hardware level.
Also, if you ever hope to run on anything except an IBM-PC clone, then
the hardware will be different. Even systems that run x86 processors
like the NEC PC-98 have 8255 parallel interfaces, but they are located
on different ports in the machine.
More information about the Python-list
mailing list