Menu

#30 strings_edit of signed numbers does not work  Edit

v1.3.0
closed
None
9
2014-11-25
2013-07-15
Anonymous
No

Hi,
I've just installed Avr-Ada 1.2.2, I've then tried out the example
Int_Out.adb.

As provided it does work for the Unsigned Integer, but attempting to
extend it to output Signed Integer I cannot make it work. The following code
compiles and uploads and runs, but no Signed Integer output occurs.

with Interfaces; use Interfaces;
with AVR; use AVR;
with AVR.Serial; use AVR.Serial;
with AVR.Strings; use AVR.Strings;
with AVR.Strings.Edit.Generic_Integers;
with AVR.Int_Img;
with AVR.Strings.Edit.Integers;

procedure Int_Out is

Sample1 : Unsigned_32 := 16#DEAD_BEEF#;
Sample2 : Unsigned_32 := 123;
Sample3 : Integer_16 :=-1;
Sample4 : Integer_16 := 16;

Str : AStr11;

Len : Unsigned_8;
Lstr : AStr3;

begin
Serial.Init (Serial.Baud_9600_8MHz);
Serial.Put_Line ("check asm output of integers");
Serial.New_Line;

Str := (others => '@');

Edit.Generic_Integers.Put_U32 (Sample1, 16, Str, Len);
Serial.Put_Line (Str);
Int_Img.U8_Img_Right (Len, Lstr);
Serial.Put ("len:"); Serial.Put(Lstr);
Serial.New_Line;
Serial.New_Line;

Str := (others => '@');

Edit.Generic_Integers.Put_U32 (123, 16, Str, Len);
Serial.Put_Line (Str);
Int_Img.U8_Img_Right (Len, Lstr);
Serial.Put ("len:"); Serial.Put(Lstr);
Serial.New_Line;
Serial.New_Line;

Serial.Put_Line ("Now with signed Integers");
Serial.New_Line;
AVR.Strings.Edit.Integers.Put (Sample3); --No output appears as a result of this line
Serial.New_Line;

AVR.Strings.Edit.Integers.Put (Sample4); --No output appears here
Serial.New_Line;

end Int_Out;

Discussion

  • Rolf Ebert

    Rolf Ebert - 2013-07-15
    • Group: v1.3.0 --> v1.2.3
    • Priority: 1 --> 3
     
  • Rolf Ebert

    Rolf Ebert - 2014-11-01

    edited line output is not documented

     
  • Rolf Ebert

    Rolf Ebert - 2014-11-01
    • Group: v1.2.3 --> v1.3.0
     
  • Rolf Ebert

    Rolf Ebert - 2014-11-25

    Works for me.

    You missed to send the resulting string to the serial port (Serial.Put(Edit.Output_Line)).

    But see other bug for missing documentation of how things work now

     
  • Rolf Ebert

    Rolf Ebert - 2014-11-25
    • status: accepted --> closed
    • Priority: 3 --> 9
     

Anonymous
Anonymous

Add attachments
Cancel