Welcome Guest ( Login | Register )



All times are UTC - 7 hours [ DST ]



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: String configuration with S7-300 TCP Driver
PostPosted: Tue Feb 05, 2013 4:33 pm 

Joined: Tue Feb 05, 2013 4:14 pm
Posts: 2

Offline
Hi,

Im trying to configure a string to communication with an S7-300 Siemens PLC. Im am using the driver S7 ISO over TCP/IP.

The string adress in the PLC is "db155.dbx40.0 byte 26". I could not find any information about the format anywhere in the documentation. I tried a lot of variations, but none of them would work, I always get the "Invalid adress format" error message.

Any clue on how to format the adress?

Thanks!


 Profile  
 
 Post subject: Re: String configuration with S7-300 TCP Driver
PostPosted: Tue Feb 05, 2013 5:40 pm 
User avatar

Joined: Fri Jul 15, 2011 3:21 pm
Posts: 214

Offline
There is some documentation somewhat hard to find in iX Developer. See this FAQ for details.
viewtopic.php?f=8&t=4

In that documentation you will find the addressing syntax.


Attachments:
Snap 2013-02-05 at 16.40.21.png
Snap 2013-02-05 at 16.40.21.png [ 44.3 KiB | Viewed 5012 times ]

_________________
Best Regards,

Beijer Electronics, Inc.
Ron Lloyd | Applications Engineer
 Profile  
 
 Post subject: Re: String configuration with S7-300 TCP Driver
PostPosted: Wed Feb 06, 2013 8:56 am 

Joined: Tue Feb 05, 2013 4:14 pm
Posts: 2

Offline
Hi Ron,

I already went through the documentation of the driver. It mentions how to configure a digital signal, and an analog signal. There is no mention about char or string. However, there is those 2 notes :

Quote:
Note: When storing ASCII values in 16-bit numbers the eight least significant bits contain the second ASCII code.

Quote:
Note: The first two bytes in a string only contain information about the string.


But still, how do I format the adress of a string? Should I put the starting adress of the 1st word? Or the first byte? Or the first bit?

Also, how can I control the length of the string? Is it by using the data type in the tag declaration, or the adress should contain the length itself?

A syntax that currently compiles is the following. This is a string of 24 char starting at byte 60.
Code:
Data type : STRING[24]         Adress : DB155.DBB60


Would this work? I currently does'nt have access to the PLC, so it will be hard to test.

Thanks,


 Profile  
 
 Post subject: Re: String configuration with S7-300 TCP Driver
PostPosted: Fri Jan 17, 2014 1:39 am 

Joined: Thu Nov 17, 2011 2:10 am
Posts: 49
Location: Norway

Offline
Hi,

didn't find any answer to this on any forum, so I thought I would post my solution.
NB! This solution splits a string into several INT's.

In iX you have to configure the tag with address DBxx.DBWyy , and if you wan't to read as well as write a string, you also have to set type STRING for not only the controller, but also the "Tag"-section.
Image
You would probably need to use script to set the string value to the tag.

I also encountered that when I wanted to use the string and read values from it there was no values the first time. There for I had to add tag.Read() in the startup screen's script.

In Siemens you have to use two built-in functions, the first two bytes of the string value can't contain any valuable data, as Siemens use these for string length.
First you use FC26 (MID) and set P = 1 (for the first word, byte, ...), the length depends on how many strings you wan't to read at a time.
The output from FC26 should be a new DB string with the length you wan't.
Image


Next you put this string as an input to FC38, this convert the string to an INT.
Image


 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: