|Re: HP-41/PC User-Code Transfers and Barcodes|
Message #3 Posted by Steve on 26 May 2000, 8:27 p.m.,
in response to message #2 by Leo Duran
HP41 barcode has 2 start bard and 2 stop bars (they are different so that the wand can figure out which way you're scanning).
For the beginner the problems are:
1) how to get the bars to print correctly. The trick is a) having the thick bars twice as wide as the thin bars and the gap between them a fixed (thin bar) width. This is a relatively simple requirement.
b) having the bars print dark enough and with sufficient edge definition. This is child's play these days, but was a real problem with the older Epson FX-80 printers! A note to those that try it. I have made bar code that has 1 pixel wide thin bars (and gaps) and 2 pixel wide thick bars, and used a program like photoshop to blow it up to a reasonable size for printing (makes the stored program small). If you do this, make absolitely sure that the program that blows up the bar code keeps the sharp edges, and doesn't fade them from black to white at the edges. My first try did this, and although seemingly OK to the naked eye, refused to read at all.
c) printing them large enough. Have a look at your favorite PPC issue, or Wlodek's red book for examples of the smallest practical size
d) beware dot gain. Not a huge problem today, but one that was an issue for small bar code on certain dot matrix printers (and lithographic reproduction). The black dots spread slightly wider than they should, widening the bars, and thinning the gaps. The barcode manual gives you the limits for this, but if you're printing on a laser, even at 300 dpi with a HUGE dot gain, you'd never even get close to having to worry. Same for today's inkjets.
2) getting the byte sequence. Well, at least that's been solved :-)
3) creating the checksum byte. From memory it's a 1 byte end around carry checksum, but there are several examples in bar-code printing programs (for the HP41) on the net, or read the manual (And it's a good scan too :-)
4) Calculating the byte containing the count of bytes preceeding/following this row of bar-code. A byte in the header contains 2 4 bit fields that tell the HP41 if an instruction is split across the boundary between one bar row and another. To figure this out, you need to have your bar-code program understand the HP41 byte table. You can fudge this and place $00 in this byte, but if you ever have an unreadable row, you may be left with bytes before and after that are incomplete instructions. This can cause some interesting effects.
5) Pretty printing. Well, we _all_ want it to look nice :-) Again, fairly trivial in windows.
A _really_ easy way of printing barcode is to use MS-WORD to format a text document. The text document might look like this:
(I bet it doesn't format right)
|| | || || | ||...
then you use word to change the horizontal spacing until the vertical bar characters join up (use a fixed font like courier). You may have to use 4 bars for a wide bar, 2 for a narrow, and 2 spaces for a space.
This makes it _really_ easy without going through hoops to create the graphics.
If you're really clever you set up a style for the compressed vertical bars, then you can send the word document to almost anyone. By using a style, the recipient can easily change the horozontal spacing, should it not suit their printer.