Jump to content

JDRenk

Members
  • Content Count

    26
  • Joined

  • Last visited

Posts posted by JDRenk


  1. I have added the File Menu (from File Menu Template) to my Main Menu along with Open Dialog and Save Dialog and it is not working.  I have compared it with working code and it is the same.  The difference is under Structure, the File Icons are partially shown which seems to indicate something amiss.  

     

    Thanks,

    Jeff


  2. Thanks, but I don't quite understand how to apply that.  I'm new to this.

    This is my procedure:

     

    procedure TForm2.ComPort3RxChar(Sender: TObject);
    var
      Buffer3 : array[0..14] of Byte;
      Result3: array[0..3] of byte;
        begin
          ComPort3.Read(@Buffer3,15);
          Move(Buffer3[7],Result3,4);
        end;

     

    Result3 is the float32_t buffer

    I am using Delphi 10.4 Community Edition


  3. Thanks, I now have that Com Port and sensor working OK.  Now I have another sensor and Com Port that are totally different.  This one returns a 4 byte float32_t value.  I have the 4 bytes in an array of bytes.  How would I convert that to a decimal string?


  4. Thank you.  Now I'm having success in debugger mode, but when I run without debugger on I get  "'$' is not a valid integer value."  The result is correct, just the pop up issue.  It is coming from the StrToInt because if I change the $ to 0x I get the 0x in the message.


  5. This is what I have:

     

     procedure TForm2.ComPort1RxChar(Sender: TObject);
     var
           A : integer;
           Buffer1 : AnsiString;
           Result1 : AnsiString;
          begin
            Buffer1 := ComPort1.ReadAnsiString;
               Result1 := Copy(Buffer1,21,8);
               A := StrToInt ($Result1);
          end;

     

    But it is saying StrToInt is overloaded, not sure what that means.


  6. I am using Delphi 10.4 Community Edition.  I don't believe it has a Systems.AnsiStrings unit.  The COPY function seems to work.  My next issue is.........  Copy gives me an eight character string of a HEX value, (eg. 1289ABEF).  How do I convert that to its Integer value (eg. 311012335)?


  7. Ok, I have a better handle on this. Since I am getting data back from different sensors via 3 UARTs, I found the best way for all is to read an ANSIString or byte by byte into a buffer.  The data contains other information I need to discard.  So how would I select characters i->j out of k total?     "xxxxxxxxixxxxxxjxxxxxxxxxxk"

    Thanks,  Jeff


  8. When I use this I get integer values that don't make sense.

     

    procedure TForm2.ComPort4RxChar(Sender: TObject);
    var
    Text: String;
    Result: Integer;
     begin
       Result := ComPort4.ReadWord;
       Text := IntToStr(Result);
       Memo2.Text := string(Text);

     end;

     

    When I use this I get the correct ANSI String.

     

    procedure TForm2.ComPort4RxChar(Sender: TObject);
    var
    Text: AnsiString;
    begin
      Text := ComPort4.ReadAnsiString;
      Memo2.SelText := string(Text);

     end;

×