[PIC] Parallel Printer interfacing !!

Status
Not open for further replies.

and what about programming protocol??
i mean from where i know about commands for printing text using this printer??
 

Just send ASCII text lines terminated with <CR><LF>.

Code:
print("This is a line\r\n");

Ok .. but using only PRINTF command will print the text??
Sorry for asking but i read somewhere that i would need EPSON ESC/POS PROGRAMMING PROTOCOL for printing text ..
 

The discussion seems to go round in circles, the point has been already addressed.

In any case you should review the printer manual to understand which print format is used for generic text output and decide if it's appropriate.
 

Seial 19200,None,8,1,TCP/I

Seial => serial
:???:Chinese and japanese people have some problems with letter r

Does it means through TCP/I ?

We can see a DB9 female on rear of printer, so normal RS232 ?

but, if this printer is configured by default, as chinese caracteres !
you will have to study the protocol of this printer...

:winkr learn Chinese..

just TEST and See !
 

We can see a DB9 female on rear of printer, so normal RS232 ?
Yes, obviously RS232. I didn't notice the dealer's internet page. So you'll need MAX232 or similar as level converter between PIC and printer.

You still need to read the manual, there will be most likely configuration switches inside the printer, to set the baudrate and possibly other parameters like default font. In case of doubt ask the dealer to mail you a copy in advance.
 


My bad, the dealer here don't have any user manual other than installation guide .. I will try to implement the general EPSON ESC/POS protocol .. If i face any problem, i'll ask ..
 

Hey there .. A problem occured ...
I've written the following program to interface my thermal printer .. But nothing happens , my printer doesn't even respond to it, i mean it doesn't give any output .. Plz help ..
Code:
#include <16F877A.h>
#fuses xt, nowdt, nolvp, brownout
#use delay (clock = 4Mhz)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

void main()
{
int8 i;
char msg[] = {"Hello World"};
//initialize printer
putc(27);
putc(64);

//selecting justification, center justified
putc(27);
putc(97);
putc(1);

//selecting character font A
putc(27);
putc(33);
putc(0);

//printing
putc(27);
putc(100);
putc(1);
putc(10);
printf("Hello World2");
putc(13);
for(i=0;i<11;i++)
{
putc(msg[i]);
}
putc(13);


//selecting cut mode
putc(29);
putc(86);
putc(66);
putc(0);

//Generating pulse
putc(27);
putc(112);
putc(60);
putc(50);
putc(50);
}
I followed the sample program of the below PDF (at page # 15) ..
**broken link removed**
 

hello,


Are you sure your printer follow EPSON protocol ?
it could be XON XOFF protocol or ENQ ,ACK or other ...
so need an handshake to establish the communication link ..

try also CR LF or LF CR as string terminator
 

hello,


Are you sure your printer follow EPSON protocol ?
it could be XON XOFF protocol or ENQ ,ACK or other ...
so need an handshake to establish the communication link ..

try also CR LF or LF CR as string terminator

Thankyou for replying ..
How do i check that exactly which protocol my printer is following? I dont have any hint in user's manual provided to me from seller .. I got the idea of EPSON on this post and other webs ..
I am using an standard MAX232 circuit used for PIC;s interfacing with serial port, do i need to follow the connections as described on Page16 of ESPON's PDF ?? my max232's circuit is similar to the below schematic.
 

I see the problem that you didn't even understand the basic idea of ESC P protocol.

It's a control protocol on top of generic text printing, the printer will always accept simple text lines terminated with <CR><LF>.

More likely you are using a wrong baud rate or have problems in hardware cabling. What does the installation manual tell about baud rate?
 


Do you mean that i just need Printf(), putc(10) and putc(13)?
Baudrates are same for both devices i.e. 9600..
but i noticed a thing on my printer's serial port that i has pin1 on left side whereas pin1 of my max232 's circuit's db9 jack is on right side .. is this the problem? Both devices has DB9's female jack ..
Sorry for asking stupid questions ..
 

hello,

maybe hardware problem..
capacitor C6 pin 2 Max232 seems not correct wired because linked to Gnd et revers polarized !
V+ pin 2 + 10V output (+) ----)[-------(-) ----+5V

Can you try your printer directly connected to a PC terminal ?
 

hello,

maybe hardware problem..
capacitor C6 pin 2 Max232 seems not correct wired because linked to Gnd et revers polarized !
V+ pin 2 + 10V output (+) ----)[-------(-) ----+5V

Can you try your printer directly connected to a PC terminal ?

Thankyou for replying .. My max232 circuit is fine, i've checked it by interfacing it with PIC and also received data on hyper-terminal. Right now, my confusion are these orientation of db9's females .. Both thermal printer and my max232 circuit has females and both are horizontally flipped with each other .. Is this the problem due to which commands are not able to be received by printer ???
 

There are no sub-d connectors with flipped terminals. Possibly jacks with wrong number printing. I already experienced this some time ago.

Please consider that a printer is connected by plugging in a standard cable, either straight or cross-link The cable doesn't read numbers, just mates the connector.

There are however different RxD/TxD pin assignments for DCE and DTE, I would always check which pins are actually TxD with a multimeter if the handbook isn't totally clear about required connection.
 


I noticed that my max232's db9 female has "L1" written on it, whereas thermal printer's db9 female socket has "M" written on it, is this the cause of different pin numbers??
And how do i check TX and RX pins via multimeter as the manual says that "THE WIRING METHOD OF THE SERIAL INTERFACE PRINTER FOLLOWING THE STANDARD RULES OF SERIAL INTERFACE EIA STANDARD"? I also checked the thermal printer by connecting it with COM1 port of my PC and tried to print some text .. It worked fine .. I connected it with the standard serial cable as shown in picture.
 

I also checked the thermal printer by connecting it with COM1 port of my PC and tried to print some text .. It worked fine.
Good. So you know how you have to arrange the pins of your µC RS232 interface - the same way as in the PC.
 

Finally !! .. I have successfully interfaced the thermal printer with my PIC16F877A over the RS232 interface ..
Thankyou all who replied to the thread, tried to help me and sorry for asking stupid questions again and again ..

Regards,
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…