Epson LQ-1000 User Manual - Page 62

Sending Control Codes to the Printer, LPRINT BASIC programs for the, LPRINT CHR$76CHR$81CHR$45

Page 62 highlights

Sending Control Codes to the Printer The short program that follows illustrates the concepts of control codes and ESCape sequences. This exercise may help you make better use of this chapter and the next. Type and run the program. It should produce the printout you see below it. After the printout you'll find a detailed description of the operation of the program. 10 LPRINT "BASIC programs for the" 20 LPRINT CHR$(76)CHR$(81)CHR$(45); 25 LPRINT CHR$(56)CHR$(48)CHR$(48); 30 LPRINT " and LQ-1000" 40 LPRINT "W1 "CHR$(87)CHR$(49) 50 LPRINT CHR$(27)"W1";"Double-width print" 60 LPRINT "Still double-width" Basic programs for the LQ-800 and LQ-1000 W1 W1 Double-width p r i n t S t i l l double-width In each line LPRINT signals that the rest of the information on the line is to be sent to the printer. In lines 10 and 30 the letters inside the quotation marks are printed just as they appear in the program. Lines 20-25 show an alternate way of printing characters. They use the CHR$ (character string) function with the decimal code for each letter to print "LQ-800." Line 40 prints the characters W1 using the two different methods (quotation marks and the character string function). Line 50 shows that if the ESCape code, which is CHR$(27) in BASIC, comes before the characters W1, those characters are not printed. Instead, they become part of the ESCape sequence that turns on double-width printing, which is demonstrated with the letters in quotation marks after the ESCape sequence. Line 60 shows that the double-width mode stays on for more than one line. This program is only an introduction. The demonstration programs that follow allow you to see many more of the features of your LQ in action. 5-4

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185

Sending Control Codes to the Printer
The short program that follows illustrates the concepts of control
codes and ESCape sequences. This exercise may help you make better
use of this chapter and the next. Type and run the program. It should
produce the printout you see below it. After the printout you’ll find a
detailed description of the operation of the program.
10 LPRINT "BASIC programs for the"
20 LPRINT CHR$(76)CHR$(81)CHR$(45);
25 LPRINT CHR$(56)CHR$(48)CHR$(48);
30
LPRINT
" and LQ-1000"
40
LPRINT "W1 "CHR$(87)CHR$(49)
50 LPRINT CHR$(27)"W1";"Double-width print"
60 LPRINT "Still double-width"
Basic programs for the
LQ-800 and LQ-1000
W1 W1
Double-width
p
r
i
n
t
S
t
i
l
l
double-width
In each line LPRINT signals that the rest of the information on the
line is to be sent to the printer. In lines 10 and 30 the letters inside the
quotation marks are printed just as they appear in the program.
Lines 20-25 show an alternate way of printing characters. They
use the CHR$ (character string) function with the decimal code for
each letter to print “LQ-800.”
Line 40 prints the characters W1 using the two different methods
(quotation marks and the character string function). Line 50 shows
that if the ESCape code, which is CHR$(27) in BASIC, comes before
the characters W1, those characters are not printed. Instead, they
become part of the ESCape sequence that turns on double-width
printing, which is demonstrated with the letters in quotation marks
after the ESCape sequence. Line 60 shows that the double-width mode
stays on for more than one line.
This program is only an introduction. The demonstration pro-
grams that follow allow you to see many more of the features of your
LQ in action.
5-4