Python routines for driving a Microwire serial port? like on AD Converter

Cary O'Brien cobrien at Radix.Net
Tue Oct 10 12:22:18 EDT 2000


In article <39DCDB20.5A1FE2B0 at home.com>, rob  <europax at home.com> wrote:
>Has anyone ever tried using Python on NT for driving a Microwire serial
>port?  Its used on many IC's for implementing digital control. e.g. AD
>converters.  I would think that perhaps the pc parallel port could be
>used in some way to implement this.  I have seen proprietary
>schemes/boxes for this but have no idea how they work. 
>

I wrote a program to program some little 8-pin serial eeproms once[1]. 
This was on a linux/x86 box, and I had to put together a cable/socket
that ran from the parallel port to the socket.

It had to run as root so it could make the ioperm() call to map the IO ports.
Then outb() and inb() from asm/io.h would work.

What I ended up doing was writing a very small C program to just do
read/write/ erase/enable/disable, and wrapped this in an interactive
TCL script that figured out what needed to be in the eeprom called the
(SUID-ROOT) C program.

You could do the same (i.e. write a tiny C program) and call it from Python.

One hint:  The damn C program wouldn't work without being compiled with -O.
Wierd.  Go figure.

-- cary





More information about the Python-list mailing list