HPIB fundamentals and questions

Steve Robertson steerex at mindspring.com
Tue Apr 19 17:03:42 CDT 2005

David Comley wrote:
> Thanks for the help Steve. How something simple like a
> printer ? I have two HPIB printers, one a full-size HP
> line printer and the other a 2225 ThinkJet. Having
> either printer hooked up to Linux would actually be
> quite useful.


About two years ago, I downloaded the GPIB source for LINUX from a
website. I don't recall the URL but you should be able to find it on
google. I never could get it to compile on my LINUX box but, you might
have better luck. I was involved in some other projects so, didn't spend
too much time tinkering with it. If you are proficient in "C" you might
be able to get it to work.

So... If you want to learn the basics of HPIB, hook up one of the
printers to the analyzer and try sending the control sequences. All you
have to do is address the printer to listen to the bus and send an ASCII
string. The printer should print the string as you send it.


1.) Connect the printer to the analyzer with a HPIB cable. No other
devices should be connected.

2.) Set the address switches on the printer to an address between 0 and

3.) Set the analyzer to TALK mode. The HP analyzers have a toggle switch
for this, the Ziatech may be different.

4.) Using the analyzer, send the MLA (My Listen Address) command to the
bus. The MLA command tells a specific device on the bus that the
following data is intended for that device.

5.) Send an ASCII string to the printer.

6.) Send the "UNL" unlisten command to the printer.

What is the difference between a "COMMAND" and "DATA"?
The distinguishing characteristic is the "ATN" (attention) line. This
line can only be asserted by the "CIC" (Controller In Charge) which in
this case is the analyzer. The HP analyzer has a toggle switch that will
assert the ATN line when a data byte in put on the bus. Not sure about
the Ziatech. 

Just to muddle up things, there are "Primary" commands and "Secondary"
commands. your printers will in all likelyhood only use "Primary"
commands. So we'll only deal with those for now.

Primary HPIB commands use the following bit pattern:
[0] [1] [2] [3] [4] [5] [6] [7] 

Notice bit [0] is the most significant bit.

[0] This is generally the parity bit. Most devices don't check for
parity so, we won't worry about it for now.

[1] MTA - This bit sets the device to "TALK". IE: A multimeter would be
set as a talker so that it can send data to the bus.

[2] MLA - This bit sets the device to "LISTEN". Your printer will be a
listener when it is receiving data.

[3][4][5][6][7] - This is the address of the device that the controller
is sending the command to. Notice there are 32 possible addresses.
Generally the primary address will be 0-7.

So... If we want to send a string to the printer, from the analyzer send
the "MLA" command:

ATN + [0][0][1][x][x][x][x][x] 

Where "xxxx" is the address of the device as set by a dip switch on the
device. At this point, the device at "xxxx" is a listener and will
respond to any data that is sent.

Now toggle in the ASCII string and send it one byte at a time. NOTE: ATN
is NOT asserted when sending the data.

[0][0][1][1][0][0][0][0] = "0"
[0][0][1][1][0][0][0][1] = "1"

Some printers will wait for a "CR/LF" before printing anything. Not sure
about yours.

When finished printing, the device will expect an "UNL" (unlisten)
command. This tells the printer to ignore any following data because it
could intended for a disk or some other device.

To UNL, send the following command:

ATN + [0][0][1][1][1][1][1]

I know my instructions are disjointed and I hope you can make sense of
them. If this doesn't help, let me know and I'll give you some
additional help. 

See ya,

ebuta bit  this is kinda disLet

More information about the cctalk mailing list