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 support@ccsinfo.com

Printing to rs232 printer

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



Joined: 09 Aug 2004
Posts: 2

View user's profile Send private message

Printing to rs232 printer
PostPosted: Mon Aug 09, 2004 12:51 pm     Reply with quote

Hi,

I don't have much experience with printers so I apologize if this question seems somewhat open-ended or trivial.

I have a device (uses 16F877) that I would like a user to be able to attach an rs232 printer to and have it print out some log data. This data is very simple and only needs to contain plain ascii text (no graphics etc.).

Is there a protocol that most printers support at a very basic level for just printing some text? I've read about the ESC protocol and wonder if maybe this is what I should be using?

Does anybody have an example that just prints out a line of plain ascii text to a printer, or even a file that I can write out to the printer to display a line?

Any help would be great.

Thanks,
Mike
Ttelmah
Guest







Re: Printing to rs232 printer
PostPosted: Mon Aug 09, 2004 1:00 pm     Reply with quote

mbailey wrote:
Hi,

I don't have much experience with printers so I apologize if this question seems somewhat open-ended or trivial.

I have a device (uses 16F877) that I would like a user to be able to attach an rs232 printer to and have it print out some log data. This data is very simple and only needs to contain plain ascii text (no graphics etc.).

Is there a protocol that most printers support at a very basic level for just printing some text? I've read about the ESC protocol and wonder if maybe this is what I should be using?

Does anybody have an example that just prints out a line of plain ascii text to a printer, or even a file that I can write out to the printer to display a line?

Any help would be great.

Thanks,
Mike

Most RS232 printers, will print plain text 'as is'. So the old traditional 'Hello world' application will drive them. However in some cases there will need to be small 'extras'. For instance, on Laser printers, in general, nothing prints, until a 'form feed' character is sent, or an entire page is filled. The only place for data on this, is the manufacturer of your particular printer. There is no 'standard'. Some manufacturers have their own standards, but most of these apply to extensions beyond 'plain text' printing. Epson has their ESC/P2 language, and HP has HPGL. The name of the latter though shows why these should not be needed. The letters stand for 'Hewlett Packard _Graphics_ Language'. The key here is that it is only needed when sending graphics.
Try sending plain text, with a carriage return, and a line feed. If the printer is at all 'normal', it'll print.

Best Wishes
mbailey



Joined: 09 Aug 2004
Posts: 2

View user's profile Send private message

PostPosted: Mon Aug 09, 2004 5:49 pm     Reply with quote

Thanks for the help... this is what I was hoping for. The only printer I currently have does not run at the baud rate that I need so I will not be able to test it until I pick up a new printer.

I appreciate the help.

thanks again,
Mike
Ttelmah
Guest







PostPosted: Tue Aug 10, 2004 5:08 am     Reply with quote

mbailey wrote:
Thanks for the help... this is what I was hoping for. The only printer I currently have does not run at the baud rate that I need so I will not be able to test it until I pick up a new printer.

I appreciate the help.

thanks again,
Mike

Remember that you can test this, by attaching the printer to a PC serial port, going to a command prompt, setting up the baud rate etc., and then typing:
copy con: com1:
Hello world
<CTRL>Z

The first line says to copy what you type to the com1 port (change to suit which port you are trying it on), then you type some text (the 'Hello world'), and then an 'EOF' (<CTRL>Z).
The text is then sent directly out the com port, allowing you to see what happens. :-)

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