#Printer Control Codes
11 messages in this thread
I recently purchased a panasonic KX-P1124 printer and I would like to be
able to set the printer features from software, specifically a Basic
program. Merely sending the documented control code doesn 'work owing to
their interception by the printer driver program. I have been able to set
the printer features from the command line using the printer escape
sequences listed in appendix D of the Amiga manual, however these sequences
don't take into account some of the features of the printer, eg. the extra
fonts. So my question is how do I encode these sequences in a Basic
program?
For example the escape sequence for the NLQ mode is ESC[2"z. How do I
translate this? Does the 2 refer to the numeric value for 2, the ascii
code for 2 or the Chr$(2)? In the escape sequence, are the quotes being
sent as a quote character or are they there to modify z? If they are being
sent as a character how do I encode them in a Basic print statement? As """
for example? Also since there are no sequences to take into accout the
extra fonts, how would I figure out what they are? Can I use a different
driver program so I can enter the escape sequences in the more conventional
manner, eg. Chr$(27);"k";chr$(2)?
Thanks for any help.
Lee,
It is possible to bypass the printer driver by opening the printer as an
independent device instead of using the built-in's. Assuming that your
printer is attached to the parallel port, you would open the device "PAR:"
instead of "PRT:". This is covered a little bit in the "Generalized Device
I/O" section of the AmigaBasic manual. (Chapter 5 in my book, pp 5-3 to
5-4.)
You need to specify special characters such as the double-quote in their
CHR$(x) equivalents. From memory, I believe that the doublequote is
CHR$(34), but you can check it.
You're running into the same trouble that printer-driver makers have with
regard to whether the 2 in the manual is an ASCII 2 or CHR$(2). I've worked
with printers where it was both in different commands. Usually, though,
they are ASCII. The only way to find out for certain is to experiment.
Your example string of ESC[2"z would most likely be coded as
CHR$(27);"[2";CHR$(34);"z";
Using a Preferences driver is really the preferred way to use a printer on
the Amiga. Have you checked the Printer Utilities DL (8) in the AmigaUser
Forum for a driver specifically for your KX-P1124? It might pay off.
There also used to be a printer driver generator program for 1.2 printer
drivers, but I don't know whether it was ever updated for 1.3 or not.
Hope this helps. 8)
David
Thanks for your tip on using the PAR: device. This worked fine and I never
would have thought of it. Thanks again.
Lee,
You're quite welcome. 8)
Did you ever get the chance to look at the SELECT.LZH program? If all you
want to do is to have an easy way to change fonts on your KX-P1124, it
should fit the bill nicely. It also is an easy way to get the escape
strings, since they're right at the beginning of the C source file.
David
No I haven't downloaded that file but I probably will eventually. I have
another question for you though. I would like to be able to make some
interesting sounds using Basic and the Wave statement. I have tried to
manipulate the Wave parameters various ways but all I get is a different
kind of beep. I am not looking for sampled sounds or anything but I figure
if they put the statement in the language it must be capable of being used
somehow to advantage. Do you know anything about it?
Thanks for any help.
Lee,
If you want something other than a sine wave, you have to load the sample
data into an array. The array must be an integer array having at least 256
elements. Each data element must be in the range of -128 to +127. Check
out the WAVE section in the AmigaBasic manual. The only things missing from
the example given are the corresponding DATA statements with the values for
loading into the array. It's probably easier to get the data with an audio
sampler than to try to guess at it, although one could try various
mathematical functions and see what comes out.
Hope this helps. 8)
David
I have been using the wave statement and various sized arrays with both
random and patterned values but as I say, all I get is a beep. I have seen
advertisements for audio sampling software and I even have a program that I
got on an Amiga Resource disk that allows you to edit and manipulate
sampled sounds. What hardware do I need to do this. I assume the hardware
does not come with software as it's never advertised. Even if I sample it
how do I read it into an array? I would have to know the file structure.
Is there a standard structure for this? Thanks for any help.
Lee,
I checked AmigaUser DL 8 for you and found a program called SELECT.LZH that
does specifically what you want to do – change fonts on the KX-P1124
printer. It's written in "C" and source code is provided.
The printer drivers are in AmigaUser DL 10, but I couldn't find one
specifically for the KX-P1124.
David
Thanks for you help! As soon as I am able to I will check out your advice
and get back with a reply as to how it worked. I did check the printer
drivers on GENIE but not here. Why? Because it's cheaper. Also if there
was a library directory command on Compuserve that would give you a one
line description of the files along with their names it would be very
helpfull. It's pretty difficult to decipher the contents of a file from
the abbreviated file names and at $12 an hour it's too expensive to browse
very long … in which case you did me a real favor. I hope you are a
Sysop! Thanks again.
Lee,
At any library prompt, you can type SCA SHO and get a one-line description
of each file. If you want the files in alphabetical order, type SCA SHO
*.*
Betty