Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send Bmp over serial port

Status
Not open for further replies.

earlrainer

Programmer
Mar 1, 2002
170
IN
Hi,
can anyone tell me how can i send a bmp over the serial port.
I have a printer connected to com2.
I also have the option to use a third party component for
the com port.
but i dont know how i can send the entire bmp over the port.
i know how how to send a string though.

any help will be deeply appreciated
 
The 3rd party comport driver I use can send strings but its default mode is to send the contents of a buffer (an array of byte).
If your componet cannot do this Look for CPort, Cport Library or ComPort Library on the web.
It is usually a matter of filling the buffer with the data and control bytes you want to send. and passing it as a parameter to the CPort driver write function along with the buffer size.

hope this help Steve

 
thanks Sggaunt,

it would be very nice if you could give me an example code.

thanks once again
 
Hi Earlrainer
As far as code to use a comport driver component goes you shouldnt find any problems.
This example send a simple 4 byte serial protocol message to whatever comm port is selected by the driver component.

procedure send(Addr, Qty, TrToken: integer);
var txbuff: array [1..4] of byte;
begin
// set up an array
Txbuff[1] := $3A;
Txbuff[2] := TrToken or Addr;
TxBuff[3] := Qty;
CheckSum := $3A xor (TrToken or Addr) xor Qty;
TxBuff[4] := Checksum;
// send it using the drivers write to port method
comport.Write(TxBuff, 4);
end;

You will find examples with most components of this sort.

What you want to do will involve knowing the formatting and control characters required to drive your specific printer.
If and how you need to split up the image data you are sending, and what to expect back from the printer in response to your data (if anything). I have never done any direct printer driving myself so I cant help you with any examples.
You can probobly get some help from Delphi Books, or maybe someone else on the forum has experience of this sort of thing.

Steve.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top