Kim Jessen

Global DB to output string

16 posts in this topic

Hi guys.. so it's tight again with my knowledge..
I have made a Data Block.
In that data block I have entered 8 text messages. ( String )
I can get them out in a local variable... but I can't really use that for anything if I have to use the information on my HMI panel.
How do I MOWE the text from the specific result address in the DB to a global memery TAG.
Hope you understand.

Share this post


Link to post
Share on other sites

I don't follow what you are trying to do. If you have a string in a DB, you can directly use it your HMI. You can't move a String to a Memory tag.

Share this post


Link to post
Share on other sites
27 minutes ago, Hati said:

I don't follow what you are trying to do. If you have a string in a DB, you can directly use it your HMI. You can't move a String to a Memory tag.

I can understand that you are confused.. I am a beginner in siemens s7 programming.. so I am probably phrasing myself wrong.. 1: I don't use a Siemens hmi panel, it's an RS pro panel.. which actually works really well.. 2: how will you use the database for the panel??

Share this post


Link to post
Share on other sites

I have made a super simple test.
A DB in 6 places.
5 for data and 1 for result.
You can see that in the pictures.
And it works.

My problem is the HMI panel addressing, I don't understand the format.
I've tried a number of ways but it doesn't work

I have also made a picture of the HMI panel setup..

and a link that describes something that doesn't make sense to a beginner like me...

https://docs.we-con.com.cn/bin/view/V-BOX/V-Net/Protocols/Siemens/#HS7-1200A0Ethernet

I really hope this gives you an understanding of where my problem is

 

Thanks a lot Kim !

 

DB-TEST_1.JPG

DB-TEST_2.JPG

DB-TEST_3.JPG

DB-TEST_HMI steup.JPG

DB-TEST_HMI steup DOKU.JPG

Share this post


Link to post
Share on other sites

I have no idea what HMI that is, so hard to help. In a Siemens HMI, you just drag-and-drop the PLC tag to the HMI, and you're all done.

Might be that you need to show the string as Bytes of character on that HMI, if it doesn't support String format. Siemens String has the first 2 bytes ( byte 0 and 1) informin the lenght of the string and how many character there are. So byte 2 -> is the actual characters of the String.

Share this post


Link to post
Share on other sites

From your screen shots it looks like you are using "Optimised" DB for your strings where it looks like the HMI is looking for "physical addresses" in the DB - ie non optimised blocks.

Right click on your DB, select Properties then select Attributes.

You will see a tick box for optimised block access.

1 person likes this

Share this post


Link to post
Share on other sites
5 hours ago, Moggie said:

From your screen shots it looks like you are using "Optimised" DB for your strings where it looks like the HMI is looking for "physical addresses" in the DB - ie non optimised blocks.

Right click on your DB, select Properties then select Attributes.

You will see a tick box for optimised block access.

Hi.. Thank you very much it made something work.. Now I can retrieve numbers from the database. word.

I came across this text.. I think it has something to do with my challenge to read string..
but heg can't quite decipher it.
The DB address on the HMI panel is, when it is WORD 01, the placement becomes 0001 for example..
so I type 010001
then I get the number in DB 1 and the value in location 1. it works.

  • S7-1200 String type, the default first two bytes are used to store the maximum character and valid characters, so the text data will be shifted back one word address. When interacting with the data, what way this address plc is displayed with is unknown. And because of an extra word of data causes us to display the wrong. The solution is if we use String, then the actual data address we want to operate on is actually shifted back two bytes, so as long as the address on the project is shifted back 2 bits to correspond with the actual data address.

"


The DB address on the HMI panel is, when it is WORD 01, the placement becomes 0001 for example..
so I type 010001
then I get the number in DB 1 and the value in location 1. it works.

The question is.. in relation to the text, what does the address become with a STRING

I succeeded with STRING.. in a way.. I can get an "i" into the database and I can see an i on the HMI panel. but if I write tests in the database I get rubbish on the panel

Try to see the pictures..
it's like it's upside down and something is missing

 

DB-TEST_1_new.JPG

DB-TEST_HMI Resault.JPG

DB-TEST_HMI steup_new.JPG

