From: "Rego, P." <pvrego@gmail.com>
Subject: Re: AVR Usart send number string with no 'Image
Date: Thu, 25 Apr 2013 03:55:38 -0700 (PDT)
Date: 2013-04-25T03:55:38-07:00 [thread overview]
Message-ID: <508e7264-46c3-4c53-94e6-6bb427fb3908@googlegroups.com> (raw)
In-Reply-To: <b89fecbc-7236-4535-8371-a38590cc5994@googlegroups.com>
On Wednesday, April 24, 2013 11:03:25 PM UTC-3, Shark8 wrote:
> declare
> Subtype Digit is Character Range '0'..'9';
> Function To_String( Input : Interfaces.Unsigned_8 ) Return String is
> Subtype Digital is Interfaces.Unsigned_8 Range 0..9;
> begin
> if Input in Digital then
> Return (1 => Digit'Val( Natural(Input) + Character'Pos('0') ));
> else
> declare
> Use Type Interfaces.Unsigned_8;
> D2 : Constant Interfaces.Unsigned_8:= Input / 10;
> D1 : Constant Interfaces.Unsigned_8:= Input mod 10;
> begin
> Return To_String(D2) & To_String(D1);
> end;
> end if;
> end To_String;
> Subtype Byte_Range is Integer range 0..255;
> X : Integer := 4;
> begin
> While X in byte_range loop
> Ada.Text_IO.Put_Line( To_String( Interfaces.Unsigned_8(X) ) );
> X:= X*2;
> end loop;
> end;
Thanks Shark8, much interesting your solution.
next prev parent reply other threads:[~2013-04-25 10:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-25 1:27 AVR Usart send number string with no 'Image Rego, P.
2013-04-25 2:03 ` Shark8
2013-04-25 10:55 ` Rego, P. [this message]
2013-04-26 2:28 ` Rego, P.
2013-04-26 5:50 ` Simon Wright
2013-04-30 2:58 ` Rego, P.
2013-04-26 14:52 ` Shark8
2013-04-26 21:10 ` Shark8
2013-04-30 3:00 ` Rego, P.
2013-04-25 4:54 ` rrr.eee.27
2013-04-25 10:58 ` Rego, P.
2013-05-01 20:35 ` Rego, P.
2013-05-01 21:00 ` Simon Wright
2013-05-01 22:07 ` Rego, P.
2013-05-01 22:30 ` Jeffrey Carter
2013-05-01 22:46 ` Rego, P.
2013-05-01 23:29 ` Dennis Lee Bieber
2013-05-01 22:32 ` Shark8
2013-05-01 23:00 ` Rego, P.
2013-05-01 23:09 ` Shark8
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox