🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.programmer
Article #1152

Printing USER-DEFINED chars on EPSON LQ: How?

#1152
From: marwk
Date: Wed, 10 Apr 1991 05:49
84 lines
2471 bytes
The following program is designed to create a user-defined character inside
the EPSON LQ-400 24-pin printer and then print the character.

It does not work.

The command summary on page 6-7 of the USER's GUIDE uses

    ESC & 0 n1 n2 d0 d1 d2 data

as the description of the command, where n1 = code for the first character,
n2 = the code for the last character, d0 = left space of character, d1 = body
width of character, d2 = right space of character and data is 3 bytes for
each column.

Could someone please explain what I am doing wrong here and tell me how
to do it properly.

Ray
----

/* PRNCHAR.C */

#include <stdio.h>

#define ESC 0x1B

void define_a_character(char a[24][18])
    {
    int i,j;

    for (i = 0; i < 24; ++i)
    for (j = 0; j < 24; ++j)
        a[i][j] = i == j;
    }

void select_user_defined_set(void)
    {
    fprintf(stdprn, "%c%c%c", ESC, '%', 1);
    }

void print_character(int c)
    {
    fprintf(stdprn, "%c", c);
    }

void send_character_to_printer(char a[24][18])
    {
    int i,bit, col;
    char byte[3];

    fprintf(stdprn, "%c%c%c%c%c%c%c%c",
                    ESC, '&', 1, 128, 128, 2, 18, 2);

    for (col = 0; col < 18; ++col)
        {
        for (i = 0; i < 3; ++i)  /* set up the 3 bytes */
            {
            byte[i] = 0;
            for (bit = 0; bit < 8; ++bit)
                byte[i] &= a[bit][col] << (7 - i);

            fprintf(stdprn, "%c", byte[i]);
            }
        }
    }

void main(void)
    {
    char a[24][18];

    select_user_defined_set();
    define_a_character(a);
    send_character_to_printer(a);

    print_character(128);
    }



--
University of South Australia   | Plus ca change, plus c'est la meme chose.
P.O. Box 1                      | Ghing thien me how, ming thien gung me how.
Ingle Farm                      | Knobs, knobs everywhere,
South Australia                 |              just vary a knob to think!
Technical Details
Message-ID: <16156.28032d0a@levels.sait.edu.au>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!nstn.ns.ca!news.cs.indiana.edu!mips!sdd.hp.com!spool.mu.edu!munnari.oz.au!yoyo.aarnet.edu.au!sirius.ucs.adelaide.edu.au!levels!marwk

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!nstn.ns.ca!news.cs.indiana.edu!mips!sdd.hp.com!spool.mu.edu!munnari.oz.au!yoyo.aarnet.edu.au!sirius.ucs.adelaide.edu.au!levels!marwk
From: marwk@levels.sait.edu.au
Newsgroups: comp.sys.ibm.pc.programmer
Subject: Printing USER-DEFINED chars on EPSON LQ: How?
Message-ID: <16156.28032d0a@levels.sait.edu.au>
Date: 10 Apr 91 05:49:38 GMT
Organization: University of South Australia
Lines: 84