Hi MARCOV,
On checking back to my Delphi code I find I did not convert to string from 32 bit but sent the raw input string so used:
Off3_Edit.Text:=TrimLeft(nrComm1.ReadString);
So apologies ! The Delphi reference was rubbish.
In the Lazarus code only the 24 bit data is recovered from EEPROM and sent as a Hex string.(FD AF 08 = -151.800}
MicroPascal Code
LS:= Read_Offsets_Long(3); {FD AF 08 in ROM Retrieved from PIC}
LongIntToStr(LS,Uart_Send_String);
LTrim(Uart_Send_String);
Len:=Length(UART_Send_String);
For i:=0 to Len+1 do
RxTx_Data:=0;
for i:=0 to Len-1 do
RxTx_Data:=ord(Uart_Send_String);
CanspiWrite(1552,RxTx_Data,8,Can_Send_Flags);{Sent to CANBUS}
This is received by Lazarus CODE
TS:='';
Application.ProcessMessages;
GLForm.CANCOM(113,1536,1);
TS:=GLForm.CANCOM(113,1536,1); {Data received as 3 byte Hex String - no 32 bit MSB FFFF to provide Sign bit}}
SPAN_ME3.Text:='';
SPAN_ME3.Text:=GLForm.CAN_DISPLAY(TS);
GLForm.CAN_DISLPAY is:
Function TGLForm.Can_Display(Instring:String):AnsiString;
Var i,j:Integer;
o:Integer;
Len:Integer;
S:String[3];
M:String[35]; {20}
C:String[35]; {20}
begin
Result:='';
M:='';
Len:=Length(Instring);
o:=Len-12; {12}
M:=MidStr(Instring,8,o);
j:=1; c:='';
S:='';
For i:=1 to Length(M) Div 2 do
begin
S:='$'+M[j] + M[j+1];
j:=j+2;
C:=Chr(StrToInt(S));
S:='';
end;
M:='';
For i:=1 to o do
M:=M+C;
Instring:='';
Result:=M;
end;
Which breaks down the 3 'instring' Hex bytes into the value to be displayed in a text box
So the problem remains as only the 24 bit data.The value displayed is the text value of my transmitted hex data FD AF 08 =166254167 and not -151800 which would be displayed if the hex data was FF FD AF 08.
My initial analysis involving LongIintToStr was careless. No bug in Lazarus - however I still have the problem as to how to get the required -151800 display. I think I must add the MSB byte after detecting the 3 byte data going negative in 24 bit terms ?
Sorry for my hasty first analysis.
Many thanks,
Docwat