plc4x-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christofer Dutz <christofer.d...@c-ware.de>
Subject Re: [S7] String handling
Date Mon, 03 Sep 2018 07:47:32 GMT
Hi Julian,

so I spun up my TIA and did some String stuff ...

Defined 2 Sting variables:

Name: 		Data type: 		Offset:		Start value:
Hurz1		String			314.0		'Der Wold, das Lamm"
Hurz2		String			570.0		'Auf der grünen Wiese"

After compiling the memory block (DB1), the offsets were automatically set.

Then I added a CONCAT function to my PLC program and referenced those two fields as input.
Here's what TIA made out of it:
Hurz1: 	P#DB1.DBX314.0
Hurz2:  P#DB1.DBX570.0

Notice the "P#" instead of the "%"? And it seems that the address looks like a BIT address,
as it has the bit offset part set. But just comparing this to all the others, it seems like
all types can have a bit-offset part set, this is just always ".0" for any non-bit type.

Chris


Am 02.09.18, 13:03 schrieb "Julian Feinauer" <j.feinauer@pragmaticminds.de>:

    Hey everybody,
    
    I have another question about the semantics we should provide for reading / writing Strings
in the S7 Driver.
    I have not found an example on how this is handled currently but to me it looks a bit
like a mix of reading the data as “array”, i.e., using the size parameter on the request
(= fixed size string) but handling it as null terminated String.
    
    As I have currently no TIA available, can anyone give me the syntax how Strings are addressed
in TIA.
    I think they were fixed size always and I would prefer to do it that way.
    
    Could anyone who implemented this (or has expertise in this) help me out a bit?
    
    Thanks
    Julian
    

Mime
View raw message