[PIC] Parallel Printer interfacing !!

Status
Not open for further replies.

th3gr8

Member level 4
Joined
Aug 27, 2013
Messages
68
Helped
6
Reputation
12
Reaction score
6
Trophy points
8
Visit site
Activity points
398
Hello All ..
I want to interface a parallel printer with my PIC16F877A (serial printers are not available) .. I googled and found out that i need to connect D0-D7 with any output port of the PIC and need to connect strobe and busy Pin .. Now i am confused about making its code and circuit. I want to know that by directly connecting these pins with my printer, will i be able to print something or do i need any circuit in between them?
and If someone has an example Code and circuit, plz share it.
I am using PIC-CCS Compiler ..
 

hi,
I don't use C programming, but PORTD and E2,1,0 of the 16F877A are designed to operate with external peripherals , ie: printer etc.

Look up your printer Character and Control codes.

E
 

hi,
I don't use C programming, but PORTD and E2,1,0 of the 16F877A are designed to operate with external peripherals , ie: printer etc.

Look up your printer Character and Control codes.

E

Thankyou for you reply .. Do you mean that i need to use PSP module?? And i dont have any information regarding printer codes etc .. And i read somewhere that PSP is not capable of PIC to Printer communication since it is a slave port and something like that ..
Also, can i use usb-to-serial converter for a printer with USB port??
 

Also, can i use usb-to-serial converter for a printer with USB port??

Hi,
If you can write the CCS program to drive the Serial input of the Serial to USB converter, its possible to drive a USB printer.

I would suggest a Google for CCS Serial/USB printer routines.
 

Also, can i use usb-to-serial converter for a printer with USB port??
No.

An USB printer must be controlled by an USB host or OTG device. An USB-to-serial bridge is a device rather than a host and can't be used for this task. You can either use FTDI Vinculum chip or a microcontroller with host/OTG functionality, e.g. PIC24xxGB.
 

hello,

I want to know that by directly connecting these pins with my printer, will i be able to print something

Yes, if your PIC is powered with 5V DC, you have TTL level compatible signals to directly drive a parallele printer.
Maybe just to add pull up resistor 4,7K on output because internal pull up to high value.

What kind of printer ..?
What kind of protocole ?
example: for EPSON printer ESC protocole
or CITIZEN 24
or ...
this one is easy to interface..

HP printer is a bit more complicated..
 



You mean i need to add 4.7K at Data Pins??
Do HP have different/complicated protocol for parallel port??
I want to use Thermal Printer..
 

I don't see a need for pull-up resistors if the outputs are configured push-pull as usual for parallel printer interface.

You don't need a specfic protocol to print simple text. Epson ESC C or HP PCL protocols are used to change fonts or print graphics. You should refer to the manual of your printer which extended functions are available beyond generic text printing.
 


I just want to print some text, No graphics .. Will simple and uni-directional parallel protocol be efficient enough??
 

Yes, just connecting data lines, /STB, BUSY.


Luckily i've got a Serial thermal printer now .. Please tell me the crystal value's issue .. and also tell me that what Pins i need other than TX and RX .. I think that RTS and CTS pins will also play an important role or can i simply ignore them and use only TX and RX??
Plz guide me
 

Crystal frequencies and baudrate dividers, see PIC datasheet.

You minimally nead a handshake means for the printer to pause output from µC. This can be either RTS pin or XON/XOFF software handshake, if supported by your printer. RTS is probably the simplest way.
 


will 4Mhz and 9600 baudrate be enough?
And if i make a sequence, like:
1) Send an RTS signal
2) wait for CTS to go high or low
3) put a byte of data on TX
4) loop back
is my sequence right?
 

9600 baud sounds good. The sequence can be simplified to
Code:
while (CTS==1) send_data();
 

9600 baud sounds good. The sequence can be simplified to
Code:
while (CTS==1) send_data();

Ok .. So finally, i need to use atleast 3 I/O lines, with no resistor on any line, to simply print text on the paper .. Right??
 

You didn't tell if the printer has TTL or RS232 level interface. In the latter case level converters would be needed.

Actually RxD won't be needed for generic text printing with CTS control, only two lines.
 

You didn't tell if the printer has TTL or RS232 level interface. In the latter case level converters would be needed.

Actually RxD won't be needed for generic text printing with CTS control, only two lines.

The printer has serial interface .. What interfaces are needed ??
 

There are different flavours of serial interface, logic level(TTL) and high level(RS232). RS232 is inverted compared to TTL.

Check the documentation.
 


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.
 

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