🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.ibm.pc.programmer
1 messages
1 total messages Started by marwk Mon, 20 May 1991 07:53
Please, how do I print user-def chr on EPSON LQ 24-pin?
#1201
Author: marwk
Date: Mon, 20 May 1991 07:53
102 lines
3164 bytes
I have reached the length of my tether in solving the problem of
printing a user-defined character on an EPSON LQ 24-pin printer using
TURBO C 2.01.

The program listing is provided below.
The main program prints the first message and the second message but
not the user-defined character.

Please tell me what I am doing wrong and how to correct it.

Thank you
Ray Kennington
------------------------------

/* PRNCHAR.C */

#include <stdio.h>

#define ESC 0x1B

void set_letter_quality(void)
        {
        fprintf(stdprn, "%c%c%c", ESC, 0x78, 1);
        }

void set_ten_characters_per_inch(void)
        {
        fprintf(stdprn, "%c%c", ESC, 0x50, 1);
        }

void copy_font_from_rom_to_ram(void)
        {
        fprintf(stdprn, "%c%c%c%c%c", ESC, 0x3A, 0, 0, 0);
        }


void define_a_character(char a[24][18])
        {
        register 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, 0x25, 1);
        }

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

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

        fprintf(stdprn, "%c%c%c%c%c%c%c%c",
                                        ESC, 0x26, 0, 0x21, 0x21, 0, 18, 0);

        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];

        fprintf(stdprn, "About to print user-defined character\n");

        set_letter_quality();
        set_ten_characters_per_inch();
        copy_font_from_rom_to_ram();

        define_a_character(a);

        send_character_to_printer(a);
        select_user_defined_set();

        print_character(0x21);
        fprintf(stdprn, "\nHaving printed user-defined character\n");
        }


--
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!
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads