View Single Post
  #16  
Old December 12th 10, 05:26 AM posted to comp.periphs.printers
Andrew Smallshaw
external usenet poster
 
Posts: 115
Default Interfacing the printer port

On 2010-12-09, David wrote:
I sort of have it working, but it is incredibly slow...

I have set up a Generic / Text only printer on my Win7 machine and am
reading the data on my XP machine via a USB input output device.

The /Strobe is normally high, but flicks low to tell the printer that data
is on the bus.

It seems that strobe is held low until a busy (high) is received. However,
as I am polling my I/O device (no other way, as it doesn't have an
interrupt), I appear to be missing the strobe, but I have worked another way
around it. (What I ended up doing is I needed to know I was in the same
character, the only way I could do that was electronically rather than
programmatically, I ended up tying the BUSY (output line on my USB) to a
spare input line (on my USB), so that I know that while I have a high on my
local busy, I don't attempt to poll the next character)

I was getting something like....


TTTTTThhhhiissssss isssssaaaaa eeeest

(This is a test)

However, I am now getting the proper text, but for some reason, it is
incredibly slow. I will look at speeding it up somehow.


I see two reasons for that: firstly you are not acknowledging the
bytes sent - not all host interfaces check them but ISTR the Windows
driver for a standard prallel port is one that does. That means
it has to time out before sending a new byte.

Secondly you don't say what you mean by your "USB" but I assume
you mean a general purpose interface board. That is going to cause
issues in and of itself. USB is not very fast when it comes to
latency - don't expect anything to happen faster than a couple of
milliseconds. If you want to do this via polling the polling
frequency must be fairly fast - 2MHz or greater - and quite simply
USB is not up to the job.

The way I would suggest therefore needs some additional logic to
make up for the deficencies of your interface. For a start I would
drop an octal latch or D flip flop in there so you grab hold of
the data when the strobe is lowered. I would also hook up the
strobe line to an SR flip flop - you can check if it is set to see
if a character has been resceived and then reset it via software.
I'd also use that flip flop output to drive the BUSY line so that
is asserted automatically until you clear it. You may be able to
get away with a software controlled acknowledge line but I'd be
tempted to drop in a monostable triggered by the falling edge of
the BUSY signal - a 555 should be perfectly up to that job.

--
Andrew Smallshaw