• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 
April 20, 2024, 02:57:21 am

News:

SMF - Just Installed!


Sending Hex Data

Started by ata90, February 17, 2011, 08:55:46 pm

Previous topic - Next topic

ata90


     Dear Roman

How can I send hex data to serial port? for example sending '0A 12 FE 20'

Thank you
Ata

Roman Novgorodov

Hello

You can try something like this:

nrComm1.SendString(#$0A#$12#$FE#$20);

If you have a byte arraywith needed data you can use its pointer in SendData method.

Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

ata90


     Dear Roman

Many Thanks for your reply.
About the SendData(Buf:PChar;N:integer) procedure which u mentioned in your comment, what's N parameter and can you please make an example of this procedure about sending byte array of hex data to serial port?


Roman Novgorodov

Hello

Something like this:


Const
  sizeData = 4;
var
  myData:array[0.. sizeData-1] of byte = ($0A,$12,$FE,$20);
begin
    nrComm1.SendData(@myData[0], sizeData);
end;


Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.