Anyone got a serial to parallel converter lying around that they'd like to
convert to beer tokens? I need to take in RS232 data at 9600 baud and bung
it out to a Centronics equipped laser printer, so it's relatively low spec.
AWEM
I have a feeling that my first laser printer had parallel *and* serial
inputs. I presume you're sure that yours doesn't?
Is this a one-off job, or an ongoing requirement? I was wondering
whether you could use a computer as the converter?
The only stuff I can see on Ebay is USB to serial or USB to parallel,
but not what you need.
Its one of those things that used to be common, but is now quite
difficult to find at a sensible price. Black Box will do you one for
£100 and up, but probably not really the sort of money you are looking for!
There is a DIY option:
formatting link
Failing that, it would also be trivial to do on a PC, but that is a bit
big for a fit'n'forget interface box!
Indeed, although its worth remembering that reading from the serial port
using any technique that uses the BIOS serial comms routines, is often
rather dissapointing in performance, and often results in occasional
loss of characters - especially if you are running 3 wire with no
handshaking (the serial input BIOS code is polled and makes no use of
the FiFo (if present) - and so is frequently as much use as an ashtray
on a motorbike). Having said that, its trivial to write your own ISR for
it instead and sidestep the system code, then you can quite happily
swallow 115k2 without handshaking.
No doubt you can set the baud rate on the source to limit overruns, but
it's not difficult to program hardware or xon/xoff flow control. It's
easier though just to limit the baud rate at source and most pc uarts
have a fifo these days anyway.
I would write it in Borland or Watcom C, both free, where you have support
for flow control in the serial line library functions, but that's just my
own preference.
As another option, I have hp 1630g and hp16500A logic analysers in store
which do have hpib interfaces and the 16500A has also has the option of
selecting hp laserjet printer via serial interface...
Regards,
Chris
Do they allow you to read and write the I/O address space, such as the
parallel port data, control, and status registers beginning at hex
378?
I've stayed with QBasic under DOS because Windows polls the port and
hampers using it to control external hardware, which I need more than
a pretty user interface. Visual Basic dropped the INP and OUT
instructions.
jsw
Indeed its easy if you write all your own low level code and bang the
hardware directly. I was just highlighting it does not work well if you
use a IO stream abstraction that ends up using the ancient Int 14 IO
routines in the BIOS.
I toyed with the idea of buying a 1630g on ebay the other day (went for
£56) ;-)
Linux has proper interrupt driven drivers for serial and parallel.
So all you need is a straight distro install and then write a silly
little daemon that does wait, fetch, and push, on the ports.
Probably about 20 lines of C, if that.
I'm no expert on dos, but do remember that Borland had very well thought out
librbary functions for i/o control. Pretty old now, but still very usable
for a certain class of work, or quick hacks.
I imported mine from the us a few years ago when they were costing 500+
ukp each
or so in the uk. Twas worth it, even with the shipping and import taxes.
They are
good analysers for their time, but the menus are far from intuitive and
you really
need the manual for the finer points. The 16500 series are a different
class:
Intuitive, easy to set up, colour screen., loads of slots for different
options,
including scope cards. The 16700 are even better, but still very
expensive, even
on fleabay.
Iirc, the last thing I used the 1630G for was to format the hard drive
in an old
hp hpib hard drive / floppy peripheral box. Quite usefull for that sort
of thing.
When I mentioned Borland or Watcom, I did assume dos operation. Have
managed to
avoid ever having to program windows, thankfully :-)...
Regards,
Chris
So don't run QBASIC (or any other MS-DOS program). The free trial
version of 'BBC BASIC for Windows' is easily powerful enough to do
this with no danger of data loss, and without faffing around with
Interrupt Service Routines and the like:
Windows NT (i.e. all modern versions of Windows) won't let you access
the hardware ports directly from user code. You would either have to
use the Windows device drivers (which for serial and parallel ports
should be fine) or use a kernel-mode port driver such as INPOUT32 if
you're doing non-standard bit-banging. Using the standard drivers has
the advantage of supporting USB serial and parallel adaptors as well
as 'real' hardware ports.
Both approaches should be viable from any respectable Windows
programming language. In some the support for INP and OUT is built in
for no extra effort; one of those is LBB:
formatting link
In others, such as BBC BASIC, you have to do it at a slightly lower
level:
-Windows NT (i.e. all modern versions of Windows) won't let you access
-the hardware ports directly from user code. You would either have to
-use the Windows device drivers (which for serial and parallel ports
-should be fine) or use a kernel-mode port driver such as INPOUT32 if
-you're doing non-standard bit-banging. Using the standard drivers
has
-the advantage of supporting USB serial and parallel adaptors as well
-as 'real' hardware ports.
-Both approaches should be viable from any respectable Windows
-programming language. In some the support for INP and OUT is built
in
-for no extra effort; one of those is LBB:
-Richard.
I'm running a QBasic LPT port register monitor I wrote. QB runs fairly
well in NTVDM (Virtual DOS Machine) under XP, from a small FAT32
partition. I can toggle the state of Control bits C1-4 and the 8 Data
lines, but every few seconds XP blips and resets the control bits,
even if I'm typing here and the DOS window doesn't have focus.
Strobing C0 gets XPs attention and several control and status bits
change. I need those control lines unencumbered to mux target device
address and data registers.
jsw
Not surprising if the port is under the control of Windows. To gain
exclusive access to a parallel port I would expect either to need to
open it in Windows, or to uninstall it so that Windows ignores it
altogether.
Generally I would much prefer to use a hardware interface designed for
the purpose, such as a USB I/O card (e.g. as available from Velleman
and others). Then you know you have full control and Windows won't
interfere.
Richard.
-Generally I would much prefer to use a hardware interface designed
for
-the purpose, such as a USB I/O card (e.g. as available from Velleman
-and others). Then you know you have full control and Windows won't
-interfere.
-Richard.
formatting link
I have a serial-port four channel data acquisition device and a
serial-port optoisolated DVM, my only instrument that can report
240VAC voltage or current. Their datalogging programs will run
concurrently under Windows but they aren't synchronized. QBasic allows
me to operate both together, detect start/stop/error conditions and
send appropriate control signals out the LPT port.
Some day I will rework a wirewrapped 16 bit A/D board I originally
built for the Mac NuBus, and got back when the project ended, into a
high-quality parallel port voltage, current and thermocouple
datalogger. The Compaq Armada laptop that will run it uses only 7W
from an external 12V battery with the LCD turned off. It will be like
having OpenOffice Calc on an Arduino.
jsw
Fair enough, but having to use an obsolete OS and being unable to run
your program on a 64-bit platform (without a virtual DOS box) are high
prices to pay IMHO. I recommend re-writing the program in a Windows
BASIC (of course I'm prejudiced and would suggest BBC BASIC - there's
even an automated QBASIC to BBC BASIC translator that will do most of
the work). That would give you all the benefits you mention but with
a modern OS and GUI.
Richard.
PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.