DB-TEST_HMI steup_new_1.JPG

Share this post


Link to post
Share on other sites

What software is this??
Also try DB1.DBW2.

The (so called) help file says shift 2 bytes, you have only moved 1 byte !!!

Share this post


Link to post
Share on other sites
14 minutes ago, Moggie said:

What software is this??
Also try DB1.DBW2.

The (so called) help file says shift 2 bytes, you have only moved 1 byte !!!

can you try to explain shift 1 or 2 bytes because i didn't even realize i had shift 1 byte.

Software : pistudio

Share this post


Link to post
Share on other sites

Db1.DBB 0 = Byte 0

DB1.DBB 1 = Byte 1

DB1.dbw0 = Byte 1 AND Byte 1

DB1.DBW2 = Byte 2 AND Byte 3

In your screenshot you show the address as DBxDBW10001 which (in Siemens notation) = DB1.DBW1, which is DB1.DBB1 AND DB1.DBB2

Share this post


Link to post
Share on other sites
4 minutes ago, Moggie said:

Db1.DBB 0 = Byte 0

DB1.DBB 1 = Byte 1

DB1.dbw0 = Byte 1 AND Byte 1

DB1.DBW2 = Byte 2 AND Byte 3

In your screenshot you show the address as DBxDBW10001 which (in Siemens notation) = DB1.DBW1, which is DB1.DBB1 AND DB1.DBB2

ooooh.. that's wrong.. that's why I don't understand what you write.. I can see what you mean now.. hmm I'm away from my PC right now but I hope that's not where the error is.. because I actually plan to use DBxDBD. and not DBxDBW

Share this post


Link to post
Share on other sites
12 hours ago, Hati said:

I have no idea what HMI that is, so hard to help. In a Siemens HMI, you just drag-and-drop the PLC tag to the HMI, and you're all done.

Might be that you need to show the string as Bytes of character on that HMI, if it doesn't support String format. Siemens String has the first 2 bytes ( byte 0 and 1) informin the lenght of the string and how many character there are. So byte 2 -> is the actual characters of the String.

hati posted the above, which means - 

From your screen shot your "base address" is DB1.DBW0
So Byte 0 AND Byte1 (DB1.DBW0) will be the String length and number of characters.
Your address in the HMI should start with DB1.DBW2 (Start of string).

1 person likes this

Share this post


Link to post
Share on other sites
25 minutes ago, Moggie said:

hati posted the above, which means - 

From your screen shot your "base address" is DB1.DBW0
So Byte 0 AND Byte1 (DB1.DBW0) will be the String length and number of characters.
Your address in the HMI should start with DB1.DBW2 (Start of string).

I would try to create the visualization by BYTES, so one BYTE tag for each character place in the string. Seems like that HMI can't use String directly, because you need to use absolute addressing. If you use DBD extensio, that occupies 4 Bytes, so 4 characters only.

 

Btw, if you don't define a maximum lenght for the string in Siemens, it will be 255 characters.

1 person likes this

Share this post


Link to post
Share on other sites

You may also have to tick the box "Exchange high-low byte"

Share this post


Link to post
Share on other sites
2 hours ago, Hati said:

I would try to create the visualization by BYTES, so one BYTE tag for each character place in the string. Seems like that HMI can't use String directly, because you need to use absolute addressing. If you use DBD extensio, that occupies 4 Bytes, so 4 characters only.

 

Btw, if you don't define a maximum lenght for the string in Siemens, it will be 255 characters.

so that means I can only display 4 letters at a time. so I can't get a text but have to invent 4 letter abbreviations.

Share this post


Link to post
Share on other sites

Hello friends, thank you very much for your push in the right direction.. I have something that works as desired.. I have to admit that I have not fully understood the address but.. but it works.

So what I do comes in pictures here.

So what I do comes in pictures here.
Special thanks to Moggie..
The "optimized block access" that brought more communication.

I know I'm asking some stupid beginner questions, but thank you for all your patience

DB-TEST_1_working.thumb.JPG.dc516184a843

HMI_ok_result.JPG.42687b0334f54dd12090b1

 

HMI_setup_for DB1_1.JPG

HMI_setup_for DB1_2.JPG

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now