PORTS Forum

Ports and Interfaces => Parallel Port => Topic started by: tomkin on May 03, 2011, 09:30:24 am

Title: Parallel port problem
Post by: tomkin on May 03, 2011, 09:30:24 am
I have got a problem trying to use the parallel port and hope you can help me.

I am writing a program for a cinema using Python. Everything is working already, but there is one unsolved problem - I have to make the dot matrix printer print the tickets, which does not work

After days of searching for a solution I came across your site and inpout32.dll, which I installed. I took the Python sample program written by Lawrie Abbott which I found at http://logix4u.net/ (http://logix4u.net/)

I modified the program and tried to print out the smilie sample of this ESC/P site:
http://de.wikipedia.org/wiki/ESC/P (http://de.wikipedia.org/wiki/ESC/P)

The code for it is written on top to the "Weblinks" of that page.

This is the Pytho code:

============
import ctypes

read = []
for n in [27, 42, 5, 24, 0, 0, 7, 15, 31, 62, 124, 120, 113, 241, 225, 224, 224, 224, 224, 225, 241, 113, 120, 124, 62, 31, 15, 7, 0, 13, 27, 74, 24, 27, 42, 5, 24, 0, 255, 255, 255, 129, 0, 0, 0, 195, 195, 195, 1, 1, 1, 1, 195, 195, 195, 0, 0, 0, 129, 255, 255, 255, 13, 27, 74, 24, 27, 42, 5, 24, 0, 0, 224, 240, 248, 124, 62, 30, 142, 143, 199, 199, 199, 199, 199, 199, 143, 142, 30, 62, 124, 248, 240, 224, 0, 13, 27, 74, 24]:
    ctypes.windll.inpout32.Out32(0x37a, 1)
    ctypes.windll.inpout32.Out32(0x378, n)
    read.append(ctypes.windll.inpout32.Inp32(0x378))
    ctypes.windll.inpout32.Out32(0x37a, 0)

print (read)
============

All data sent out is read correctly by Inp32. But the printer doesn't do anything.

I hope you can give me any tips, what I (or the OS - Win XP) do wrong. I am grateful for any help!
Title: Re: Parallel port problem
Post by: Jan Axelson on May 03, 2011, 11:59:15 am
Be sure you're using the printer's port address as listed in Device Manager.

In the system BIOS, set the printer to SPP mode.

Try printing a few lines of text (ASCII characters) instead of a bit image.

Jan Axelson