Hi,

thanks for the clarification.
Is it weird that for me the blinking Christmas tree seems easier to code in 
assembler than in TIA? : >

But to the topic, the array thing is fine and we can simply do it as planned.
The thing I'm unsure with is an array of Strings.
In the case of non-default length this would be

P#DB1.DBX314.0:STRING[100][1]

which look bad.

Options are:
a) Do not allow String arrays
b) Use another string syntax
c) use another array syntax
d) use the syntax as above

Personally, I do not like b-d at all is it is way to confusing.
Is everybody okay a? Or do we have the feeling to "loose" something?
I think this is a very rare case in reality so for me it would be fine.

Julian

Am 03.09.18, 11:05 schrieb "Christofer Dutz" <[email protected]>:

    Hi Julian,
    
    unfortunately my TIA knowledge is very limited ... I manage to create a 
blinking Christmas tree, but doing some intense PLC coding is sort of over my 
head.
    
    However I do manage to be able to check the array question:
    
    It is possible to define an array of Strings. However it looks as if TIA 
handles this as syntactic sugar. Cause if I defined an array of Strings, each 
is 265 bytes long.
    When I access "strvar[0]" this is translated to: P#DB1.DBX314.0
    And if I access "strvar[1]" this is translated to: P#DB1.DBX570.0
    
    I re-did this check with other datatypes such as Bool:
    
    When I access "boolvar[0]" this is translated to: %DB1.DBX48.0
    And if I access "boolvar[1]" this is translated to: %DB1.DBX48.1
    
    And with byte:
    
    When I access "bytevar[0]" this is translated to: %DB1.DBB50
    And if I access " bytevar[1]" this is translated to: %DB1.DBB51
    
    So I assume there is no "array notation" for TIA addresses.
    
    Chris
    
    
    
    Am 03.09.18, 10:20 schrieb "Julian Feinauer" <[email protected]>:
    
        Hey Chris,
        
        thank you for the information!
        Yesterday I went through lots of Siemens manuals just to find out that 
it gets the more confusing the deeper you go into.
        Could it be that the P denotes a Pointer?
        Because the "#" is usally used for symbolic addressing when I remember 
correctly.
        
        My aim is to have a clear and good syntax which is as TIAesk as it 
could be but on the otherhand easy to understand for all non TIAlers.
        So for me the addresses read like pointers to the start bit (DBX).
        This probably makes sense as a String is not considered an elementary 
type in TIA (as its larger than 4 bytes).
        
        So the combined syntax would be:
        P#DB1.DBX314.0:STRING
        Or
        P#DB1.DBX314.0:STRING[100]
        With explicit length information.
        
        A related question is, how does TIA handling referencing to arrays (I 
think we agreed to do this as part of this string here).
        Can anyone with TIA access (chris?) check how tia handles this?
        Or should we simply make it similar with 
        P#DB1.DBX314.0:LREAL[10] // Read 10 LREALS starting at offset 314
        
        What do you think?
        
        Julian
        
        Am 03.09.18, 09:47 schrieb "Christofer Dutz" 
<[email protected]>:
        
            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" 
<[email protected]>:
            
                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
                
            
            
        
        
    
    

Reply via email to