th3gr8
Member level 4
- Joined
- Aug 27, 2013
- Messages
- 68
- Helped
- 6
- Reputation
- 12
- Reaction score
- 6
- Trophy points
- 8
- Activity points
- 398
I think your printer interface is mentioned in the link you provided in product details in last post.Just see the line at Interface in the product details document.So i think It support RS232 with 19k2 baud rate.You need use max232 with your controller to interface with printer using serial (high level) RS 232.
print("This is a line\r\n");
Just send ASCII text lines terminated with <CR><LF>.
Code:print("This is a line\r\n");
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.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.
#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);
}
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
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?
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 ?
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.
Good. So you know how you have to arrange the pins of your µC RS232 interface - the same way as in the PC.I also checked the thermal printer by connecting it with COM1 port of my PC and tried to print some text .. It worked fine.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?