[DUG] HEX to decimal

Todd Martin todd.martin.nz at gmail.com
Thu Aug 4 18:05:27 NZST 2011


edit2.text := IntToStr(StrToInt('$' + sRaw));

On Thu, Aug 4, 2011 at 5:50 PM, Marshland Engineering <
marshland at marshland.co.nz> wrote:

> **
> I cannot get the decimal equivalent of the number sent from my micro in
> Delphi !!!
>
> I am running and ATmega (micro) and it sends out a hex number corresponding
> to an A to D conversion. It is 8 bit.
>
> I'm using SerialNG to read the data with
>
> procedure TfDyno.SerialPortNGRxClusterEvent(Sender: TObject);
> Var
>     sRaw:String;
> begin
>     if SerialPortNG.NextClusterSize >= 0 then begin
>        sRaw:=SerialPortNG.ReadNextClusterAsString;
>        edit2.text:=sRaw;
>     end;
> end;
>
> In the text box I get the ASCII character displayed eg [  {  9   *   {
> }  % etc.
>
> How do I get the Decimal equivalent to display. Should be in the range
> 0-65534.
>
> I've spent many hours trying so far !!!
>
>
> Cheers Wallace
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
> unsubscribe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20110804/3dd1cfac/attachment-0001.html 


More information about the Delphi mailing list