From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,87b54dbabc658fa2 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.224.215.194 with SMTP id hf2mr26741751qab.0.1366887338403; Thu, 25 Apr 2013 03:55:38 -0700 (PDT) X-Received: by 10.49.129.233 with SMTP id nz9mr537696qeb.10.1366887338387; Thu, 25 Apr 2013 03:55:38 -0700 (PDT) Path: ef9ni16888qab.0!nntp.google.com!gp5no6739897qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 25 Apr 2013 03:55:38 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=189.110.10.185; posting-account=TRgI1QoAAABSsYi-ox3Pi6N-JEKKU0cu NNTP-Posting-Host: 189.110.10.185 References: <931385b2-3520-4d7a-b56f-6d0d0b06d467@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <508e7264-46c3-4c53-94e6-6bb427fb3908@googlegroups.com> Subject: Re: AVR Usart send number string with no 'Image From: "Rego, P." Injection-Date: Thu, 25 Apr 2013 10:55:38 +0000 Content-Type: text/plain; charset=ISO-8859-1 Date: 2013-04-25T03:55:38-07:00 List-Id: 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.