CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Dot-matrix printer

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Diego Oliveira



Joined: 10 Aug 2008
Posts: 3

View user's profile Send private message

Dot-matrix printer
PostPosted: Sun Aug 10, 2008 10:42 pm     Reply with quote

Would like to use a dot-matrix printer to print some documents using one pic any, somebody has a library of printer control that can be useful? :oops:
arunb



Joined: 08 Sep 2003
Posts: 492
Location: India

View user's profile Send private message Send e-mail

RE:
PostPosted: Mon Aug 11, 2008 4:08 am     Reply with quote

Hi,

Each printer has a different set of commands for operation, you can find the documentation on this in the user manual. Epson dot matrix printers usually have commands that can be used for printing operation.

Having a parallel port interface can make the communication with the PIC easy.

thanks
arunb
Ttelmah
Guest







PostPosted: Mon Aug 11, 2008 5:17 am     Reply with quote

Yes.
'Dot matrix printer', covers a lot of ground.
The cheapest units, may well be the hardest to drive. Some of the very basic printers, have little local 'intelligence', and _everything_, has to be sent as bit patterns. This involves a lot of memory and work, and will almost certainly be beyond a PIC.
The slightly more intelligent units, generally support one of two standard languages, as well as anything 'better'. So, units that are from HP, or can emulate HP printers, normally support 'PCL', and units that are compatible with Epson, support ESC/P. I'd suggest, if you can find a suitable printer supporting this, that this is the easiest way to go. A lot of smaller 'tally roll' printers use this, and it is the simplest way to do anything. Latter printers will generally support more powerful variants (ESC/P 2), but this is reverse compatible to the simpler form.
So, choose a printer that supports this, and first of all, get your basic driver working to send single characters to the printer. Most that are not the dead basic types, will accept simple text, followed by a line feed, and print this. Once you have this working, then consider adding any extra 'frills' you need.
The Centronics interface, is the easiest to drive, and really probably the only one that is likely to be practical. In it's simplest form, you just need to put the 8bits out on a single port, and put a small pulse on the strobe line. You will need to just test the return bits to verify that the printer can take data before doing this.
A lot of the 'fine detail', will depend exactly on your printer, and your intended application. If (for instance), this is a 'tally roll' type printer, being used to send status information, from a 'live' system, then you will be best off implementing a software ring buffer, and having a timer interrupt, occuring just slightly _slower_ than the rate the printer is guaranteed to work. So if (for instance), the manufacturer says the printer can support 25cps, then have an interrupt at perhaps 24 times per second, and have this just send one character. If the buffer overflows, throw the data. Then in your main code, you can keep working without waiting for the printer, and just write the results to the buffer. Obviously, you may want to have an 'alarm' of some sort when data is thrown.
Conversely for a simple 'configuration' type printout, you would just send the data as fast as possible.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group