
%BASIC programming
BASIC programming
The LPRINT command in BASIC makes output go to the printer rather than to the screen. To send text to
the printer, simply enclose the words in double quotes:
LPRINT "A line of text"
The statement above will cause the printer to print the text, then move the printing position to the
beginning of the next line. If you don't want this automatic carriage return and line feed, put a semicolon
(;) after the data, outside the quote:
LPRINT "A line of text";
LPRINT "...and this text is on the same line"
For serial printers
If you're using your printer with a serial interface, you have to be sure to redirect output from the
computer to the serial port you're using, either COM1: or COM2:, rather than to the default port, LPT1:.
There are two ways to do this:
1.If you're using DOS, you can use the MODE command, as described on page 65. Then use the
LPRINT command in your BASIC programs, just as we do in our examples.
2.You can also redirect output to COM1: or COM2: from within BASIC, by opening the port as a file and
printing your data to that file. If you want to run any of our sample programs, you'll need to modify them.
At the beginning of your program, include one of these statements:
OPEN "COM1:9600,N,8,1" AS #1
or
OPEN "COM2:9600,N,8,1" AS #1
Then, to print data, use the PRINT#1 command, being sure to include a comma between the #1 and the
data:
PRINT#1,"A line of text"
Like the LPRINT command, PRINT#1 automatically moves the print position to the next line unless you
use a semicolon (;) after the data.
When you send an LPRINT statement, the text between the quotation marks is converted to a string of
numbers, which are then processed by the printer and output as the dot patterns that make up the
individual characters. Each character is assigned a numeric value according to the American Standard
Code for Information Interchange (ASCII). Since ASCII is a standard coding system, most computers,
printers and other electronic devices can interpret ASCII data.
There are 256 ASCII codes. The codes from 0 to 127 are completely standardized (with a handful of
minor exceptions), while those from 128 to 255 are used in a less standard way to represent a variety of
special characters. The table of ASCII codes in Appendix C shows the low ASCII codes from 0 to 127.
Although most of the ASCII codes represent alphanumeric and punctuation symbols, you'll notice that the
codes from 0 to 31, as well as 127, don't correspond to normal characters. These are control codes,
special characters used to control a wide range of peripheral equipment, from monitors to modems to the
devices that interest us here, printers.
One of the most important control codes is the ESC character, decimal 27, hexadecimal 1B. Many of the
more complicated commands begin with ESC, which serves as a signal to the printer that what follows is
to be interpreted as a command rather than just a string of characters to be printed.
ML 380 ( 96-02-03 )
Содержание ML380
Страница 1: ...Chapter 0 Front Cover Microline 380 Printer Handbook ML 380 96 02 03...
Страница 25: ...ML 380 96 02 03...
Страница 59: ...Character Width Values Character Width Values ML 380 96 02 03...
Страница 76: ...ML 380 96 02 03...
Страница 103: ...79 121 y 36 7A 122 z 30 7B 123 m 24 7C 124 0 18 7D 125 24 7E 126 30 7F 127 DEL ML 380 96 02 03...
Страница 105: ...ML 380 96 02 03...
Страница 106: ...Superscript Subscript Characters Superscript Subscript Characters ML 380 96 02 03...
Страница 107: ...ML 380 96 02 03...
Страница 132: ...Specifications subject to change without notice ML 380 96 02 03...