4
« on: January 16, 2019, 01:37:35 pm »
Hello specialists,
I'm just a beginner since 40 years...
With Windows XP (32 bit) using QBASIC and my Epson LQ300 dot matrix printer connected to LPT1: I wrote the printer routine the following way
OPEN "LPT1:" FOR OUTPUT AS #1: WIDTH #1, 150
GOSUB ELITE ' this subroutine will send some ESC sequences to the EPSON LQ300 in order to switch it to the ELITE character set
' now put some text to the text variable P$
P$ = "This is just some text that you want the EPSON LQ300 to print out." : GOSUB PRINTER
P$ = "And this is a scond line you want to be printed." : GOSUB PRINTER
GOSUB FORMFEED
CLOSE
END
PRINTER: P$ = " " + P$: PRINT #1, P$: RETURN ' the printed text is moved to the right a bit, then printed in one line
ELITE:
P$ = CHR$(&H1B) + CHR$(&H40) + CHR$(&H1B) + CHR$(&H78) + CHR$(&H1) + CHR$(&H1B) + CHR$(&H6B) + CHR$(&H1) + CHR$(&H1B) + CHR$(&H4D)
GOSUB PRINTER: P$ = ""
RETURN
FORMFEED: ' the paper comes out of the printer
P$ = CHR$(&HC) : GOSUB PRINTER: P$ = "" : RETURN
Now, with QB64 and today's computers without centronics serial interface LPT1, but the EPSON LQ300 connected via USB001, I was able to get something printed by use of the command LPRINT as follows:
LPRINT "The quick brown fox jumped over the lazy dog"
(Thank you for making this work, indeed!)
But... up to now I did not find out how to send ESC sequences to the printer in order to change the font.
OPEN "USB001" FOR OUTPUT AS #1 did not work, sorry. Instead it produced an error "illegal function call"
P$ = CHR$(&H1B) ......... LPRINT P$ did not work, either, sorry. Instead it printed some arrows and playing card symbols.
Please indulge me in being without any deeper knowledge,
Georg