Star Micronics NX-10 User Manual

Specifications and Main Features

  • Model: NX-10
  • Category: Dot Matrix Printer
  • Interface: Parallel Connector
  • Power Supply: Regular Electricity Source
  • Print Head: 09 Pin Piston
  • Printing Speed: Up To 120 Characters Per Second
  • Included printer modes: Draft Printing, NLQ, Italic, Bold, Expanded, Condensed and Proportionally spaced
  • Character set: Supports the standard English Alphabet and special characters
  • Paper handling: Can print on single sheets as well as continuous fan-fold pieces of paper
  • Control panel: LED Indicators for power, draft mode and NLQ mode, control keys for multiple functions
  • Computer Compatibility: Can be used with IBM PC; Apple II; Commodore C-64; TRS-80
  • Overall dimensions: Not given
  • This product weighs: Not given
  • Electric requirements: Not given
  • The sound level: Not given
  • Validity of Warranty : Not given

Frequently Asked Questions

Q: Describe the procedure for Printer and computer interconnections?

A: Use the interface cable with one end to connect the printer with the back panel’s socket and the other end to your computer after switching on both the devices.

Q: What varieties of paper can be used for this printer?

A: Single sheets (stationery, envelopes) or continuous sprocket-feed paper can be dry feed through this printer.

Q: What are the steps involved in changing the ribbon cartridge?

A: First, switch off the power, then take out the cover of the printer and shift the print head towards the center. Now press down the cartridge till the holders have caught the springs together and put it back together again.

Q: What if the printer does not print?

A: Ensure proper checking of whether the printer is switched on, whether the ribbon cartridge has been placed inside properly, whether the paper is picked up and whether the printer is working online.

Q: Does the printer still support several modes while in use?

A: Certainly, the printer has several modes of printing some which include draft, italic, near letter quality, bold, expanded, condensed, and more modes such as proportional.

Q: How can I do a self-test on the printer? Please provide unnecessary details.

A: Place an intended paper sheet in there and press the paper feed key as you turn the power to perform self-test number 1, second one requires you to long press the on-line key.

Q: How can I check there is no warranty for this printer?

A: Warranty issues are sometimes included in the manual and sometimes are not, therefore talk to your retailer to raise such queries.

User Manual

