![]() |
Datentyp single (Delphi) in Datentyp Gleitkomma (S7) wandeln
Hallo, ich bin Anfänger und habe folgendes Problem.
Ich muss den Datentyp single (4Byte) in den Datentyp Gleitkomma (4Byte) (Simatic Siemens S7) übetragen. Denn wenn ich in Delphi einen single Wert einlese (z.B. 1,6) dann kommt auf der SPS Seite (Datentyp Gleitkomma) komplett was anderes heraus. Jetzt wollte ich wissen wie ich das in Delphi machen muss dass die beiden Typen übereinstimmen. Danke für eure Hilfe :) |
Re: Datentyp single (Delphi) in Datentyp Gleitkomma (S7) wan
Was kommt den heraus?
|
Re: Datentyp single (Delphi) in Datentyp Gleitkomma (S7) wan
Wie werden die Daten übertragen?
ich vermute mal das du von Big Endian auf Little Endian wandeln musst um die Richtige ![]() |
Re: Datentyp single (Delphi) in Datentyp Gleitkomma (S7) wan
-8.7546383e^23 kommt heraus, also völliger quatsch
|
Re: Datentyp single (Delphi) in Datentyp Gleitkomma (S7) wan
die daten übetrage ich via profibus
habe eine hilscher karte in delphi eingebunden. vom delphi programm übetrage ich dann daten zur sps und anderst herum ebenfalls |
Re: Datentyp single (Delphi) in Datentyp Gleitkomma (S7) wan
wie mache ich das mit dem wandeln ?????
|
Re: Datentyp single (Delphi) in Datentyp Gleitkomma (S7) wan
Zitat:
Delphi-Quellcode:
function RB(A: longint): longint;
{-reverse byte order in longint} begin RB := ((A and $FF) shl 24) or ((A and $FF00) shl 8) or ((A and $FF0000) shr 8) or ((A and longint($FF000000)) shr 24); end; var s: single; l: longint absolute s; .. l := RB(l); |
Re: Datentyp single (Delphi) in Datentyp Gleitkomma (S7) wan
![]() und ![]() Aber eventuell nutzt S7 ein anderes Datenformat und nicht IEEE 754? |
Re: Datentyp single (Delphi) in Datentyp Gleitkomma (S7) wan
Bitte vermeidet Mehrfachposts!
|
Re: Datentyp single (Delphi) in Datentyp Gleitkomma (S7) wan
danke für eure hilfe
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:24 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz