In need of Books in Addressing and Bit masking

Discussion in 'Programmer's Corner' started by lio2000, Aug 17, 2011.

  1. lio2000

    Thread Starter New Member

    Jun 1, 2011
    Hi guys
    I posted a some threads related to a project of mine
    it is a Ultrasonic Range Finder

    The Hardware Part
    Ultrasonic Range Finder Project
    (Which I've done with)

    and one is the Software Part
    Simulation of Python Programs

    Now I didn't get any answer in the Software part but it is fine
    so what I need now is this

    I want to connect my circuit to the PC via Parallel Port
    the idea will be is to trigger the circuit through pulses comes from the computer software interface to the transmitter circuit and then read the data returned from the receiver circuit

    what I mainly want is how to address the port and send the right triggers
    now I want to use Python (due it's flexibility) but didn't quite manage to make the address nor find a module to be like an example for me in this matter

    so I need some books and references in how to write the addresses and how to is bit masking can be implemented in Python
    So I can expand my module to process the received data and output the results

    thanks for the help

    P.S: I don't know if I posted this in the right place..but since I'm concerned about programming I thought to posted her rather than the projects forum
  2. cheezewizz

    Active Member

    Apr 16, 2009
    Googling "python parallel port" and the first result is for the pyParallel module. Have you tried that one? on another note, your PC still has a parallel port on it? ..... Wow...
  3. lio2000

    Thread Starter New Member

    Jun 1, 2011
    yeah tried that one and didn't manage to import it

    and yes my PC is kinda of old so it still has this port
  4. someonesdad

    Senior Member

    Jul 7, 2009
    If I were you, I'd certainly spend some effort figuring out how to get the pyParallel module working. Did you read the man page? If you're using Windows or Linux, there are extra instructions you need to pay attention to. I've used the same author's pySerial module for a number of years and had good experiences with it.

    If that can't work, then you can spend some effort finding a DLL that lets you access the parallel port. Once you have that, you can call into that DLL using the python ctypes module.

    I'm not sure what you mean by "bit masking" in this context, but you can do any bit operation you typically can do in e.g. C by using the usual and/or/xor/not operations on python integers. The only twist is that integers can be of any size compared to the usual fixed-size integers in C/C++. If you just have to operate on fixed-size integers, lemme know and I'll post a class I wrote to do so.