NX-10
USER’S MANUAL
NOT INTENDED FOR SALE
PN 80820128
Federal Communications Commission
Radio Frequency Interference
Thw rquipment generates and uses radio frequency energy and if not installed and used properly. that is. in strl~“l accordance Lvith the manufacturer’s instructions, may cause in­terference to radio and [etexxion reception. It has been type tested and found to comply with the limits for a Ctavs B computing device in accordance wth the specifications in Subpart J of Part 15 of FCC Rules, ivhich are designed to provide reasonable protection against such inrerfcl-ence in a residential installation. Ho~vever. there is no guarantee that interfrr-ence ~?ll not occur- in a particular installation. If this equipment does ~tuse interference to radio or telex-ision reception. which can be determined by turning the equipment off and on. the user is encouraged to try to correct the interference by one or more of the folk)\\-ing measures:
l Reorient the receiving antenna
oRelocate the computer \vith respect to the receiver
l Slovv the computer away from the receiver
l Ptug the computer into a different outlet so that computer and receiver are on dif-
fercnt branch circuits.
If necessary. the user should consult the dealer or an experienced radioitete\,isiorl techni­cian for additional suggestions. The user map find the following booklet. prepared h! the Federal Communications Commission helpful: “Ho\r to Identify and Kesotve Radw T\’ Interference Prohlrms. PI-inting Office. LVashington. D.C.. 20402. Stock No. 001-000-00345-4.
For compliance with Federal Noise Interference Standard. this equipment requires a shielded cable.
Radio interferences regarding this equipment has heen eliminated according to Vfg
lO-l6/1984 announced hy the DBP. DBP has been informed about the introduction of this special equipment and has been conceded the right to esamiw the whole series. It is upon the responsibility of thv user to assume that his own asscmhted system is in ac cordance with the technical regulations under Vfg lOltiilYX4. To observe FTZ-regulations it is necessary. to establish all connections io the printer \vith shielded cable.
” This hooklet is available from the I’.S. Government
Self Declaration
Trademark Acknowledgement
NX-10, grafstar: Star Micronics Co., Ltd. r\pple, Apple II, ;2pple II - , Apple II e, Applesoft: Apple computer Inc
Commodore C-&l: Commodore Business Slachines. Inc. Compaq: Compaq Computer Corporation CI’IM: Digital Research IBM Personal Computer, IHM LX: International Kusinehs Machines Corp. Kaypro: Kaypro Corporation Microsoft Rr\SIC: Microsoft Corporation Osborne 1 : Osborne Compu~el- Corporation TRS-80: Radio Shack. a division of Tandy Corporation
NOTICE
l A1l rights reserved. Reproduction of any part of this manual in any form what-
soever, without STAR’s express permission is forbidden.
l The contents of this manual are subject to change without notice.
l All efforts have been made to ensure the accuracy of the contents of this manual at
the time of going to press. However, should any errors be detected, STAR would be greatly appreciate being informed of them.
l The above notwithstanding, STAR can assume no responsibility for any errors in
this manual.
Topyright 1986 Star Micronics Co., Ltd.
Table of Contents
Chapter 1
Chapter 2
Setting Up Your Printer
Where shall we put it? What have we here?
Removing the printer cover Removing the packing tube Installing the ribbon cartridge
Getting to Know Your Printer
Controls and parts of the printer
Parts of the printer Controls and indicators Extra functions
Other controls
Selecting and loading paper
Loading single sheets
Loading sprocket-feed paper Adjusting the print head Connecting the printer Extra functions with the control panel
Self-tests
Hex dump
Panel mode
Italic mode Italic and Panel mode Setting print start position Setting the left and right margins
7
Chapter 3 Basic Printing
Some basics of BASIC
A new language! First steps ASCII codes and the CHR$ function Control codes The escape codes A note on command syntax
Some special kinds of text
Near Letter Quality characters Italic printing Underlining
Superscripts and subscripts
Changing the print pitch
Expanded print Condensed print
Proportional printing Making words stand out Mixing print modes
Chapter 4 Formatting Text
Lines and line spacing
Starting a new line
Reverse line feeds
Changing the line spacing Moving down the page without a carriage return
Page control
Form feed Reverse form feed
Changing the page length Top and bottom margins Setting left and right margins Horizontal and vertical tabs
Horizontal tabs
One-time horizontal tabs
Vertical tabs
Vertical tab channels
Centering and aligning text
23
41
Chapter 5
Special Features of the Printer
Now hear this Resetting the printer Putting your printer to sleep Printing the bottom of the sheet Backspace, delete, and cancel text Printing zeroes Immediate-print Adjusting the width of space between characters Uni-directional printing The seven bit dilemma Block graphics characters and special symbols International character sets Printing characters in the control code area Printing BIG characters The optional sheet feeder The macro control code Reading a hex dump
61
Chapter 6 Creating Your Own Characters
Dot matrix printing The print matrix Defining your own characters
Rule 1: Draft download characters are eight dots high Rule 2: Dots cannot overlap Add up each column of dots Assigning a value to your character
Download character definition command Printing download characters Defining proportional characters Defining NLQ download characters
81
Chapter 7 Dot Graphics
Comparing dot graphics with download characters Using the dot graphics commands
Specifying the number of columns of dots Specifying the graphics data
Combining text and graphics Printing a design or logo Plotting with your printer
How the program works
High resolution graphics Compatibility with existing software More graphics programming tips
Redefining alternate graphics codes g-pin graphics mode
Chapter 8 Caring for Your Printer
Cleaning the printer Replacing the ribbon
Replacing the print head
Appendix A DIP Switch Settings
Switch functions
Appendix B
ASCII Codes and Conversion Chart
Appendix C Character Fonts
Roman characters
Standard characters (Set #l and Set #2) Special characters (Set #2 only) International characters
Italic characters
Standard characters (Set #l and Set #2) Special characters (Set #2 only)
101
123
131
135
143
Appendix D Function Codes
Commands to control print style
Font style controls Font pitch controls Special print modes
Controlling the vertical print position
Line feed and reverse line feed Form feed and related commands
Top/bottom margins and vertical tabs Controlling the horizontal print position Download character commands Dot graphics commands Macro instruction commands Other commands
165
Appendix E Command Summary in Numeric
Order Appendix F Technical Specifications Appendix G The Parallel Interface
Functions of the Connector Signals
Appendix H Connecting with Computer
Connecting with IBM-PC and COMPAQ
BASIC programming Listing programs
Connecting with Apple Il computers
Applesoft BASIC Listing programs
Connecting with TRS-80 computers
TRS-80 BASIC
Listing programs
Connecting with Kaypro, Osborne, and other
CP/M computers
Using MBASIC
Listing programs
209
213 217
221
CHAPTER 1
SETTING UP YOUR
PRINTER
Subjects we’ll cover in Chapter 1 include-
. Choosing a suitable place for your printer;
l Unpacking your new printer; l Setting it up.
WHERE SHALL WE PUT IT?
Before you do anything else, give some thought to where you’ll be using your printer. Obviously, it will be somewhere near your computer. And both printer and computer will lead longer, healthier lives if they like their surroundings. For in­stance, we recommend.. .
,
l Using the printer on a flat surface. l Keeping it out of direct sunlight and away from heat-
producing units.
l Using it only in temperatures where you are comfortable. l Avoiding areas with a lot of dust, grease, or humidity. l Giving it “clean” electricity. Don’t connect it to the same
circuit used by large, noise-producing appliances (such as refrigerators).
l The line voltage should be the same voltage that’s
specified on the identification plate - within 10% of the recommended voltage.
2
WHAT HAVE WE HERE?
Now let’s take a look at what’s in the carton. Open it up and
check each item in the box against Figure l-l. There should be
four items.
. . -- -_ _
F
‘igure l- 1.
2) paper guide, 3) ribbon cartridge, and 4) user’s manual.
Check to make sure you have all four items: 1) printer,
Let’s move on the next step.
n Removing the printer cover
The cover is important for two reasons - it keeps dust and dirt away from the printer’s delicate “innards,” and it quiets the printer’s operation. Don’t take off the cover except when you have to change the ribbon, or to make an adjustment.
Removing the printer cover is easy. Lift up the back of the cover to disengage the two tabs at the front and then lift it off the rest of the way. To replace it, just slide the tabs in at the front and lower it into place. Figure 1-2 shows the proper posi­tion and movement for both removing and replacing the cover.
3
.I,
.gure 1-2. Remove the printer cover by lifting carefully.
n Removing the packing tube
The printer is shipped with a protective spiral tube to keep the print head from being damaged in transit. We have to remove this tube. First, remove the printer cover. See the tube on the carriage rail (Figure l-3). Pull it off carefully.
.
Figure 1-3.
Remove the protective tube from the carriage rail.
Up to this point, we’ve been clearing the decks for action, so to speak. Only one more thing left to do before we can start printing - install the ribbon cartridge.
n Installing the ribbon cartridge
This printer uses a neat, easy-to-change ribbon cartridge so you don’t have to spend a lot of time threading a ribbon. And get­ting your hands all dirty to boot.
Telling you how to put in a ribbon is like explaining how to tie your shoelaces - it takes a lot longer to tell than to do. You can
just follow the illustrations if you wish; they’ll tell you all you really need to know.
Or, if you feel better following written instructions, read on.
1. Turn off the power and remove the printer cover.
2. Now slide the print head gently to the center of the printer.
Warning: The print head gets hot during operation, so
let it cool off before you touch it.
5
Figure 1-4. Press the cartridge into place until the holdmg springs
snap into place.
3. Using the guide holders as a fulcrum with the ribbon fac­ing away from you, as shown in Figure 1-4, lightly press the cartridge down until the two holder springs snap shut to hold the cartridge firmly in place.
4. Check that the cartridge fits so that the drive pins engage the cartridge teeth.
5. Gently slide the print head carriage manually all the way to your right or left until the ribbon automatically slips down into its proper place between the print head and the silver ribbon guide.
.
6. Put the printer cover back on and you’re finished. (A special switch on the printer prevents the printer from
working when the cover is off.)
6
Print head
Figure 1-5.
All you have to do is to slide the print head carriage manually to your right or left, then the ribbon slips down by itself into its proper position.
CHAPTER 2
GETTING TO KNOW
YOUR PRINTER
Subjects we’ll cover in Chapter 2 include -
l Parts of the printer -
to use them;
l Paper selection and loading; l Adjustment; l Connecting your printer to the computer;
l Extra functions with the control panel.
CONTROLS AND PARTS OF THE PRINTER
H Parts of the printer
First, we’ll go over the parts of the printer. You saw most of these when you unpacked your printer. Now we’ll give you a brief explanation of what they do. (For details on the initial set­up of this printer, with all components in place, see Chapter 1.)
what they’re for and how
PRINTER COVER - This protects the ribbon and the print
head from dust and dirt, and cuts down the sound of the printer. PAPER GUIDE - As you’ve guessed, this flat plastic molding guides the paper during printing (it is raised for single sheets and lies flat for sprocket-feed paper). POWER CORD - This cord connects the printer to its power source, usually a wall outlet. It’s located at the left rear of the printer. PRINT HEAD - This is the unit that does the actual printing. Like the strike lever in a typewriter, tiny, stiff wires in the print head hit the paper through a ribbon.
r
Tractor feed unit
’ I
nterf
\
Power cord
Figure 2- 1. TRACTOR FEED UNIT - The drive gear and sprockets of
the tractor feed unit move sprocket-feed paper through the printer.
Front and rear views of the printer
’ Power switch
PLATEN - This is the rubber cylinder that carries paper to the print head. INTERFACE CONNECTOR - On the back of the printer, this connector is used to connect your computer to the printer.
n Controls and indicators
Now let’s take a tour around the controls, starting with the control panel on the right. There are seven indicators and four keys on the control panel.
9
I.
Figure 2-2. The control panel.
POWER INDICATOR - Glows red when the power is on or blinks when the printer is out of paper or some other error occurs. BOLD KEY and INDICATOR - Pressing this key selects boldface printing. DRAFT INDICATORS (80,96,136) - Glows green to in­dicate the number of characters per line when the printer is in
‘the draft mode (set by the Mode key or the software control).
NLQ INDICATOR - Glows green when the printer is printing in the Near Letter Quality (NLQ) mode (set by the Mode key or the software control). MODE KEY - Changes the print mode every time it is pressed. PAPER FEED KEY-Advances the paper one line at a time when the On Line indicator is off. If you hold the key down, you’ll get consecutive line feeds, one after the other. If you push the On Line key while holding this key, you can advance the paper to the top of the next page or a new form.
.
ON LINE KEY and INDICATOR - Glows green when the printer can receive data from your computer (on line). When the printer is off line, it sends a signal to the computer indicating that it cannot accept data. Pressing the On Line key switches the printer on line and off line.
I
10
n Extra functions
There are eleven more functions that are not directly
specified on the control panel. You can use six of them by press­ing a key (or keys) when you turnon the power; five others are activated by pressing two control keys at once.
For details, please refer to the end of this chapter.
n Other controls
There are other controls, not connected to the control panel
board. Some of the more important ones are:
POWER SWITCH - The switch to turn the printer on is at the back, on the left side. PLATEN KNOB - This knob is at the middle of the right side and lets you turn the platen by hand, just like a typewriter. Caution: Turn this knob only with the Power switch off. Turn-
ing it with the power on could damage the platen drive gears.
RELEASE LEVER - The release lever is on top of the printer, near the left rear corner. You’ll be using it often - it controls how strongly the paper is held against the platen. The release lever has four positions: the top setting is used for inser­ting paper, the next is for single sheets, the third is for sprocket­feed paper, and the bottom one is used when adjusting the
pwfl. PAPER BAIL - The bail is the movable bar that holds the
paper against the platen. Its position depends on the setting of the release lever. DIP SWITCHES - These are a set of ten switches and a set of six switches that are used in interfacing the printer to your
computer. There are also switches to set page length, character
style, perforation skipping, and selecting the international character sets. See Appendix A for a complete list and explana­tion.
SELECTING AND LOADING PAPER
Your printer can handle the two basic types of paper-single sheets (stationery, envelopes, multipart business forms, etc.) and continuous paper (fan-folded perforated paper).
This is a good place to tell you about the release lever, which
11
you’ll be using often. This lever controls the pressure of the paper against the platen.
It has four settings:
g - The top setting is used when you want to load paper in the
printer. c - The second setting is for normal single sheets. fi - The third is for sprocket-feed paper. 4 - The bott om one is used when you want to release the
paper completely to adjust it.
The paper bail holds the paper against the platen according to the setting of the release lever. The bail is opened when the release lever is in the top position, closed when the lever is in the second or third positions, and opened by the printer when the lever is in the bottom position.
I -
I
I
Release lever
.
’ Paper bail
L---L
Figure 2-3.
continuous paper.
n Loading single sheets
Now, instead of feeding the paper in manually by turning the platen knob, we’re going to use the release lever (the printer must be turned on). Remember what we told you about this lever? It allows you to advance the paper according to its posi­tion.
Use friction feed for single sheets and tractor feed for
19
OK? Let’s start.
1. Move the sprockets on the tractor feed unit all the way to the ends.
2. Slide the sheet guide all the way to the right.
3. With the ribs of the paper guide toward you and the sliding adjuster at the bottom left, insert the guide into the slot at the back of the printer cover.
Sheet guide
/ Sprocket
‘igure 2-4.
Raise the paper guide for loading single sheets.
4. Insert the guide stand in the notches provided for it and use it to prop up the paper guide.
5. Position the adjuster at the triangle marked on the guide for standard margins, or set it according to your re­quirements.
6. Set the release lever for single sheets-the second posi­tion from the top.
7. Align a sheet of paper on the guide along the adjuster.
8. Turn on the power switch. (The Power indicator will blink because there is no paper.)
L
Figure 2-5.
l’rop up the paper guide by inserting me guise stana in
the notches provided for it.
‘igure 2-6.
You can insert a sheet of paper by using the release
lever.
. . . .
. .
. . *.
1
1
14
9. Now set the release lever to the auto-feed setting-the top position. The printer will advance the paper automatically.
10. When the paper stops, set the release lever for single sheets again.
To align paper that is not in straight-
. Set the release lever to the adjustment setting.
l Straighten the paper and adjust it for the margins you
want.
l Move the release lever back to its original setting.
n Loading sprocket-feed paper
This is the familiar computer paper, with the holes along the sides and perforations between the sheets. It is also called sprocket, punched, fan-fold, or just plain “computer paper.” It can be as narrow as 4”) and up to 10” wide.
Figure 2-7 shows the tractor unit. Please identify the parts of the tractor.
1. Turn on the printer and set the release lever for sprocket­feed paper.
2. If the paper guide is installed, remove it.
3. Place a stack of fan-fold paper behind the printer.
4:Open the sprocket covers, on the right and left sprocket
units, as shown in Figure 2-7.
Figure 2-7. Open the sprocket covers to expose me sproaet teem.
15
5. Flip the clamp levers backward. This allows the two sprocket units to move freely right and left so you can align them with the holes in the paper.
6. Feed the end of the paper into the slot next to the platen cover plate.
7. Fit the holes in the paper over the sprocket pins so the paper is even, and clamp the sprocket units in place.
8. Check that the paper is still positioned correctly, and close the sprocket covers (Figure 2-8).
9. The Power indicator should be blinking. Turn the platen knob to feed the paper until the indicator stops blinking.
10. Now turn the platen knob the other way just a bit, until the indicator starts blinking again.
11. Set the release lever to the auto-feed setting. The printer will advance the paper automatically.
12. When the paper stops, set the release lever for sprocket­feed paper again.
13. Finally, install the paper guide on the printer (Figure 2-8). Now you’re ready to roll!
“igure 2-8.
Ready to run with sprocket-feed paper.
ADJUSTING THE PRINT HEAD
The distance between the print head and the platen must-be adjusted to accommodate papers of different thicknesses. To make this adjustment, move the adjustment lever, which is under the printer cover and immediately in front of the release lever (Figure 2-9). Pulling the adjustment lever towards you will widen the gap; pushing it away from you will narrow the gap.
Figure 2-9.
The adjustment lever allows for different thicknesses
of paper.
There are four positions; you can feel the lever clicking into the various notches. The first step (illustrated) is the one most commonly used for single sheets of paper.
You shouldn’t have any trouble finding the right gap setting for your paper. If necessary, experiment; you’ll soon find the best position for the paper you’re using.
CONNECTING THE PRINTER
Now that you have assembled your printer, it’s time to use it for what you bought it for - print information from your com-
puter. But first you have to connect it to your computer. Please follow the instructions in the order listed below.
17
1. Make sure both your computer and printer are turned off.
2. Connect one end of the interface cable to the connector socket at the right rear of the printer as shown in Figure 2-10.
3. Connect the other end of the cable to your computer as described in the computer manual.
/-
Figure 2-10.
‘EXTRA FUNCTIONS WITH THE CONTROL PANEL
This is how you connect the cable.
There are many functions that are not directly specified on the control panel. In this section, we’ll show you these extra functions.
Italic mode
Italic and Panel mode
Figure 2-11.
_I
L Panel mode
Extra functions while turning on the printer.
18
n Self-tests
Your printer has two built-in programs that print out sample lines of letters, numbers, and other characters-to show you that everything’s in good working order. Self-test 1 is the long version, and self-test 2 is the short one. You can use either one to show the characters available in the printer, to check the in­stallation of the ribbon and paper, and to check the adjustment of the head-to-platen gap.
Best of all, you don’t have to wait another minute-you can print the self-test without hooking up the printer to your com­puter! It’s as simple as 1, 2, 3. . .
1. Plug in the printer (don’t turn it on yet).
2. Insert a sheet of paper (or sprocket paper, either one).
3. While holding down one of the following keys, turn on the power switch:
Paper Feed key-Self-test 1 (long) On Line key-Self-test 2 (short)
'igure 2-12. The self-tests show you what the printer can print.
Were you surprised? It’s fast, isn’t it? About 120 characters a
second, to be exact.
When you want to terminate the self-test function, turn off the
power switch.
n Hex dump
Can you guess what a “hex dump” is? No, it’s not where
witches throw away useless spells. A hex dump is an advanced
ability of your printer that you can use, in certain cases, to find a
problem with your system. Fortunately, such problems rarely
arise but the hex dump is available if one does. We’ll go over hex dump in Chapter 4. Right now, we’ll just tell you how to make a hex dump:
1. Plug in the printer (don’t turn it on yet).
2. Insert a sheet of paper, as you did for the self-tests.
3. While holding down both the Paper Feed and Mode keys, turn on the power switch.
W Panel mode
As you’ll learn in Chapter 5, this printer has many software controls. But if you want to print in one mode, ignoring the con­trol codes, the “Panel” mode takes effect for you. To set the
“Panel” mode, follow the procedures:
1. Plug in the printer (don’t turn it on yet).
2. While holding down the Mode key, turn on the power switch.
< Notice that this mode stays on until you turn off the printer.
n Italic mode
Sometimes, you may want to print with italic characters with Draft mode as the power-on default. You can set the Italic mode with the following procedures:
1. Plug in the printer (don’t turn it on yet).
2. While holding the Bold key, turn on the power switch.
This mode stays on until you send the cancel command to your printer. This mode re-activates when you send the reset
command to your printer.
n Italic and Panel mode
You can combine with the “Panel” mode and the “Italic” mode at a time. To set these modes at a time follow the pro­cedures below:
1. Plug in the printer (don’t turn it on yet).
2. While holding both the Mode and Bold keys, turn on the power switch.
Right margin set
**: Hold down
L- Left margin set
~---____
Figure 2-13.
the control panel keys while in the Off Line mode.
You can set many functions by the combinations o
n Setting print start position
When you want to align the print start position, you can set it by the micro-feed operation with the control panel, instead of turning the platen knob manually.
1:Set the Off Line mode by pressing the On Line key.
2. While holding down the On Line key, press one of the following keys.
Paper Feed key - Forward micro-feed Mode key - Reverse micro-feed
3. When you can set the print start position, release the Paper Feed key or the Mode key first, then release the On Line key.
n Setting the left and right margins
As you’ll learn in Chapter 4, you can set the left and right margins with control codes. In addition, you can set them by the following procedures.
1. Set the Off Line mode by pressing the On Line key.
2. While holding the Bold key, press one of the following keys.
f
1
Mode key - Left margin set Paper Feed key - Right margin set
3. While holding the two keys, the print head moves across the page step-by-step.
4. When the print head goes to the position where you want to set margin, release the two keys. So the printer acknowledges the margin with the sound of beep.
22
MEMO
CHAPTER 3
BASIC PRINTING
Subjects we’ll cover in Chapter 3 include­* Listing BASIC programs on the printer;
l How a program prints things; l Control codes, escape codes, and command syn-
tax;
l Near letter quality (NLQ) characters; l Fixed and proportional character spacing; l Special printing -
Printing in italics, Underlining, Superscripts and subscripts, Boldface and emphasized text, Mixing print modes.
To show you how to control your printer from a program, we
,
choose BASIC because it is easy to learn and easy to use. Also, more personal computer users program in BASIC than in any other language.
The rest of this manual will show you a little BASIC - just enough for.you to use your printer. We’re not going to try to make you an expert programmer, though, only get you started. There are many excellent books that will teach you BASIC, so if you discover that you like to program you should have no trouble learning more about it.
SOME BASICS OF BASIC
H A new language!
Many people who meet BASIC for the first time are in­timidated. Some are put off by the idea of learning any new
24
language, perhaps recalling the rigors of high-school Latin. Others are unnerved by anything having to do with computers.
Well don’t be! In the first place, BASIC may well be the easiest language you could learn: it has a vary limited vocabulary, a simple but precise grammar, and its dialects ­unlike those of English - usually different from each other only in minor detail. Without programming, a computer is a useless collection of chips and wire - why should we think of it as something special? Anyway, computers are here to stay - let’s accept them with good grace.
n First steps
The first things that a beginner learns to do are to list a pro­gram and to print a character string. Certainly these are the easiest operations one can do, but even they may depend on what computer you have. In Microsoft BASIC, we can list all the steps in a program by entering LIST. This lists them on the CRT screen; if we want to print them on a printer, we prefix the command with an L (enter LLIST).
The Microsoft BASIC command for outputting information is PRINT. Like the LIST command, this displays the information on the CRT screen so we have to add an L (+ LPRINT) if we
want to use the printer. Just put whatever you want to print between quotes and after LPRINT (anything enclosed in quotes
is called a character string). For example, we would use LPRINT “Hello!” to output “Hello!” to the printer. We’ll see later how to LPRINT things other than character strings.
We started with Microsoft BASIC because it is the most wide­ly used version of BASIC around. The programs in this manual are written in Microsoft BASIC so they should run on most com­puters. But if strange things happen when you try to run a pro­gram, check the BASIC manual that came with your computer.
Let’s talk about Apple II computers for a minute. These enormously popular computers use their own brand of BASIC. To use an Apple II, enter the following -
PR#l LIST
PR#O
The PR#l tells the Apple to send everything to the printer,
the LIST or PRINT command sends it, and the PR#O returns
PR#l PRINT "Hello! It PR#O
25
output to the screen.
Other computers, notably the Commodore C-64, require you to open the printer as a numbered device then to direct output to that device. For example, you might type the following to print
“Hello!” or to list a program in the C-64’s memory.
OPEN4,4 CMD4 LIST
CLOSE 4
Here, the first line says that the printer is device number 4, the second directs output to it, the third does the printing, and the last line closes down device number 4.
Appendix H gives more information about listing programs on the various computers. Find the part that applies to your com­puter and try it.
Now that we know how to address the printer, let’s try listing a BASIC program. Load a program into memory ready to pro­gram printer operation - just as soon as we learn a little bit about the ASCII codes.
W ASCII codes and the CHR$ function
You talk to your computer in BASIC, but your computer and your printer talk to each other in what are known as ASCII codes. In the ASCII code, each number from 0 to 255 has a par­ticular meaning - 36, for example, makes the printer print a dollar sign. Some numbers cause the printer to do other things, too. For instance, sending a 7 sounds the printer’s bell.
Taken together, these numbers and their meanings make up the ASCII code (pronounced ask-key), which stands for the American Standard Code for Information Interchange. There are ASCII codes for all the letters of the alphabet (upper case and lower case), 0 to 9, most punctuation marks, and some (but not all) of the functions of the printer.
There are a number of different ways to represent an ASCII code, depending on how you are using it. For example, the ASCII codes for the letter “A” are 65 (decimal) or &H41 (hex­adecimal). Or you can just call it “A”. Appendix B shows all of the ASCII codes.
BASIC uses the CHR$ function to represent ASCII characters and many functions. To print the letter “A” we
OPEN4,4 CMD4 PRINT "Hello! 'I
CLOSE4
would enter LPRINT CHR$(65). To make the printer’s bell sound, we would LPRINT CHR$(7). In general, we print a character by entering LPRINT CHR$(ASCII code) to the printer.
We can also use hex ASCII codes. Although we use only decimal ASCII codes in this manual, you should understand at least what a hex code is. “Hex” is short for hexadecimal and refers to a base-16 number (the numbers we use in everyday life are base 10). Since the hex system needs 16 digits, it uses the numerals 0 through 9 and also the letters A through F. You can always tell that a number is in hexadecimal by the “&H” im­mediately preceding it. The ASCII code for the letter “A” (65 in decimal) is &H41 in hex.
n Control codes
ASCII codes with values of 32 or less do not have their own keys. These codes control many of the printer’s functions, so we
call them control codes. To enter a control code from the keyboard, we have to press two keys at the same time - the “control” key and one other. The other key determines what code is sent - pressing the control (CTRL) key and A sends ASCII code 1, CTRL B sends ASCII code 2, and so on.
Your printer has a lot of control codes to let you do some real-
ly nifty things. Let’s try one that we’ve mentioned several times already:
1 Demo of ASCII code
10 20 LPRINT CHR$(7) 30 END
RUN
That’s the printer’s bell (we call it that even though it sounds like a buzzer). We’ll learn more about it in later (we just wanted to show you a control code that would get your attention right away).
There are four common ways of referring to a control code: the name of the code or its abbreviation, the decimal ASCII value, the hexadecimal ASCII value, and the “CTRL-” value.
For example, the ASCII code that causes the printer to advance
the paper one line is decimal 10. This code may be referred to
by any of the following.
27
line feed -the name of the code
UJ’)
ASCII 10 ASCII &HOA -its hexadecimal value (the &H signifies
CHR$(lO) CTRL- J
Of course, most of the time we don’t need to bother with these. Our computers are smart enough to know that when we press the “A” key we want to print the letter “A” - they take care of all the intermediate steps.
Appendix B is a table that shows the various names for each code so you can convert back and forth. The microcomputer world is not very consistent in describing ASCII codes, so it’s important that you have a basic knowledge of them.
n The escape codes
Back when the ASCII system was set up, computer equip­ment was relatively simple and thirty-three control codes were considered sufficient at the time. The American Standards people realized that, eventually, more control codes would be needed so they included the escape (ESC) code to allow almost any number of additional codes to be defined when they became necessary.
ESC allows us to “escape” from the ordinary set of control codes so we can specify additional functions and other informa­tion needed for a printer function. In this manual, we’ll write the ESC code inside broken brackets, like this - (ESC).
(ESC) - ,decimal 27 - is always followed by at least one other number; it is never used alone. The whole series of related numbers is called an escape sequence.
-its abbreviation
-its decimal value
hex)
-the way it’s used in BASIC
-the way you send it from a keyboard
W A note on command syntax
Because the readers of this manual will be running such a
wide variety of applications on so many different computers, we
just can’t show the exact way of sending codes to the printer for
each one of them. Instead, as we introduce you to each new com­mand, we will show the commands as in this example:
(ESC)
“W” 1
28
This command that turns on expanded printing. (ESC), as we mentioned earlier, is the escape code (which is ASCII code 27). A letter or number in quotes (such as the “W” above) means that the character should be sent to the printer (without the quotes).
In our example, you should send a capital W following the escape code. In BASIC, you could do this in a couple of ways: by sending the character itself (e,g, LPRINT “W”;), or by using the
CHR$ function to send the ASCII code for the character (e.g.
LPRINT CHR$(87);).
Many of printer commands end with a 1 or 0. When shown as
in the above example (i.e. no quotes and no “CHR$“), you can use either ASCII code 1 (i.e. CHR$(l)) or the character “1”
(which is ASCII code 49). The same idea applies to commands
ending with 0.
So for out example above, any of these BASIC statements will
have the same result:
LPRINT CHR$(27>;"W";CHR$(l>
LPl-lINT CHR$(27);"W';CHR$(49)
LPRINT CHR$(27);"Wl"
Even though, there are many commands that require the use of ASCII code 0; the character “0” (ASCII code 48) cannot be substituted. In these cases, instead of an unadorned 0 we will show ‘CHR$(O) each time these commands are referenced.
That’s it for the basics. You are now ready to learn how to use the many features of your printer.
SOME SPECIAL HINDS OF TEXT
If you looked carefully at your printer’s self test, you noticed that it can print in italics. But there’s more! Your printer can underline characters, print superscripts and subscripts, and perhaps most exciting, print near letter quality characters.
n Near Letter Quality characters
This printer’s Near Letter Quality (sometimes abbreviated as NLQ) character set is ideal for correspondence and other impor­tant printing, for it takes a keen eye to detect that it is from a
dot matrix printer. Normally, your printer prints draft quality characters. This is adequate for most work and it prints fastest.
But for the final printout, try NLQ. The program below shows
how.
29
10 1 Demo
20 LPRINT 30 LPRINT 40 LPRINT 50 LPRINT
of NLQ character set CHR$(27);"xl"; "This line shows NEAR LETTER QUALITY! CHR$(27);"xO"; "This line shows standard print."
In this program, line 20 selects NLQ characters with (ESC) “~“1 command. Line 30 prints a sample before line 40 switches printer back to draft printing with an (ESC) “~“0. When you run the program you should get this:
This line shows NEAR LETTER QUALITY!
-)_ 1-7 j. ::i :I. i II e 55 II C) w E:i E;t,~ilCl~~r-d pr i nt n
Table 3-1
Near letter quality commands
Function Control code
Near letter quality ON (ESC) “x” 1
’ Near letter quality OFF
(ESC) “~“0
n Italic printing
Italic letters are letters that are slanted to the right. Your printer can print all of its letters except NLQ characters in italic as well as the roman (standard) letters you are accustomed to. Italics can be used to give extra emphasis to certain words. The command codes to turn italic on and off are shown in Table 3-2.
Table 3-2
.
Function
Italic ON (ESC) “4” Italic OFF
Italic commands
Control code
(ESC) “5”
Use this program to see italic characters:
f Demo of italic and
roman
:; LPRINT CHR$(27)*"4"*
30 LPRINT "This li;e ii 40 LPRINT CHR$( 27);"5y 50 LPRINT "This line is
in ITALIC characters."
in ROMAN characters."
Here is what you should get:
In this program, line 20 turns italic on with (ESC) “4”, and
line 40 turns italic off with (ESC) “5”.
W Underlining
Not only can your printer print all styles of printing in both
roman and italic, but it can underline them too. The control
codes are shown in Table 3-3.
Table 3-3
Underline commands
Function
Underline ON Underline OFF
Control code
(ESC) “-“l (ESC) “-“0
Again, that’s simple. Let’s try it with this program:
' Demo of underlining
:; LPRINT CHR$(27)*"-1".
30 LPRINT "This ph;ase is UNDERLINED;"; 40 LPRINT CHR$(27);"-0"; 50 LP-RINT It this is not."
It should come out like this:
This phrase -I& UNDERLINED; this is not.
31
In this program underline is turned on in line 20 with (ESC)
-“l, and then off in line 40 with (ESC) “-“O. There’s a new little wrinkle in this program, though. The semicolons at the end of the first three lines told BASIC that those lines were to be continued. Therefore, BASIC didn’t send a carriage return and line feed at the end of those lines. We just did this to il­lustrate that all these control codes can be used in the middle of a line. It’s easy to underline or italicize only part of a line.
n Superscripts and subscripts
Your printer can print in two different heights of characters.
The smaller characters are called superscripts and subscripts and are half the height of normal characters. Superscripts print even with the tops of regular printing while subscripts print even with the bottom of regular printing. They are frequently used to reference footnotes, and in mathematical formulas.
Table 3-4 has the codes for using superscripts and subscripts.
Table 3-4
Superscripts and subscripts commands
Function
Superscript ON
Control code
(ESC>“S”O Subscript ON (ESC)“? 1 Super and subscript OFF
(ESC)“T”
Try this program to see them work:
10 1 Demo
of superscripts
and subscripts
20 LPRINT "Look! ";,
30 LPRINT
CliR$(27);"SO"; 40 LPRINT "SUPERSCRIPTS "; 50 LPRINT
CHR$(27);"T";
60 LPRINT "& "; 70 LPRINT
CHR$(27);"Sl"; 80 LPRINT "SUBSCRIPTS ";
90 LPRINT
CHR$(27);"T"; 100 LPRINT "on one line."
I i ne .
32
Here line 30 turns on superscripts with (ESC) “SO. It’s turn-
ed off in line 50 with (ESC) “T”. Then between printing text, subscripts are turned on in line 70 with (ESC) “S’l, and finally off in line 90. Again, everything prints on one line because of the semicolons.
CHANGING THE PRINT PITCH
In “printer talk,” the number of characters that can be printed
in one inch is called the print pitch or character pitch. Normally, your printer is set for 10 characters per inch, which is called pica (and is the same as the pica pitch on some typewriters). This
works out to 80 characters per line.
You can also print 12 characters per inch (elite pitch). This
gives you 96 characters per line.
You can set these pitches by using the Mode key on the con-
trol panel manually, or by software as shown in the table below.
Table 3-5
Print pitch commands
Pitch
Pica
Elite
Characters/inch
10 12 (ESC) “M”
Control code
(ESC) “P”
Try this program to see how these two pitches work. Be sure
to set the printer to draft mode.
10 '
Demo of pica and elite pitches
20 LPRINT CHR$(27);"M";
30 LPRINT "This line is ELITE pitch." 40 LPRINT CHR$(27);"P";
50 LPRINT "This line is PICA pitch (normal)."
When you run this program you should get this:
This line is ELITE pitch. This line is F’ICC’r pikC:h (nor-mal).
33
Line 20 turns on elite pitch with (ESC) “M”. Line 30 prints a line at 12 characters per inch. The (ESC) “P” in line 40 resets the printer to pica pitch and line 50 prints a line in pica pitch.
W Expanded print
Each of the print pitches can be enlarged to twice its normal width. This is called expanded print. Try this program to see how it works:
10 ’ Demo of expanded print 20 LPRINT "Demonstration of 'I; 30 LPRINT CHR$(14); 40 LPRINT "EXPANDED";
50 LPRINT CHR$(20); 60 LPRINT " printing." 70 LPRINT "Notice that I';
80 LPRINT CHR$(14);
90 LPRINT "EXPANDED mode" 100 LPRINT "automatically turns off at the end
of a line."
Expanded print set with CHR$(14) is automatically cancelled at the end of the line. This is convenient in many applications, such as for one line titles. Note that you didn’t need to put an (ESC) in front of the CHR$(14), although (ESC) CHR$(14) works just the same.
You can also cancel one line expanded print before a carriage return with CHR$(20), as done in line 50.
Sometimes you may wish to stay in expanded print for more
than one line. Change your program to this:
10 ' Demo of permanent expanded mode 20 LPRINT CHR$(27);"Wl"; 30 LPRINT
"Permanent expanded" 40 LPRINT "mode stays on until" 50 LPRINT "is is "; 60 LPRINT CHR$(27);"WO"; 70 LPRINT "turned off."
34
Now the results look like this:
When you turn on expanded print with (ESC) “W”l it stays
on until you turn it off with (ESC) “W”0.
Table 3-6 Table 3-6
Expanded print commands
Expanded print commands
n Condensed print
Each of the print pitches also can be condensed to its normal width. This is called condensed print. Try this program to see how it works:
f Demo of condensed print
10 20 LPRINT "Demonstration of "; 30 LPRINT CHR$(15); 40 LPRINT "CONDENSED"; 50 LPRINT CHR$(18); 60 LPRINT If printing."
Ihwmstt-at:i cm of CONDENSED pr-inkirrq.
. Condensed print set with CHR$(15) stays on until you turn it off with CHR$(18). Note that you don’t need to put an (ESC) in front of the CHR$(15), although (ESC) CHR$(15) works just the same.
Table 3-7
Condensed print commands
Function
Condensed ON Condensed OFF
Control code
CHR$(15) 01 (ESC) CHR$(15) CHR$(18)
By combining expanded print and condensed print with the two pitches, this printer has eight different character widths available.
Enter this program to see how the print pitches, expanded print and condensed print can be combined:
' Demo LPRINT LPRINT
LPRINT LPRINT LPRINT
LPRINT LPRINT LPRINT
100 LPRINT 110 LPRINT 120 LPRINT 130 LPRINT 140 LPRINT 150 LPRINT
of various print pitches CHR$(15);
CHR$( 27);wy
"This line is CONDENSED ELITE pitch." CHR$(27);"P"; "This line is CONDENSED PICA pitch." CHR$(18); CHR$(27);"M";
IfThis line is NORMAL ELITS; pitch."
CHR$(27);"P";
"This line is NORMAL PICA pitch."
CHR$(27);"Wl";
CHR$(lS); CHR$(27);"M"; "This line is EXPANDED CONDENSED
ELITES."
160 LPRINT 17 0 LPRIN,T
PICA." 180 LPRINT 190 LPRINT
200 LPRINT 210 LPRINT 220 LPRINT 230 LPRINT 240 END
"This line is EXPANDED CONDENSED CHR$(18);
CHR$(27);"M";
"This is EXPANDED ELITE." CHRS(27);"P";
"This is EXPANDED PICA." CHR$(27) ;"WO"
Here’s what you should get from this program:
This line is CONDENSED ELITE pitch, This line is CONDENSED PICA pitch.
This line is NORMRL ELITE pitch.
l-l-1 :i, vii :I. :i n e :i, 5;
111 IX? Pi u I,,.,
P 1: c:: (4 fl:, i t c3 t-l n
This line is EXPANDED CONDENSED ELITE. This line is EXPANDED CONDENSED PICA. l-h i .!si
'-'["" #--r -j. K;.
n Proportional printing
i?z EXF'ANDED ELI-i-E,
ji- cc;;;
Ef:: :,I;: g.3 &'::, 11"*,[ :J-J, E; :/j-J
1':" J:: #-:y; $-II _
Have you ever noticed in books and magazines? Doesn’t it look nice? The main reason is that each character is given an amount of space proportional to its actual width. A typewriter (and most printer), on the other hand, give every character the same amount of space, no matter how wide it is. (Pica pitch, for example, gives a “w” and an “i” l/10 of an inch each. Look these letters closely and you’ll see that a “w” is two or three times as wide as an “i”.)
Well, you too enjoy professional-looking proportional print­ing. You can turn proportional printing on and off with the following command.
Table 3-8
Proportional commands
Function
Proportional ON
Proportional OFF
Control code
(ESC)“p”l (ESC)“p”O
Try this program to see how the proportional spacing works.
10 ) Demo of proportional printing 20 LPRINT CHR$(~~);"M~;
30 LPRINT "This line is NORMAL ELITE printing." 4-O LPRINT CHR$(27);"pl";
50 LPRINT "This line is PROPORTIONAL ELITE." 60 LPRINT CHR$(27);"P";
70 LPRINT "This line is PROPORTIONAL PICA." 80 LPRINT CHR$(~~);~~~O~Q
90 LPRINT "This line is NORMAL PICA printing." 100 END
When you run this program you should get this:
This line is NORMAL ELITE printing. This line is F’ROF’ORTIONAL ELITE.
“r1.7j.:~ :/.j.I-\e j.!ii; r~~I::;(:)~::~(::)~~1-~Ol\lnj... p:I:C::A. T l-1 i 5;
1. :i. r1 e i 5
NC:) R PI Ci L.. F’ I: CA
1:) r i n .t i ri g y
Line 20 selects the elite pitch and line 40 turns on the propor­tional printing with (ESC)“p”l. Line 50 prints a line with pro­portional elite pitch. Then, line 60 selects the pica pitch, so that line 70 prints a line with proportional pica pitch. Finally, line 80 resets the proportional printing and line 90 prints a line in nor­mal pica pitch.
NOTE: When you change the print pitch by the MODE key on
the control panel,
this proportional spacing should be
automatically cancelled.
MAKING WORDS STAND OUT
Your printer has very good print density when it’s just print-
ing regularly. But sometimes you may want something to stand
<out from the rest of the page. This printer provides two ways to
do this: boldface and emphasized print. Both of these go over the characters twice, but they use slightly different methods to darken the characters. Let’s try them and see what the dif­ference is.
The following table shows the control codes for getting into
and out of boldface and emphasized modes.
Table 3-9
Print emphasis commands
38
Try them now with this little program:
f boldface and emphasized
2': ~PEE EHR$(~~) ;"G";
30 LPRINT 40 LPRINT CHR$(27);"E"; 50 LPRINT
"This iine is BOLDFACE printing."
"This line is BOLDFACE and
EMPHASIZED."
60 LPRINT CHR$(27);"H"; 70 LPRINT
"This line is EMPHASIZED printing.'* 80 LPRINT CHR$(~~);"F"; 90 LPRINT "This line is normal printing." 100 END
Run this program. The results will look like this:
This line is BCLUFUCE printing.
This line is BOLDFACE and EMPHASIZED. This line is EMPHASIZED printing.
‘I-t.1 :i. 5 :I, :i. n e j, 5; f-1 I::) r” ma :I. p r :i_ n t. j. n (3 .
-
Line 20 turns on boldface with (ESC)“G” and line 30 prints a
line of text. In line 40 ‘emphasized is turned on with (ESC)“E”. Line 50 prints a line of text in boldface and emphasized. Line 60 then turns boldface off with (ESC)“H” so that line 70 can print in emphasized only. Finally, line 80 turns emphasized off, so
your printer is set for normal printing.
Look closely at the different lines of printing. In the line of
boldface printing each character has been printed twice, and
they are moved down just slightly the second time they are printed. In emphasized printing, they are moved slightly to the right the second time your printer prints. The last line combined
both of these so that each character was printed 4 times. Now
that’s pretty nice printing, isn’t it?
MIXING PRINT MODES
We have learned how to use the various print modes in-
dividually and together. Now we’ll see how to combine them
39
more efficiently.
You have at your disposal a unique command that lets you choose any valid combination of print modes and pitch. This is the Master Print mode command. It looks like this:
(ESC) “!” n
Here, the value of n defines the print style to be selected. The value of n can range from 0 to 255, which is the range of values that can be stored in one eight-bit byte. If you look at each bit in this byte, you’ll find that each one represents a printing style variation. Adding the binary values of the selected bits gives the value of n for a particular combination of print styles.
Table 3-10 shows the decimal values of the bits in the Master Print byte. To calculate the value n for a particular combination of printing styles, just add the values of the features that you want to combine.
Table 3-10
Values of mixing print styles for Master Print
1 Bit 1 Print stvle Decimal value
1 Elite print 1 2 Proportional print 2 3 Condensed mint 4
14
5 6 Expanded print 32 7 (Not used)
1 Emphasized print
Boldface print 16
- 1
I
8
18 I‘ Underline 128
For example, if you want to select elite expanded boldface
print, you would calculate the value of n like this:
Elite 1 Boldface 16 Expanded 32
n=
The command would look like this:
CHR$(27);“!“;CHR$(49)
49
I
1
To better understand the way the print modes work, consider
that each mode except pica (pica is the default) has a separate switch that can turned on and off via software. Once the switch is on, it stays on until turned off. When two modes that conflict are turned on at the same time, the printer must choose which one to use.
For example, suppose you turn on both Elite and Emphasized
modes. Since these cannot combine the printer must make a choice; in this case, the printer chooses Elite.
Summary notes
1) Pica is the default pitch and is active when Elite is turned off.
2) When two modes conflict, the one of lesser priority is cancelled. For example, Condensed and Emphasized can not be printed at the same time, printing is Emphasized.
3) Elite cancels Emphasized.
4) Underline, and Expanded modes combine with any print modes.
5) Emphasized will not mix with Elite or Condensed.
CHAPTER 4
FORMATTING TEXT
Subjects we’ll cover in Chapter 4 include­* The carriage return and line feed;
l The amount of space between lines;
l Moving to the next page;
l The number of lines on a printed page; l Horizontal and vertical tabs; l Setting margins-
l Centering and aligning.
Chapter 3 showed us all the basic techniques of using the printer. Now we’re ready for the more advanced ones. We’ll con­centrate on changing the appearance of the page to suit our needs.
left, right, top and bottom;
ilNES AND LINE SPACING
n Starting a new line
Up until now the only time we have thought about printing on a new line is when we didn’t want it to happen. We learned that putting a semicolon (;) at the end of a BASIC line will not end the line of printing. So somehow, the computer telling the printer when to end one line and start another.
There are two codes that are used to end one line and start another. They are carriage return (CHR$(13)) and line feed (CHR$(lO)). Like the escape code, they have been given ab­breviations which you’ll find many texts (including this one):
<CR > and < LF > . The codes are simple, but their action is a little confusing (especially with BASIC). Carriage return is the easiest. Each time that the printer receives a CHR$(13) it returns the print head to the left margin. It does not advance the paper (if DIP switch 1-8 is on; see below).
42
Line feed is more complicated. Each time the printer receives a CHR$(lO) it both advances the paper one line and returns the print head to the left margin, ready to start a new line.
Now to add a little confusion-most (but not all) versions of BASIC add a line feed (CHR$(lO)) to every carriage return (CHR$(13)) that they send. If your version of BASIC doesn’t do this, then you should turn DIP switch l-8 off so that your printer will add the line feed for you. When you have DIP switch l-8 off the printer will do the same thing when it receives a carriage return as it does when it receives a line feed.
If you find that your printer double spa-es when it should single space, then you probably need to turn DIP switch l-8 on.
n Reverse line feeds
Your printer has a unique capability: it can move the paper up or down! Its unique tractor design allows the paper to be fed in either direction without jamming. This allows you to move
around the page at will. You can use this feature to print several
columns of text side by side, or print a graph and then move back up and insert descriptive legends. As you experiment you’re bound to come up with more uses!
The simplest form of reverse paper feeding is a reverse line feed. The code is (ESC)( LF), which causes the paper to move
down (in effect, moving the printing up) one line. A “line” used in a reverse line feed is the same size as a line in a regular line feed (this is normally l/6 inch). When you change the line spac-
ing (which you’ll read about next), you change it for both for-
ward and reverse line feeds.
Table 4-1
Line feed commands
Function
Control code
Return print head to left margin CHR$(13)
Advance paper one line
Reverse paper one line
CHR$(lO)
(ESC)CHR$( 10)
n Changing the line spacing
When you turn your printer on the line spacing is set to 6 lines
per inch. This is fine for most printing applications, but sometimes you may want something different. Your printer makes it easy to set the line spacing to whatever you want.
Try this program to see how easy it is to change the line spac-
ing:
NEW
( Demo of line spacing
10
FOR I=1 TO 25
20
IF 1=13 THEN 60
LPRINT CHR$(27);"A";CHR$(I);
2
LPRINT "THIS LINE SPACING IS SET TO";1
2:
NEXT I LPRINT "LINE SPACING IS SET TO 1/6 INCH
70
(NORMAL) .I! LPRINT CHR$(27);"2"
80
END
90
This is what you will get:
! ‘f
.J!! ,’ :
I
.!i
.-
\
..,. II IIn
IIMF
\ .:L L I NE I- I lIEi:
I- :I: NE
l-l-l I s I.._ I tw SF AC 1: NC< I 5 SET 1-a 112
T 1-l I: S I_ :I: i’.l E SI:-’ A[:: :C N[17 :I: S S Et: T
T t.4 1: S I.... 1: NE:
SI”‘A!I I NG :I: s SE:T 1-o 1.5
T t-1 I s I- :I: IIE 6~’ A c :I: la (~7 :I: s I-; if:. T
T ti :C S I__. 1: I\1 E..: SF-’ G C: 1: l’\l G :I. SZ
SfYl” 1-C:) :L iI S Et:: “I- ‘Tel 1 I
‘1” cl 1. 4.
T [:I 1 6
cz; 1x:-r -r f-1
3, 7
43
Line 40 changes the line spacing. The command (ESC)“A” CHR$(n) changes the line spacing to n/72 of an inch. The loop that is started in line 20 increases the value of n (the variable I in this program) each time it is executed. So the line spacing in­creases as the program continues. Line 30 just shortcuts the loop when I= 13, since BASIC won’t let us send CHR$(13) without adding an unwanted CHR$(lO) to it. Finally, the (ESC) “2” in line 80 resets the line spacing to 6 lines per inch. This is a shortcut that is the same as (ESC)“A”CHR$(12).
When you run this program with the DIP switch l-6 off (IBM mode), you cannot get the printout as shown above.
The (ESC) “A” CHR$(n) command in IBM mode only defines the line spacing as n/72 of an inch; the (ESC) “2” command changes the line spacing to the amount defined by the previous
(ESC) “A”.
So: you need to change the following lines to the previous pro-
gram as shown below for the IBM mode:
40 LPRINT CHR$(27>;"A";CHR$(I);CHR$(27);w2'; 80 LPRINT CHR$(27);
"A";CHR$(12);CHR$(27);"2"
You may wonder why they picked l/72 of an inch as the incre­ment for the line spacing command. There’s a good reason: the dots that the printer makes are l/72 inch apart. So this means that you can vary the line spacing in increments as fine as one dot - unless you want finer spacing, like one third dot spac­ing.
The (ESC)“3”CHR$(n) command sets the line spacing in in­crements of l/216 inch. Change line 40 in your program so it is like this:
40 LPRINT CHR$(27);"3";CHR$(I);
. and run the program again. Now the results will look like this:
45
The program works just the same as before, but the line spac­ing are just one-third what they were. This is because (ESC j“3” CHR$(n) sets the line spacing to n/216 inch.
Table 4-2 shows all the line spacing commands, including several “shortcut” commands for commonly used line spacings.
Table 4-2
Line spacing commands
n Moving down the page without a carriage return
So far, all the commands that move the paper also move the print head to the left margin. And normally this is what you want. Sometimes, though, you may wish to move down the page without moving the printhead back to the left margin. The following commands do just that.
The (ESC)“J”CHR$(n) command causes the printer to make one line feed of n/216 inch, but does not change the setting of the line spacing. Try this program to see how it works:
46
NEW 10 '
Demo of' one-time line feeds
20 LPRINT "LINE NUMBER 1." ;; LPRINT "LINE NUMBER 2.";
' One-time line feed
50 LPRINT CHR$(27>;"J";CHR$(loO);
60 LPRINT "LINE NUMBER 3."
70 LPRINT "LINE NUMBER 4." 80 END
Here is what your printer will produce:
i-:1: IW I\Il.JMEE:FI I. I
I__ I Ntx I’dJMBER 2 n
I.... I NE NIJMBEH 3.
L.:I: NE: NCJMBER 4 ,s
The (ESC)“J”CHR$(lOO)
in line 50 changes the spacing to
100/216 inches for one line only without moving the printhead. The rest of the lines printed with the normal line spacing. Notice that both line 30 and line 50 end with semicolons. This prevents the normal line feed from occurring.
The ‘( ESC)“j”CHR$(n) command works the same way except that the paper moves in the opposite direction. Try this simple change to your program and see what a difference it makes!
( One-time reverse line feed
40
50 LPRINT CHR$.(27);"j";CHR$(lOO);
L:C NE W..IME:EK 3 m
I__ 1 :;.I E tq I,_! pl E: E: Fi. it ” Iem 1: i\! - i’%] I,..! 1’1 E: 1: F: j, .
iv 1 NE N!..!tqE:ER :z .
-
47
PAGE CONTROL
Now that we have seen how to control line spacing, we can go
on to page control - positioning the printing on the page and ad-
justing the paper length.
n Form feed
The simplest forms control code is the form feed. Form feed
(or < FF > ) is CHR$(12) and causes the printer to move the paper to the top of the next sheet. Try it by changing lines 40 and 50 to this:
t form feed
40
50 LPRINT CHR$(12);
Before you run the program, turn your printer off and adjust the paper so that the top of the sheet is even with the top of the ribbon guide on the print head, then turn the printer back on. If you don’t remember how to do this, review Chapter 2. When you run the program, the results will look like this:
u I
---- o J ------------­‘T
1. 1 :.: 1. NE Nf- .- iVl.JlviHl~R IWMBER 2. 3. .
,
f
0 I
.
The form feed (CHR$(12)) in line 50 caused the printer to
move to the top of a new page before printing the last two lines.
n Reverse form feed
Just as your printer can perform a reverse line feed, it can do a reverse form feed. This code moves the paper so that the print head is positioned at the top of the current page. This can be us-
.t w-c
0
I
-----------
0
pi;;; ;;;g ;I
I
ed, for example, to print text in a multi-column magazine for­mat; print the first column, then reverse form feed back to.the top of the page to start the second column. The code for reverse form feed is easy to remember: < ESC > < FF > .
Table 4-3
Form feed commands
1 Function
Advance paper to top of next
1 Control code
CHR$(12)
paw Reverse paper to top of current
(ESC)CHR$(12)
page
W Changing the page length
You may have some computer forms that you wish to use with this printer that are not 11 inches high. That’s no problem, because you can tell your printer how high the forms are that you are using. There are two commands for doing this, shown in this table.
Table 4-4
Form length control
Function
Set the page length to n lines Set the page length to n inches
Control code
(ESC)“C”CHR$(n) (ESC)“C”CHR$(O)CHR$(n)
Let’s set up a 7 inch high form length, which is typical of
many computer checks. The following program will do it.
NEW
' Demo of variable form lenffths
10 20 LPRINT CHR$(27>;"C";CHR$(O>jCHR$(7); 30 LPRINT "PAY TO THE ORDER OF:" 40 LPRINT CHR$(12); 2; ;;;INT "FAY TO THE ORDER OF:"
This program should print “PAY TO THE ORDER OF:” twice, and they should be 7 inches apart. Line 20 sets the form length to 7 inches. After line 30 prints, line 40 sends a form feed
49
advance the paper to the top of the next form. Line 50 then prints its message.
After you have run this program, turn off the printer and ad-
just the top of form position. When you turn the printer back on
the page length will reset to its normal setting (usually 11 in­ches).
TOP AND BOTTOM MARGINS
Many programs that you use a printer don’t keep track of
where they are printing on the page. This causes a problem when you get to the bottom of a page because these programs just keep on printing, right over the perforation. This makes it very hard to read, especially if a line happens to fall right on the perforation. And if you separate the pages then you are really in trouble.
Of course your printer has a solution to this predicament. This printer can keep track of the position on the page, and advance the paper so that you won’t print too near the perforation. There are two commands to do this. One controls the space at the top of the page and the other controls the space at the bottom of the page. The control codes are given in the following table.
Table 4-5
Top and bottom margin commands
Function Control code
Set top margin to n lines (ESC)“r”CHR$(n) Set bottom margin to n lines
(ESC )“N”CHR$(n)
Cancel top and bottom margins (ESC)“O”
In both cases the value of n tells your printer how many lines
to skip, although there is a slight difference in the usage. When you set the top margin with (ESC)“r”CHR$(n), the value of n
tells the printer what line to start printing on. When you set the bottom margin with (ESC)“N”CHR$(n), the value of n tells the
printer how many blank lines should be left at the bottom of the page.
Let’s try a simple application to see how these margins work.
Enter this program, which will print 150 lines without top and bottom margins.
10 ' Demo of top and bottom margins 60 LPRINT CHR$(12);
70 FOR I=1 TO 150
80 LPRINT "THIS IS LINE";1
:' form feed
90 NEXT I 110 LPRINT CHR$(12)
:' form feed
120 END
When you run this program it will print 150 lines right down the page and across the perforations. When it’s done line 110 sends a form feed to advance to the top of the next page. Look at the lines that have printed near the perforations. Separate the sheets and see if any of the lines have been torn in half. These are the problems that the top and bottom margins will solve.
Now add the following lines to your program. (Don’t forget the semicolons or you won’t get quite the same results that we did.)
1 Leave 6 blank lines at the bottom of page
20 30 LPRINT CHR$(27);"N";CHR$(6);
40 ' Start top of page at line 6 50 LPRINT CHR$(27);"r";CHR$(6); 100 LPRINT CHR$( 27) poff;
I clear top and bottom
margins
Now when you run the program, your printer skip the first six lines and the last six lines on each page. Always send a form feed after setting the top margin, or it will not work on the first page printed. That’s because the top margin only takes effect after a form feed.
Line 50 sets the top margin, line 30 sets the bottom margin, and line 100 clears both margins when we are done.
THIS IS LINE 1 THIS IS ILINE 2
THIS IS LINE : THIS IS ILINE 4 THIS I5 LINE 5 THIS IS ILINE 6 THIS IS LINE 7 THIS IS LINE R THIS IS LINE 9
; THIS I THIS ’ rHIS ; THIS , THIS I THIS
I
O1
ITHIS IS LINE 56
b-
THIS IS LINE 164 THIS IS LINE 105 THIS IS LINE 106
0
THIS IS LINE 107 THIS IS LINE 108 THIS IS LINE 109
0
THIS IS LINE 116
0 0
--­0
50
LINE LINE 51
LINE 52 LINE LINE 54 LINE 55
53
0
THIS IS LINE 111
THIS IS LINE 112
0
THIS IS LINE 113 THIS IS LINE 114 THIS IS LINE 115
0
THIS IS LINE lib THIS IS LINE 117 THIS IS LINE 118
0
THIS IS LINE 119 THIS IS LINE 120
9
SETTING LEFT AND RIGHT MARGINS
The left and right margins of this printer work just like a typewriter - once they are set all the printing is done between them. The commands to set the margins are given in the follow­ing table:
Table 4-6
Left and right margin commands
Try setting the margins with this program:
10 ' Demo of margins
20 GOSUB 70
30 LPRINT CHR$(27);"l";CHR$(lO); 40 LPRINT CHR$(27);"Q";CHR$(70);
50 GOSUB 70 60 END 70 FOR I=1 TO 80
80 LFRINT "XI'; 90 NEXT I 100 LPRINT 110 RETURN
The first thing that this program does is to branch to the subroutine that starts in line 70 . This subroutine prints 80 X’s in a row. The first time that the subroutine is used, all the X’s fit in one line. Then line 30 sets the left margin to 10, and line 40 sets the right margin to 70. Once again the subroutine is used, but this time the X’s won’t all fit on one line since there is now only room for 60 characters between the margins.
Run the program. The results will look like this:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
XxXXXXXXXxXXXXXxxxXXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx
53
When you want to reset the margins to the default values, you have two choices. You can either turn the printer off and back on, or you can set margin values equal to the default values. This means that you should set a left margin of 0 and right margin of 80 in pica pitch.
If you change the pitch of your printing after you set your margins, the margins will not change. They stay at the same place on the page. So if you set the margins to give you 65 col­umns of printing when you are using pica type, then you change to elite type you will have room for more than 65 columns of elite printing between the margins.
HORIZONTAL AND VERTICAL TABS
Suppose you need to move across the page to a certain posi­tion several times in a document. It’s not much fun to type in space after space. And you don’t have to - you can “tab” your
way across the page.
Your printer’s tabs are like those on a typewriter, but much
more powerful. You have both horizontal and vertical tabs which can be used for both text and graphics - and they’re real­ly handy for indenting paragraphs and making tables.
,M Horizontal tabs
Horizontal tabs are set automatically every eight positions. To
move the print head to the next tab position, send CHR$(S).
Try this program to see how the default tabs work.
10 1 Demo of horizontal tabbing 20 LPRINT "ONE";CHR$(g);"TWO";CHR$(9);"THREE";
CHR$(g);"FOUR"
Here’s what you should get-
Even though the words are different length, they are spaced
out evenly by the horizontal tabs.
Now add the following line to your program to set different
horizontal tabs:
15 LPRINT CHR$(27);"D";CHR$(7);CHR$(l4);CHR$(21);
CHR$(O)
(ESC)“D” is the command to begin setting horizontal tabs. It
must be followed by characters representing the positions that you want the tabs set. In our program we are setting tabs in col­umns 7, 14, and 21. The CHR$(O) at the end ends the string of tabs. In fact, any character that is not greater than the previous one will stop setting tabs. This means that you must put all your tab values in order, from least to greatest, or they won’t all get set.
When you run the program now it produces this:
The words are now closer together, but still evenly spaced.
The words are now closer together, but still evenly spaced.
Turn your printer off and on again to reset the default tabs. Turn your printer off and on again to reset the default tabs.
Table 4-7 Table 4-7
Horizontal tab commands Horizontal tab commands
Function Function
Advance to next tab position
Advance to next tab position CHWW CHWW Set tabs at nl, n2, etc. Set tabs at nl, n2, etc.
Control code Control code
(ESC)“D”CHR$(nl) (ESC)“D”CHR$(nl)
CHR$(nZ).....CHR$(O) CHR$(nZ).....CHR$(O)
n One-time horizontal tabs
Suppose you need to move to a position across the page, but
you only need to do it once. It doesn’t make much sense to set
up a tab to use only one time. There must be an easier way ­and of cause there is.
The solution is called a one-time tab. Table 4-8 show the com-
mands.
Table 4-8
One-time horizontal tabs
Function
Absolute horizontal tab Relative horizontal tab
Control code
(ESC) ‘3” CHR$(nl) CHR$(nZ) (ESC) “\” CHR$(nl) CHR$(nZ:
55
The aboslute horizontal tab command moves the print head to a specified position on the page. The position that you want the print head to move to (meaured from the left margin) is specified by the values of $21 and n2 in l/60-inch units using the formula nl + n2 x 256.
Try this program to see how this works.
10 1 Demo of absolute horizontal tabs
20 FOR I=60 TO 70 STEP 2
30 LPRINT I;'+++++'; 40 LPRINT CHR$(27);"$";CHR$(I);CHR$(O); 50 LPRINT 'Horizontal tab."
60 NEXT I
70 END
In this program, the print head is positioned before the “H” in
“Horizontal” is printed.
The relative horizontal tab command can move the print head right form the current position. The formula for calculating how much the print head moves is the same as in the absolute horizontal tab command. However, the units by which the print head actually moves vary’in l/120-inch units.
Try this program to see how this works.
10 FOR I=1 TO 3
20 LPRINT "Relative";
30 LPRINT CHR$(27>;'\';CHR$(I*2O);CHR$(O);
40 LPRINT 'Horizontal";
50 LPRINT CHR$(27);"\';CHR$(I*lO);CHR$(O);
60 LPRINT "Tab."
70 NEXT I
80 LPRINT 90 END
W Vertical tabs
Vertical tabs have the same kinds of uses that horizontal tabs do - they just work in the other direction. Horizontal tabs allow you to reach a specific column on the page no matter where you
start from. Vertical tabs are the same. If you have a vertical tab set at line 20, a vertical tab (or <VT >) will move you to line 20 whether you start from line 5 or line 19.
The vertical tab is not set at the power-on default. If you send
a CHR$(ll), which is the ASCII code for <VT > , before we have set up tabs advance the paper one line. Enter this program to see how this works.
' Demo of vertical tabs
10 40 LPRINT CHR$(ll);"FIRST TAB."
50 LPRINT CHR$(ll);"SECOND TAB." 60 LPRINT CHR$(ll);"THIRD TAB." 70 LPRINT CHR$(ll);"FOURTH TAB."
Now, let’s set some vertical tabs of our own. Add these lines
to the program:
20 LPRINT CHR$(27>;"B";CHR$(lo);CHR$(20); 30 LPRINT CHR$(4O);CHR$(5O);CHR$(O);
(ESC)“B” is the command to set vertical tabs. Like the
horizontal tab setting command, tab positions must be defined
in ascending order. Our example sets vertical tabs at lines 10, 20, 40 and 50. Then the CHR$(ll) in each of the following lines advances the paper to the next vertical tab. The printout is shown below.
1-I-i I HC) TAM I
wx.m-1-i-4 -rAb.
Add one more line to the program to demonstrate one more
feature of vertical tabs.
80 LPRINT CHR$(ll);"FIFTH TAB."
Now when you run the program the first page looks just like before, but line 80 sends one more <VT> than there are tabs. This doesn’t confuse your printer - it advances the paper to the
next tab position which happens to be the first tab position on
the next page. That’s nice, isn’t it?
Table 4-9
Vertical tab commands
Advance paper to next tab posi-
n Vertical tab channels
Vertical tab channels are especially helpful in two situations. The first occurs when you are writing a program to accompany a preprinted form that can accommodate various types of responces. The second occurs when you create a multipage form or report with different vertical tabs on each page.
Table 4-10
Vertical tab channel commands
Function
Set vertical tabs at nl, n2, etc.
as channel n0
Select vertical channel n0
Control code
(ESC)“b”CHR$(nO) CHR$W)
CHR$(nZ).....CHR$(O)
(ESC)“I”CHR$(nO)
You can store up to eight channels of tab stops. They are
numbered from 0 to 7. If you have already stored a set using
(ESC)“B” command, your printer has labelled it as channel 0.
Try this program how to see the vertical tab channels work.
10 1 Demo of vertical tab channels 20 LPRINT CHR$(27>;"b';CHR$(l>;CHR$(lO);CHR$(2O);
CHR$(O) ;
30 CLHPRHl~oT)CHR$(27);"b";CHR$(2);CHR$(15);CHR$(25);
.
2
40 ~~~~~~)CHR$(27);"b";CHR$(3);CHR$(l7);CHR$(28);
;
65: FOR 1 Use I=1 vertical TO tab channels
3 70 LPRINT "TOP OF FORM" 80 LPRINT CHR$(27);"/";CHR$(I); 90 LPRINT CHR$(ll); 100 LPRINT "1ST TAB OF CHANNEL";1 110 LPRINT CHR$(ll); 120 LPRINT "2ND TAB OF CHANNEL";1
130 LPRINT CHR$(12); 140 NEXT I 150 LPRINT CHR$(27);"@" 160 END
When you run this program you should get like this.
TOP OF FClRM
TOF’ OF FORM
1ST TAB OF CHANNEL 2
ZND TAB OF CHANNEL 2
TOP OF Fllh’t’l
1ST TAB OF CHANNEL 1:
2ND TRB CIF CtiRNNEL. 3
f-w
In this program we set tabs at 10 and 20 in channel 1 in line
20. In line 30 we set tabs 15 and 25 in channel 2, and in line 40 we set tabs 17 and 28 in channel 3.
Because the channels are stored, you must make the printer to recall one before you use it, so we used (ESC)“I”CHR$(nU) in line 80.
CENTERING AND ALIGNING TEXT
Text can be arranged in any of three formats: left aligned (nor­mal printing with “ragged” right margin), centered between the margins, or right aligned. These are selected by the following commands.
Table 4- 11
Aligning commands
Function
Left-aligned printing Centered printing Right-aligned printing
Control code
(ESC)“a”CHR$(O) (ESC)“a”CHR$(l) (ESC)“a”CHR$(2)
Try this program to see how easy it is.
10 "Demo of aligning and centering 20 LPRINT CHR$(27);"1";CHR$(20); 30 LPRINT CHR$(27);"Q";CHR$(60); 40 LPRINT CHR$(27);"a";CHR$(O); 50 LPRINT "THIS LINE IS LEFT-ALIGNED." 60 LPRINT CHR$(27);"a";CHR$(l); 70 LPRINT "THIS LINE IS CENTERED."
80 LPRINT CHR$(27>;"a";CHR$(2);
90 LPRINT "THIS LINE IS RIGHT-ALIGNED;"
When you run this program, you should get like this:
Tl-I I s L. I NE
:I: t;- I.-.E:FT’-.I-Il.... I GI’.lEw:) ”
-r 1.4 :[ s I._ :I. I\I EZ
1 s w :I: G 1.4 -r --. 4 I....
I G 111 E 12 m
CHAPTER 5
SPECIAL FEATURES OF
THE PRINTER
Subjects we’ll cover in Chapter 5 include-
* Printer’s bell;
l Master reset; l Uni-directional printing;
l International character sets; l Printing BIG characters; l The optional sheet feeder; l Macro instruction; l Reading a hex dump.
In the previous chapters we have learned about several groups of control codes. In this chapter we will look at more con­trol codes. These codes don’t fit neatly into any of the groupings that we have studied, but they add a lot of capability to your printer. So here goes.
n Now hear this
You may have heard the printer’s bell if you have ever run out of paper. And you may have wondered why it’s called a bell when it beeps instead of ringing! It’s a long story that goes back to the early days of computers, when teletype machines were us­ed for computer terminals. These mechanical marvels had a bell in them that could be heard for blocks. This bell was used to signal the operator that somethings needed attention. The code that the computer sent to the teletype machine to ring the bell was, reasonably enough, called a bell code. Well the name bell
.
code is still with us, even if the bell has changed to a beeper, and a lot of people still call the beeper a bell, even if it doesn’t sound like one. So with our trivia lesson out of the way, let’s see how we can “ring the bell.”
The code to sound the “bell” is CHR$(7), which is ASCII code 7 or (BEL). Any time your printer receives this code it will
62
sound the bell for a quarter of a second. This can be used to re­mind an operator to change the paper or to make another adjust­ment to the printer.
You can try this by typing:
LPRINT CHR$(7)
n Resetting the printer
Up to now when we wanted to reset the printer to the power on condition we have had to either turn the printer off and then on again, or to send the specific codes that reset the particular features. There is an easier way. The control code (ESC) “@” will reset all of the printer’s features to the power on condition (as determined by the DIP switches), with two exceptions. Those exceptions are that (ESC) “a” will not erase any characters that you have stored in the printer’s RAM memory
(Chapter 5 tells you how to create your own characters), and it
won’t erase the macro if you have one stored in the printer’s
RAM (this chapter will tell you how to create a macro).
In addition, if you set the “Panel” mode, “Italic” mode, or “Italic and Panel” mode by the control panel settings at the power on, these functions will be remain with this control code.
n Putting your printer to sleep
You know how to put your printer off line with the On Line key on the control panel. Your printer has another off line state that can be controlled from your computer. When you turn the printer off line from your computer, this printer will ignore anything that you send it, except for the code to go on line again. CHR$(lS) is the code to turn your printer off line; CHR$(17) turns your printer to on line status.
n Printing the bottom of the sheet
Sometimes when you are using individual sheets of paper you may want to print near the bottom of a sheet. The paper-out detector usually stops the printer when you are about 1 inch from the bottom of the sheet. This is notify you if you are runn­ing out of continuous paper.
Your printer has the ability to print right to the bottom of the
sheet. You can disable the paper-out detector so that it doesn’t
stop the printer. This will allow you to print to the end of the
sheet, and even beyond if you are not careful. The codes to con­trol the paper-out detector, along with the other codes that we have just learned are in the following table.
Table 5-1
Some miscellaneous commands
Function
Sound bell 1 CHRU7J
1 Master reset
I Off line
On line
Paper-out detector off
1 Control code
1 (ESC) “a” 1 CHRW
CHR$il
WC)
Paner-out detector on (ESC)
I Move mint head back one sDace I CHRW
Delete last character sent Cancel text in print buffer
I Print “slash zero”
I Print “normal zero”
Immediate-print on Immediate-print off
n Backspace, delete, and cancel text
CHR$(127)
CHR$(24)
I (ESC) “-‘I 1
1 (ESC)’
(ESC) “i”1 (ESC) “i”0
0
“-“0
Backspace (CHR$@)) “backs up” the printhead so that you can print two characters right on top of each other. Each time your printer receives a backspace it moves the printhead one character to the left, instead of to the right. You can strike over multiple letters by sending more than one backspace code.
Delete (CHR$(127)) also “backs up” one character, but then it “erases” the previous character (it’s erased from your printer’s
buffer, not from the paper).
Cancel text (CHR$(24)) deletes all the text in the print buffer;
that is, in the line before the delete text command. Since your printer prints one line of text at a time, only that line will be deleted.
The following program shows how these codes works.
,
10 LPRINT 20 LPRINT 30 LPRINT 40 LPRINT
"BACKSPACE DOES NOT";
CHR$(8>;CHR$(8);CHR$(8); ~I=== WORK"
"DELETE DOES NOT";
50 LPRINT CHR$(127);CHR$(127);CHR$(l27);
60 LPRINT "WORK"
70 LPRINT
80 LPRINT CHR$( 24);
"CANCEL LINE";
90 LPRINT "DOES NOT WORK"
Here is what this program will print:
The backspace codes in line 20 move the printhead a total of three spaces to the left so that the first part of line 30 will over­print the word “NOT”. The delete codes in line 50 “erase” the three letters in the word “NOT” so that it doesn’t even print.
In line 80, CHR$(24) deletes the words in line 70. The semicolon at the end of line 70 prevents a line feed from causing that line to print before the printer receives the CHR$(24) code. The text in line 90 prints as it normally would because it is after
CHR$(24).
n Printing zeroes
Believe it or not, there are two types of zeroes. There is of
course the type we use every day - 0 - and this is what your printer will print if you don’t do anything.
The other type is used almost exclusively in computers and
engineering. It is called the “slash zero” and is written like this -
0. The line through the number is supposed to prevent you from misreading it as the letter printers were available, this was a good idea but you really have no need for it (although you may want to use the slash zero for special effect).
W Immediate-print
This printer can print at fine rate of 120 characters per se-
cond. But it will also print more slowly at the speed of your typ­ing. In immediate-print mode, the printhead prints one character at a time, as you send it. This printer also moves the paper up so that you can see the current line and then down to continue printing.
“0”. Back before high-quality
65
You can turn immediate-print mode on with (ESC) “i” 1. But before looking at it, let’s review the normal operation of the print buffer. Enter this program.
20 A$="" : INPUT
30 IF A$="" THEN 50
" TYPE A CHARACTER ",A$
40 LPRINT A$; : GOT0 20 50 LPRINT
: LPRINT CHR$(27);"@"
Now type several characters, and after each press the RETURN key. True to form, the printer just stuffs the characters into its buffer while it waits for a carriage return code. (In this program the RETURN key doesn’t send a car­riage return code.) To end this program and print the contents of the buffer, press RETURN alone.
Now add this line:
10 LPRINT CHR$(27);"il";
And RUN the program. Your printer responds to your typing -
immediately.
When you are finished, press RETURN alone.
n Adjusting the width of space between characters
This printer provides a command that adjusts the space be­tween the NLQ characters that it prints when the DIP switch l­6 is set on. The (ESC) CHR$(32) CHR$(n) command adds blank space between the characters. The units of space that are added vary in l/60-inch units.
Try this program to see how this works.
10 ’
Demo of adjusting spaces
20 LPRINT CHR$( 27);"xl";
30
FOR I=10 TO
1 STEP -2 40 LPRINT CHR$(27);" ";CHR$(I); 50 LPRINT "This line is added";I;"spaces."
60
NEXT I
70 LPRINT "This line is Normal space." 80
END
This This line is This line is This line is This line is added 2 spaces.
This line is Normal space,
line is added 10 spaces.
added 8 spaces.
added 6 spaces.
added 4 spaces.
This command can be used to produce micro-justification,
which is a method of justifying lines by incresing the space be-
tween each character.
n Uni-derectional printing
Uni-directional printing is a big word that means printing in
one direction only. Your printer normally prints when the print­head is moving in both directions. But once in a while you may
have an application where you are more concerned about how
the vertical lines align than with how fast it prints. This printer
lets you make this choice. The table below shows the commands
for controlling how this printer prints.
Table 5-2
Printing directin commands
Function
Print ih one direction Print in both directions (ESC) “U”0 One time mint in one direction (ESC) “0’
Control code
(ESC) “U”l
Try this program to see the difference that printing in one
direction makes.
10 ) Demo of uni-directional printing
20 LPRINT CHR$(27);"1";
30 FOR I=1 TO 10
40 LPRINT 11 1"
50 NEXT I 60 LPRINT : LPRINT
70 LPRINT CHR$(27) ;"Ul";
80 FOR I=1 TO 10
90 LPRINT "I" 100 NEXT I 110 LPRINT CHR$(12);CHR$(27);"@"
67
Here is what you will get. The top line is printed bi-directional­ly, and the bottom is printed uni-directionally. You will have to look hard because there isn’t much difference.
Let’s analyze the program. Line 20 sets the line spacing to 7/72 of an inch so that the characters that we print will touch top to bottom. Lines 30 - 50 print 10 vertical line characters. Then line 70 sets one-direction printing and the vertical lines are
printed again. Finally line 110 sends a form feed to advance the
paper to the top of a new page, and then uses the master reset to restore the printer to the power on condition.
You can also set the printer to print in one direction for one line only by using the (ESC) “(” command. This command im­mediately moves the printhead to the left margin and then prints the remainder of the line from left to right.
W The seven bit dilemma
Certain computers (but not the IBM-PC fortunately!) don’t have the capability to send eight bits on their parallel interface. They can only send seven bits. This would make it impossible for these computers to use this printer’s block graphics characters and special symbols if our engineers hadn’t thought of a solution. (All of these characters have ASCII codes greater than 127 which means that the eighth bit must be on to use them.) The solution lies in the three control codes given in the following table:
Table 5-3
Eighth bit controls
Function Control code
Turn the eighth bit ON (ESC) “>” Turn the eighth bit OFF (ESC) “=” ~ec~~~~;t~ bit “as is” from ( ESC > ,,#,,
n Block graphics characters and special symbols
Besides the upper and lower case letters and symbols that we are by now familiar with, your printer has a whole different set of characters that are for special uses. These characters include block graphics for drawing forms and graphs, and special sym­bols for mathematical, engineering and professional uses. The special characters are included in two character sets. The character set you normally use with IBM mode is called character set #l. The special characters are printed out when you send ASCII codes 160-255 to the printer.
Your printer also offers character set #2 which is almost the same as character set #l except for the addition of ASCII codes 3-6,21, and 128-159. Character set #2 is selected with (ESC) “6”; to go back to character set #l, use (ESC)“7”.
You can also specify the power-on default character set by set­ting DIP switch l-7 on for character set #l and off for character set #2. The following program will print out all of the graphics characters available:
10 LPRINT CHR$(27);"0"; 20 LPRINT CHR$(27);"6";
30 FOR J=3 TO 6 40 LPRINT "
d';J;CHR$(J.);CHR$(9);
50 NEXT J
60 LPRINT " 20 ";CHR$(20)
70 LPRINT
80 LPRINT " 21
';CHR$(21);CHR$(g); 90 LPRINT " 26 "; 100 LPRINT CHR$(26) 1'20 LPRINT 130 FOR ~=128 TO 254 STEP 5 140 FOR I=J TO J+4 150 IF I>254 THEN 170 160 LPRINT I;CHR$(I);CHR$(g); 170 NEXT I 180 LPRINT : LPRINT 190 NEXT J
69
Figure 5- 1. Character set #2
70
Figure 5-l shows what this program will print. If your chart
doesn’t 1001 like this because it has regular letters and numbers instead of the special symbols, then your computer is only using seven bits. You can get the correct printout by changing line
160 to this:
160 LPRINT I;CHR$(27);">";CHR$(I);CHR$(27);"=";
CHR$(9);
A note for the IBM-PC users.
When you run this program, you cannot get the right-pointed
arrow (CHR$(26)) with the IBM-PC computers. This is because
the IBM-PC does not send this code to the printer.
There is a solution to avoid this problem. Change lines 100
120 to the either set of the following lists.
and
100
O=INP(&H379)
110
OUT &H378,26 : OUT &H37A,5 : OUT &H37A,4
120
LPRINT : LPRINT
: IF 0~128 THEN 100
100
O=INP(&H3BD)
110
OUT &H3BC,26 : OUT &H3BE,5 : OUT &H3BE,5
120
LPRINT : LPRINT
SO
show are all of these strange characters used? Here is a short program that demonstrate how the graphics characters can be combined to create a figure: the 5 of clubs.
: IF 0~128 THEN 100
10 LPRINT CHR$(27);"6"; -. 20
LPRINT CHR$(218);CHR$(l96);CHR$(l96); cHR$(l96);CHR$(l96);CHR$(l96);CHR$(19l)
30
LPRINT CsR$(l79);CHR$(53);CHR$(32);cHR$(32); CHR$(32);CHR$(32);CHR$(l79)
40
LPRINT CHR$(l79);CHR$(32);CHR$(5);CHR$(32);
CHR$(5);CHR$(32);cHR$(l79)
50
LPRINT CHR$(l79);CHR$(32);CHR$(32);cHR$(5);
.
CHR$(32);CHR$(32);CHR$(179)
60
LPRINT CHR$(l79);CHR$(32);CHR$(5);CHR$(32); CHR$(5>;CHR$(32>;CHR$(179)
70
LPRINT CHR$(l79);CHR$(32);CHR$(32);CHR$(32);
CHR$(32>;CHR$(53);CHR$(179)
80
LPRINT CHR$(l92>;CHR$(l96);CHR$(l96);
CHR$(l96>;CHR$(l96>;CHR$(l96);CHR$(217) -
90
LPRINT CHR$(27);"7"
71
If you have a 7-bit interface, add the following lines to the pro-
gram given above:
15 LPRINT CHR$(27);">"; 95 LPRINT CHR$(27);"="
In this program line 10 selects character set #2 so that all the
graphics characters can be used (including the “club” sym­bol). Then lines 20-80 print the 5 of clubs figure. Line 90 cancels character set #2 (which is the same as selecting character set #l).
Here is what this program prints:
,H International character sets
Your printer is a multi-lingual printer for it can speak in
eleven languages! Your printer changes languages by changing
12 characters that are different for the different languages.
These sets of characters are called international character sets. The control,codes to select the international character sets are
given in Table 5-4.
72
Table 5-4
International character set commands
I Countrv
The characters that change are shown beneath their ASCII
code in Table 5-5.
Table 5-5
International character sets
Country ~35~36~64~91~92~93~94~96~123~124~125~12
U.S.A I#lsl@lcl\lll*l’lcl:l,l~
IFrance
I Germany l#l$lsl~l~lul^l’l~lal~lR
England
Demark type I #$@E~L-zi;;-
Sweden
Italy
n Printing characters in the control code area
When you refer the Appendix B, you’ll find many characters are printed in the control code area. (Remember that the low­order control codes are the ASCII codes 0 through 31 plus 127, and the high-order control codes are 128 through 159 plus 255.)
These codes don’t normally print symbols on paper, rather they cause the printer to change modes. To make them print as normal symbols requires an extra command. For example, the
al~lrl~lil~l~l~l~l~l-
f .I. G I.
#rl~At5AUBZ~Bi.i
73
command to “normalize” the high-order control codes is (ESC) “6”. Try this program with the DIP switch 1-6 on.
10 ’ Demo of characters in the high-control code
area
20 LPRINT CHR$(27);"6";
30 FOR I=128 TO i59
40 LPRINT CHR$(I);
50 NEXT I
60 LPRINT CHR$(27);"7"
70 END
When you run this program you’ll get like this:
That’s where the italic international characters have been
stored. So the (ESC)“G” command without the (ESC)“R” gives you access to the international characters. The (ESC)“7” turns these characters back into control codes.
The low-order control codes can also be defined, but not all of them can be printed with ease. The (ESC)“I” 1 command makes them printable, and the (ESC)“I”O command returns them normal.
Just as the higher control codes hide the italic international characters, the lower control codes hide the roman international characters.
Let’s see how these commands work with the following pro­gram:
* Demo of characters in the control code a?e
;: LPRINT CHR$(27);"11";
30
FOR I=0 TO 6
40
LPRINT CHR$(I);
50
NEXT I
60
LPRINT CHR$(16);CHR$(17);
70
FOR I=21 TO 31
-80
LPRINT CHR$(I);
90
NEXT I
100
LPRINT
no FOR 1=128 TO 134 120
LPRINT CHR$(I);
74
130 NEXT I 140 LPRINT CHR$(144);CHR$(145); 150 FOR I=149 TO 159 160 LPRINT CiSS(I); 170 NEXT I 180 LPRINT CH?.$(27);"10" 190 END
When you run this program you should get like this:
Table 5-6
Control code area co
lmmands
Function
Printable code area expansion
Control code area expansion
C
kkct undefined codes as characters
(Cancel undefined codes as characters
n Printing BIG characters
Control c
(ESC)“G” 1 (ESC>“7” I (ESC)“I”l
. .
I (ESC)“I”O
You can even enlarge your character sets for attention-grabb­ing headings or special effects. There are six commands you can use. Everything following any of them will be enlarged as shown below, until the cancel code is entered.
Table 5-7
Big character corn
Function
Double-high enlarged print
Quad-high enlarged print
1 Double-high lower-half enlarged mint
.Double-high upper-half enlarged print
Quad-high lower-half enlarged print
Quad-high upper-half enlarged print
I Cancel enlarged print
1 (ESC)“h”(
1 (ESC)“h”(
mands
Control c
(ESC)“h”(
:HR$UJ I
(ESC)“h”CHR$(2)
:HR$(3)
(ESC)“h”CHR$(4)
(ESC)“h”(
;HR$(5)
(ESC)“h”CHR$(G)
ZHR$(O)
I
Try this program to see the big characters.
10 ' Demo of BIG characters
20 LPRINT "THIS IS I'; 30 LPRINT 40 LPRINT "DOUBLE"; 50 LPRINT CHR$(27) ;"h";CHR$(O); 60 LPRINT "
70 LPRINT 80 LPRINT "THIS IS I'; 90 LPRINT
100 LPRINT
110 LPRINT
120 LPRINT "
130 END
When you run this program, you will get like this:
CHR$(27);"h";CHR$(l);
SIZED PRINTING."
CHR$(27);"h";CHR$(2);
"QUAD"; CHR$(27>;"h";CHR$(O);
SIZED PRINTING."
75
As you can see, when the big character command is used, the baseline for each character does not align. When you want to ?lign the baseline, try this program:
Demo of aligning BIG characters
10 ’
20 LPRINT "THIS IS 'I; 30 LPRINT 40 LPRINT 50 LPRINT "DOUBLE"; 60 LPRINT 70 LPRINT 80 LPRINT " SIZED PRINTING." 90 LPRINT :LPRINT :LPRINT 100 LPRINT "THIS IS 'I; 110
LPRINT 120 LPRINT 130 LPRINT 140 LPRINT 150 LPRINT 160 LPRINT " SIZED PRINTING." 170 LPRINT 180 END
CHR$(27);"j";CHR$(21); CHR$(27);"h";CHRS(l);
CHR$(27);"h";CHR$(O); CHR$(27);"J";CHR$(18);
CHR$(27);"j";CHR$(63); CHR$(27);"h";CHR$(2); "QUAD"; CHR$(27);"h";CHR$(O);
CHR$(27);"J";CHR$(63);
:LPRINT
When you run this program, you will get like this:
n The optional sheet feeder
The automatic sheet feeder is a handy option that feeds single cut sheets automatically. Work done on cut sheets looks better that done on computer paper, and you don’t have to tear the
“ears” off each sheet as you must with fan-fold paper.
The automatic sheet feeder feeds a new sheet automatically every time the printer receives or generates a form feed. Any time you wish, you can turn the auto-feed unit on and off by using control codes.
Table 5-8
Automatic sheet feeder commands
When the automatic sheet feeder is installed, you must set the
DIP switch 1-5 on to detect the paper-out condition.
In addition, following functions are ignored when the auto-
matic sheet feeder is installed:
Setting of the page length Top and bottom margins Vertical tab settings
n The macro control code
The last of our group of miscellaneous codes is definitely not
the least. It is a user-defined control code, called a macro control code. The term macro is from the jargonese macro-instruction
77
which refers to an instruction that “calls,” or uses a group of nor­mal instructions. In computer programming macro-instructions (which are similar to subroutines) save programmers a lot of time and effort. Your printer’s macro can save you a lot of time and effort also.
Here is how the printer’s macro works. You define macro by telling the printer what normal control codes are to be included in the macro. Then you can use the macro any time that you want and the printer will do all the things that you included the macro definition. You can include up to 16 codes in a single macro. You can even use the macro to store a frequently used word or phrase. There are two control codes for the macro: one to define it, and one to use it. They are given in the Table 5-9.
Table 5-9
Macro instruction commands
Function
Define macro Use macro
Control code
(ESC)“+“...(codes you include) . . .
CHR$(30)
(ESC)“+“CHR$(l)
To see how this works we can build a macro that will reset the printing style to normal, no matter what style it may be to start with. The following program will define a macro to do this.
10 LPRINT CHR$(27);"+";
'Start macro
20 LPRINT CHR$(27);"h";CHR$(O); 'Big character
off
30 LPRINT CHR$(27);"!";CHR$(O>; 'Select normal
pica
40 LPRINT ~~~$(27);"Tfl; 'Super &
subscripts off
50 LPRINT ~H~$(27);'*211;
lSet l/6 inch
line spacing
60 LPRINT CHR$(27);"a";CHR$(O); 'Left-aligned
printing
70 LPRINT CHR$(30)
'End macro
definition
As the comments in the program, we started to define macro
in line 10. Line 20 cancels the big character printing. Line 30 sets the normal pica, and also this command cancels the propor-
78
tional pitch, condensed print, expanded print, boldface, em­phasized, and the underlining. Line 40 cancels the superscripts and the subscripts. Line 50 sets the line spacing to l/6 inch, and line 60 sets the left-aligned printing. Then, line 70 ends the macro definition. This printer will remember this macro until the power is turned off or until a new macro is defined. A macro can hold up to 16 bytes (characters) of information. The one that we defined contains thirteen.
Now that you have defined a macro, let’s see how to use it. This program will print one line using several printing features. Then it “calls” the macro in line 60. When line 80 prints the style is “plain vanilla” because the macro has reset it.
10 LPRINT CHR$(2'7);"Q";CHR$(40); 20 LPRINT CHR$(27);"af';CHR$(2>; 30 LPRINT CHR$(27);"-1"; 40 LPRINT CHR$(27>;"h";CHR$(l); 50 LPRINT "TESTING ABCD"
60 LPRINT CHR$(27>;"t";CHR$(l);
;; g;I?INT "TESTING ABCD"
TIES-b I INI: AIBC::ll2
_.__.,_-.-,.. - _.-..... - -.... - ..-..,. “___I-.......-...
lIZ.S'T 1: IG AECI?
n Reading a hex dump
We’ve seen how to make a hex dump in Chapter 1, but it’s not really clear what we can do with one. We need a little background first.
The BASIC in some computers changes ASCII codes before they send them to the printer. If you run into problem because of this, try this hex dump to check the ASCII codes.
First turn off the printer and run the following program. Hold down both the Paper Feed key and Mode key and turn on the printer.
10 FOR I=0 TO 255 20 LPRINT CHR$(I); 30 NEXT I 40 LPRINT 50 END
79
If your system passes the codes directly to the printer without
changing them, you will get like this. (You can print out the last remaining line in the print buffer by putting the printer off line with the On Line key.)
a:,,:, 01 02 I:)? 04 05 06 07
If.1 11 I:: 1.3 14 15 16 17 20 21 2” 23 24 25 26 27 70 ?I 3? 7, 34 3s 36 37 40 41 42 43 44 45 46 47 50 St s2 53 54 55 56 57 60 61 62 6: 64 65 66 67
71) 71 72 73 74 75 76 77 80 Al 02 Es? 04 El5 86 87 70 71 72 73 94 75 96 97 60 01 A2 a3 44 a5 Cl6 F17 PO RI H2 83 B4 B5 Rh B7 co Cl C2 C3 c4 cs Cb c7 DO Dl D2 D: D4 D5 Db D7 EO El Er) E3 E4 E5 Eb E7 FL> Fl F2 F3 F4 FS Fb F7 ou Oh
28 29 20 2H 2C 2D X ?F
7.8 39 3a 3” TC 3D 7E 7;f’ 48 49 40 48 4C 41) 4E 4F 58 59 5f1 5% 5C 5D 5E 5F
4R 69 6A 6P 6C 6D 6E 6F
78 79 7A 7B 7c 7D 7E 71. BE 89 RA BB EK RD SE rjf­98 99 9A 9B 9C 9I.I 9E 9F 648 F19 AA FIR AC RD fiE FIF BE3 B9 BFI RH BC SD BE BF CE C9 CA CB CC CD CE CF DB D9 DCI DR DC DD DE DF ES E9 EA EB EC ED EE EF FE F9 F0 FE FC FD FE FF
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . .
* ; “#9X?!’
0127.4sh-7B9: :
l~~RCDEFT7tiJ.Jt’LMNO PORSTlJVWXYZC\ I”,-
‘nhcdef qhi -ib 1 mm
pqrstuvwxyz:ll”.
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
................
................
.....
................
................
. .
Most BASICS, however, are not quite that straight forward.
For example, the IBM-PC prints like the following.
Or:, 0 1 02 03 Q4 05 06 07 0F 10 11 12 13 14 15 16
’ 20 21 22 23 24 25 26 27
‘I.0 31 32 33 34 35 36 37 40 41 42 43 44 45 46 47 50 51 52 s3 54 55 56 97 60 61 h:! 63 64 65 66 67 70 71 72 73 74 7s 7h 77 En 01 82 93 84 85 Oh 87
71.1 91 92 93 94 95 96 97 ra1.J at A2 a.3 A4 05 aa 07
HO Bl B? R3 B4 85 86 R7 CO Cl C2 C3 C4 C5 C6 C7 DO Dl DI! D3 D4 D5 Dh D7
EO El E2 E3 E4 E5 E6 E7 F0 Fl F2 F3 F4 F5 F6 F7 0D UFI
00 09 OA OB IX 0D I:Ii? 0E
17 18 19 lB 1C ID 1E if-
28 27 20 28 2C 2D 2E “F 38 39 74 3f1 7.C 3D TE :.F 4R 49 40 4R 4C 41, 4E 4F­50 59 sa 5R SC 51) 51-I 5f­6R 67 60 6B 6C 6D 6E 6r 7R 79 7FI 7H 7C 7D 7E 7F RR 87 RR Elf3 BC nu RI7 I-IF 9R 99 90 9B 91: 9D 9E 9F At3 A9 Ah AR FIG RD AE nF BEI B9 PA RB EC BD BE Bt­CO C9 CF\ CR CC CD CE r:F DO D9 DA DR DC DD DE DF ES E9 EA EB EC ED Et: EF FB F9 Fe FB FC f=D FE FF
. . . . . . . . . . . .
‘;~~k*zv o*+,-./
,:,I 2.3456789: : .C = %-­I~nBTDEFStiI.J~L.FINO KIRRTUVWXY7C\l”-
‘ahcdefghiiI.lmno
pqr.‘.tLlvW:<y;ICI:“.
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. .
ox+.-./
...........
<Y’>”
Notice that your printer is receiving decimal code 13 (hex OD)
is coming with hex OA, which is really decimal 10. In addition,
your printer does not receive decimal code 26 (hex 1A).
Your printer prints hex numbers 16 per line, with printing the characters on the right side. If it receives less than 16, it sits in a holding pattern, awaiting more data. Taking the printer off line
80
dumps the characters to the paper.
To debug a program quickly, just use the hex dump capabili­ty. Appendix B will help you translate the hex codes to ASCII equivalents.
CHAPTER 6
CREATING YOUR
OWN CHARACTERS
Subjects we’ll cover in Chapter 6 include -
l Designing and printing your own characters; l Designing proportional characters ; l Designing your own characters with NLQ.
In the previous chapters of this manual you’ve learned how to control the printer to give dozens of different typefaces. By us­ing various combinations of pitches, character weights, and font selections, you can create nearly any effect you want to in text. And with international character sets and the special text and big characters described in Chapter 5, you can print almost any character you think of.
But if “almost any character” isn’t good enough for you, then it’s a good idea you have this printer! With it you can actually create your own characters. As you’ll see in this chapter, download characters can be used to print a logo, special
characters for foreign languages, scientific and professional ap-
plications, or any other specific printing task.
DOT MATRIX PRINTING
In order to create download characters, you’ll need some
understanding of how dot matrix printers work. They’re called
“dot matrix” because each character is made up of a group of dots. Look closely at some printed characters produced by your printer and you will see the dots. Figure 6-1 shows how the let­ter “C” is formed by printing 15 dots.
The printhead in this printer consists of nine wires stacked one atop the other. Figure 6-2 shows an enlarged schematic view of the front of the printhead, showing the ends of the wires and their relationship to the printed draft characters. As you can
see, the capital letters use the top seven wires of the printhead, and the descenders (such as the lower case “p” shown) use the bottom seven pins. As the printhead moves across the page (in either direction - that’s what is meant by bi-directional print­ing) it prints one column of dots at a time. Each time a dot is sup­posed to print an electromagnet inside the printhead causes the appropriate wire to strike the ribbon (making this printer an im-
pact printer).
I
Figure 6- 1.
The letter “C” is created by printing 15 dots.
1
5gure 6-2.
As the printhead moves across the page, each of the
wires prints one row of dots.
THE PRINT MATRIX
All of the standard characters that this printer prints are form-
ed from patterns of dots that are permanently stored in the printer’s ROM (read-only memory). This includes all of the stan­dard ASCII characters, and special characters, the international
83
character sets, and the NLQ characters.
But there is another area of memory in this printer reserved
for user-defzked characters. These are characters that you can
design and download into the printer. When download characters are defined they are stored in RAM (random access memory), which allows you to define or modify them at any time.
Each of these characters, whether it is from the standard character ROM or in download RAM, is constructed on a grid which is six “boxes” by nine “boxes” high. In addition, a dot can straddle any of the vertical lines. As an example, take a look at the enlarged “9” superimposed on the grid in Figure 6-3. As you can see, some dots are inside the boxes, and some are centered on the vertical lines. This, in effect, makes the character grid 11 dots wide by 9 dots high. To see how the rest of the characters
in the standard character ROM are constructed, take a look at
Appendix C.
L
Figure 6-3.
Dots can be inside boxes or straddle the vertical lines
___ _ . -..
of the grid.
DEFINING YOUR OWN CHARACTERS
You’ve seen how these characters are designed by using a grid to layout the dots. Now you can define characters exactly the same way. Make up some grids (photocopy Figure 6-4 if you wish) and get ready to be creative! (Just in case you are not feel­ing creative, and to make our explanations a little clearer, we’ll be using a picture of a chemist’s flask as an example of a draft
download character. You can see how we’ve laid it out in Figure 6-5. Later in this chapter we’ll use this character to create a small graph.)
m,m,m,m.m,m,m,m,m,m,,m,,
ASCII Code
Descender
32
16
Total
E
Tigure 6-4. Use this grid (or one similar to it) to define your owr
Start column End column
M, = Descender l 128 + (Start * 161 + End
draft characters.
You’ll notice that Figure 6-4 includes a lot of informatior around the grid. Don’t be intimidated; we’ll explain each item as we come to it in our discussion of defining and actually printing download characters. You may have noticed another difference between this grid and the one sh.ow in Figure 6-3: it’s only eight boxes high. Which leads us to . . .
H Rule 1: Draft download characters are eight dots high
As you noticed in Figure 6-2, capital letters, most lowercase letters, and most special characters use only the top seven pins of the printhead. Draft download characters can go one better: they can use as many as eight of the nine wires in the printhead. So our grid is eight dots high.
It’s also possible to use the bottom eight pins, just as the “g”,
“-73 “ >9
19 P7
“q”, and “y” of the standard character sets do. These
are called descenders (because the bottom of the character descends below the baseline of the rest of the characters).
i 1
1
85
One bit in the download character definition command is to be treated as a descender or not. We’ll get to the command in due time. For now, if your character uses the top eight dots, write in a one next to the word “Descender” on the layout grid; if it uses the bottom eight dots, write in a zero. In our example, we’ll want to the bottom of the flask to line up with the baseline of the other characters, so it will not be a descender. As shown in Figure 6-5, we’ve written in a “1” on out grid.
m,m,m,m.m,m,m,m,m,m,,,m.,
128
64
32
16
8
4
2
1
blal
Figure 6-5.
We’ve designed a character and decided that it woulc
ASCII Cede
Descender
Start column End column
M. = Descender l 128 + (Start l 161 + End
1
not be a descender, hence the “1” written in.
n Rule 2: Dots cannot overlap
As you can see in Figure 6-5 our flask has a nearly continuous outline. But, you may ask, why not make it a really solid line and print all the intermediate dots, as shown in Figure 6-6? Because the dots that straddle the vertical lines in the grid actually overlap those inside the boxes. If we tried to print overlapping dots, the printhead would have to slow down and back up to print both dots - not very efficient! To avoid this inefficiency, this printer will not allow you to define a character like Figure 6-
6. (Actually, you can define it, but when it prints, your printer
will leave out the overlapping dots, so that it would print like
Figure 6-5.)
m m, m, m, m. m. m m, m. m m
1
ASCII Code
WRONG!
64
32
16
4
2
1
Tolal
Figure 6-6.
cots cannot overlap; those in immediately adjacent
“half columns” will be ignored when the character is printed.
W Add up each column of dots
Now it’s time to give our creative side a break and get down to some basic arithmetic. That’s where the numbers down the left side of the grid come in. Notice that there is a number for each row of3 dots and that each number is twice the number below it. By making these numbers powers of two we can take any com­bination of dots in a vertical column and assign them a unique value. Some examples will make this clearer. As shown in Figure 6-7, if we add the numbers for the dots that print in a col­umn, the sum will be a number in the range of 0 to 255. Each number from 0 -
255 represents a unique combination of dots.
Descender
Start column End column
M, = Descender l 128 + (Slat1 * 16) + End
i
128
64
32 / 16 / - 8
!
Sum
0 - 64 0 - 32 . - 32
4
o-4
2
o-2
1
O-l
~ ___
103 58
0 16 ­O-8
O-2
O-128 0 - 64 l - 32 0 - 16 o-8 O-4 o-2 O-1
255
Figure 6-7. By adding the values of each dot in a column, you’ll get
a unique description for any combination of dots.
87
So add up the values of the dots in each column using this system. In Figure 6-8 we’ve shown our grid with the sums of the columns filled in across the bottom (see if these agree with your answers!). Across the top of the grid you’ve probably noticed the cryptic labeling of each column: ml, m2, m3, etc. These labels correspond to the labels in the command syntax state­ment, which we’ll get to shortly.
m. m, m, m. m, m, m, mR mp m,,. m,,
128
64
32
16
pigure 6-8. Add the values of the dots in each column and write
the sum of each column at the bottom.
n Assigning a value to your character
ASCII Code
Descender
Start column End column
M, = Descender * 128 + (Start * 16) + Enc
We’ve done a pretty through job of designing and describing a user-defined character. But this printer has room for 96 download characters - how does it knows which standard
character we want to print: every character is assigned a unique number.
The standard characters are assigned the ASCII codes ­numbers from 0 to 255. For the download character sets you can also define any positions between 0 to 225. This means that once a character is defined and assigned a value (and the download character set is selected, you can use that character on the printer the same way you would any standard character. You can send the character with the same ASCII value. You can
I
/
also access the character from a BASIC program with the CHR$ function.
There are no rules or restrictions on the use of numbers. This means you can use whatever is most convenient for you ­perhaps seldom-used keys can be replaced by more useful
characters. In our example, we’ll assign the flask a value of 60, which is the code for the character “(” in the ASCII characters. A rather arbitrary selection, but this printer doesn’t care!
Our chart would hardly be complete with just a picture of a chemist’s flask, so in Figure 6-9 we’ve made completed grids for some other symbols: an automobile and a gun (quite a strange mix of characters!). The information on the grids is now com­plete (except for proportional width data - a more advanced topic we’ll take up shortly).
Tigure 6-9. Character designs for the three graph symbols.
89
n Download character definition command
You’ve read through a long explanation of download characters and we haven’t even told you the command syntax yet! Now the wait is over. This is the most complex command in your printer repertoire and now you’ve got the necessary knowledge to implement it. Here it is:
(ESC)“&“CHR$(O) nl n2 m0 ml m.2 m3 m4 m5 m6 m7 m8 m9
ml0 ml1
Like the other printer’s commands, it starts with an (ESC) (CHR$(27)). The next character is an ampersand (&) (CHR$(38)) followed by a CHR$(O).
nl and n2 are used to specify the ASCII values of the characters you are defining. The reason that there are two bytes reserved for this is that your printer allows you to define many characters with just a single command. nl is used to specify the
beginning of a range of characters to be defined; n2 specifies the
end of the range. For instance, if you wanted to change the ap-
pearance of the numerals from 0 to 9 (which have ASCII codes 48 through 57), the command would begin with (ESC) “&” CHR$(O) CHR$(48) CHR$(57) . . . Of course, you can also define
individual characters by making nl and nZ equal.
m0 is called the attribute byte, for it describes two attributes
of the character we have designed: descender data and propor-
tional width information. A byte consists of eight bits. In the at­tribute byte, the first (high order) bit is used for the descender data, and the last seven bits are used for proportional widths. We’ll be discussing proportional character widths in detail later in this chapter; for now, we’ll leave it at 11. The descender data was descussed earlier: to use the top eight pins, this bit should be 1; to use the bottom eight pins this bit should be 0. Figure 6-
10 shows the bits of the attribute byte as we’ll use them for our
flask character. By now you’ve probably seen an easier way to
determine the value of the attribute byte. Instead of translating everything to binary, merely assign the descender data a value of 128 (the value of the first bit) if you don’t want descenders, or 0 if you want descenders. Then just add the descender data to the proportional width. This way, it’s simply a matter of adding two decimal numbers. (In our case, it’s 128 + 11 = 139.)
0 000 1011 = ll(decimal)
Descender Starting Ending
date print column print column
L
Figure 6-10. The attribute byte-(M) for our flask character.
You’ll probably recognize ml . ..mll from the top of our layout grid. That’s right, each column is described by one byte. Now we’ve got everything we need to download one character to the printer. The complete command for our flask character is shown below:
CHR$(27);CHR$(38);CHR$(O);CHR$(GO);CHR$(6O);CHR$(l39)
;CHR$(2);CHR$(5);CHR$(8);CHR$(241);CHR$(O);CHR$(O) ;CHR$(241);CHR$@);CHR$(5);CHR$(2);CHR$(O)
Now let’s send the information to the printer. The following program will send the character definitions for all three characters to the printer. Turn off the printer and set DIP switch 2-l off. Then turn on the printer. Enter the program and run it.
10 LCRINT CHR$(27);"&";CHR$(O);CHR$(60);CHR$(62); 20 FOR N=60 TO 62
30 FOR M=O TO 11
40 READ MM 50 LPRINT CHR$(MM);
60 NEXT M 70 NEXT N 80 LPRINT
90 END 100 DATA 139, 2, 5, 8,241, 0, 0,241, 8, 5,
110 DATA 139,124, 0, 66, 4, 64, 36, 16, 2, 16,
120 "@A 139, 46, 16, 2, 60, 0, 48, 0, 48, 0,
When you run this program, it looks like nothing happens. That’s OK. We’ll see why in just a moment. Save this program. We’ll need it again shortly.
2, 0
12, 0
9 0
PRINTING DOWNLOAD CHARACTERS
You’ve now defined and sent three characters to your printer.
But how do you know that? If you try printing those characters
now you don’t get a flask, car and gun. Instead you get . . ( = ). That’s because the download characters are stored in a different part of the printer’s memory. To tell it to look in download character RAM instead of standard character ROM it requires another command:
(ESC)“%“CHR$(n);CHR$(O)
This command is used to select the download character set (if
n=49) or to select the standard character set (if n =48). Let’s
try it out. Enter this program:
10 LPRINT CHR$(27>;"%1";CHR$(O);
20 LPRINT CHR$(6O>;CHR$(61>;CHR$(62)
30 LPRINT CHR$(27>;"%O";CHR$(O)
40 END
Voila! It should have printed out the three characters we defin-
ed. Your printout should look like this:
(If it doesn’t, check the last program we ran for errors, then
rerun it.)
Let’s find out if there are any other characters in the
download RAM. Try this program:
10 LPRINT CHR$(27);"%1";CHR$(O) 20 FOR I=32 TO 126 2; ;;X";N; U-W(I);
50 LPRINT
60 FOR I=160 TO 254
'7; g;;"; CHR$(I);
90 LPRINT 100 LPRINT CHR$(27);"%O";CHR$(O) 110 END
92
Nope! Just three characters in the download set. This is incon­venient for a couple of reasons. First, every time you wanted to use a download character you would have to switch back and forth between character sets. Knowing that you wouldn’t want to do that, your printer won’t even allow it. So we have made it an easy task to use mostly standard characters with just a few special characters thrown in. This command copies all the ASCII characters from the standard character ROM into download RAM:
(ESC)“:“CHR$(O);CHR$(O);CHR$(O)
Since it will copy all characters into download area, it will wipe out any characters that are already there. So it’s important to send this command to the printer before you send any download characters you want to define. With that in mind, add this line to the program we used to send the characters to your printer:
5 LPRINT CHR$(27);":";
CHR$(O);CHR$(O);CHR$(O)
Now try the download printout test program again. Your
results look like Figure 6-11.
Figure 6- 11. Printout of the dqwnload character set, into which all
the ASCII characters have been copied, and the (, = and > have been
changed.
To demonstrate how to use these characters, let’s use this
character set to print a small graph. This program, which has been built around the first program in this chapter, will do just that:
10 LPRINT CHR$(27);":";
CHR$(O);CHR$(O);CHR$(O);
20 LPRINT CHR$(2~>;"&";CHR$(O);CHR$(6O);CHR$(62);
30 FOR N=60 TO 62
40 FOR M=O TO 11
50 READ MM 60 LPRINT CHR$(MM);
70 NEXT M 80 NEXT N 90 LPRINT 100
DATA
139, 2,
8, 5, 2,
5, 8,241,
0
110 DATA 139,124, 0, 66, 4,
16 12
DA% 139: 46: 160, 2, 60, 0, 48, 0,
120
L%NT"~H~~~27;~"D"-cHR$(ll)CHR$(0)
130
LPRINT CHR$(27)f"h";CHR$(l);'
140 150 LPRINT "
LPRINT cHR$(27>;"h";c~~$(o);
160
LPRINT CHR$(27);"~l";CHR$(O);
170
LPRINT "AUTOS";CHR$(9);
180
U.S. EXPORTS"
0, 0,241,
64, 36, 16,
190 FOR I=.4 TO 9.3 STEP .4
LPRINT CHR$(61);
200
NEXT I
210
LPRINT
220
LPRINT "CHEMICALS";CHR$(g);
230
FOR I=.4 TO 8.7 STEP .4
240
LPRINT cHR$(So);
250
NEXT I
260
LPRINT
270
LPRINT "GUNS";CHR$(g);
280
FOR I=.4 TO 1.4 STEP .4
290
LPRINT CHR$(62).;
300
NEXT I
310
LPRINT
320
LPRINT CHR$(g);"+--";
330
SCALE$=“--+--‘I
340
FOR I=2 TO 8 STEP 2
350
LPRINT SCALE$;
360
NEXT ‘I
370
LPRINT "--+"
380 390 LPRINT CHR$(9);" ";
FOR I=2 TO 8 STEP 2
400 410 LPRINT " ";I;
NEXT I
420
430 LPRINT CHR$(27);"$O";CHR$(O)
LPRINT CHR$(27);"SO";
440. 450 LPRINT CHR$(9);"MILLIONS OF DOLLARS"
LPRINT cH~$(27);"~"
460
END
470
93
Loading...