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!
String configuration with S7-300 TCP Driver
-
- Posts: 2
- Joined: Tue Feb 05, 2013 4:14 pm
Re: String configuration with S7-300 TCP Driver
There is some documentation somewhat hard to find in iX Developer. See this FAQ for details.
http://ixtalk.beijerelectronics.us/view ... hp?f=8&t=4
In that documentation you will find the addressing syntax.
http://ixtalk.beijerelectronics.us/view ... hp?f=8&t=4
In that documentation you will find the addressing syntax.
- Attachments
-
- Snap 2013-02-05 at 16.40.21.png (44.3 KiB) Viewed 13077 times
Best Regards,
Beijer Electronics, Inc.
Ron Lloyd | Applications Engineer
Beijer Electronics, Inc.
Ron Lloyd | Applications Engineer
-
- Posts: 2
- Joined: Tue Feb 05, 2013 4:14 pm
Re: String configuration with S7-300 TCP Driver
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 :
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.
Would this work? I currently does'nt have access to the PLC, so it will be hard to test.
Thanks,
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 :
Note: When storing ASCII values in 16-bit numbers the eight least significant bits contain the second ASCII code.
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?Note: The first two bytes in a string only contain information about the string.
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: Select all
Data type : STRING[24] Adress : DB155.DBB60
Thanks,
Re: String configuration with S7-300 TCP Driver
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](http://ks-automasjon.no/page/bilder/tag.jpg)
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](http://ks-automasjon.no/page/bilder/fc26.jpg)
Next you put this string as an input to FC38, this convert the string to an INT.
![Image](http://ks-automasjon.no/page/bilder/fc38.jpg)
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](http://ks-automasjon.no/page/bilder/tag.jpg)
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](http://ks-automasjon.no/page/bilder/fc26.jpg)
Next you put this string as an input to FC38, this convert the string to an INT.
![Image](http://ks-automasjon.no/page/bilder/fc38.jpg)