Using serial ports

View: New views
3 Messages — Rating Filter:   Alert me  

Using serial ports

by David McNab-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm able to open COM1: serial port with the usual file() function, and
write to it with the normal write() method.

But how do I set the speed and other line parameters?

If I try to import the 'tty' module it complains that there's no
'termios' module.

Also, I tried the 'ceserial.py' module which has popped up on some
discussions, but it crashes in its Serial.open() method with a most
unhelpful exception string '50'.

What's the best way to go about using serial ports in pythonce?

Thanks in advance for your help

Cheers
David



_______________________________________________
PythonCE mailing list
PythonCE@...
http://mail.python.org/mailman/listinfo/pythonce

Re: Using serial ports

by David McNab-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, 2009-05-31 at 23:08 +1200, David McNab wrote:
> Also, I tried the 'ceserial.py' module which has popped up on some
> discussions, but it crashes in its Serial.open() method with a most
> unhelpful exception string '50'.

More info on that:

Seems that Serial.open() gets a bad return code when it calls
windll.coredll.SetupComm() to set the buffer sizes. If I comment out the
exception, then self._configurePort crashes with the same exception.

I'm trying to open COM1: on an h4350.

Can anyone please shed some light.

Thanks
David



_______________________________________________
PythonCE mailing list
PythonCE@...
http://mail.python.org/mailman/listinfo/pythonce

Re: (Solved!) Using serial ports

by David McNab-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

It seems the problem is triggered by setting the baudrate prior to
calling the '.open()' method.

The following works:

    from ceserial import Serial, SerialException
    port = Serial(port='COM1:')
    port.open()
    port.baudrate = 115200

The following fails:

    from ceserial import Serial, SerialException
    port = Serial(port='COM1:')
    port.baudrate = 115200
    port.open()

This fails too:

    from ceserial import Serial, SerialException
    port = Serial(port='COM1:', baudrate=115200)
    port.open()

Cheers
David

On Mon, 2009-06-01 at 09:27 +1200, David McNab wrote:

> On Sun, 2009-05-31 at 23:08 +1200, David McNab wrote:
> > Also, I tried the 'ceserial.py' module which has popped up on some
> > discussions, but it crashes in its Serial.open() method with a most
> > unhelpful exception string '50'.
>
> More info on that:
>
> Seems that Serial.open() gets a bad return code when it calls
> windll.coredll.SetupComm() to set the buffer sizes. If I comment out the
> exception, then self._configurePort crashes with the same exception.
>
> I'm trying to open COM1: on an h4350.
>
> Can anyone please shed some light.
>
> Thanks
> David
>
>
>
> _______________________________________________
> PythonCE mailing list
> PythonCE@...
> http://mail.python.org/mailman/listinfo/pythonce

_______________________________________________
PythonCE mailing list
PythonCE@...
http://mail.python.org/mailman/listinfo/pythonce