Siemens s7-1200 + Beijer iX developer

iDio

Member
Join Date
Jun 2020
Location
Portugal
Posts
6
Hi guys. Really fan of this forum but never posted anything, created the account just for this, no hate please :)

So, I'm working on a project with an S7-1200 with a Beijer HMI..
Everything kinda good until today, i was able to set/reset/exchange data through IsoTcp communication.

But now i need to exchange some plc string variables to display in the HMI, and also receive in the PLC the result of some input in the HMI ( as string, too).

I tried to create Tags in the iX developer project (v2.4) but they only work as internal, i cannot set the plc datablock address the same way i do for int/bool etc..

Any clue on how to do it? I'm proficient in C#, but bits&bytes are rusty these days..

Thank you!
 
Also, Siemens have string format this way.
The format for a string is that the first byte holds the length of the string and from byte 2 onwards is the data.


It is different than normally for strings lenght is only bytes readed/writed.

(Lenght is not coded to start of data bytes, as they have also string characters, one character = 2bytes).
If there isn't Siemens string format on IX, you can convert string format to array of bytes on PLC side and then read / write array of bytes (or each ASCII character as individual byte).
 
Last edited:
Also, Siemens have string format this way.
The format for a string is that the first byte holds the length of the string and from byte 2 onwards is the data.


It is different than normally for strings lenght is only bytes readed/writed.

(Lenght is not coded to start of data bytes, as they have also string characters, one character = 2bytes).
If there isn't Siemens string format on IX, you can convert string format to array of bytes on PLC side and then read / write array of bytes (or each ASCII character as individual byte).

Thank you for the fast reply.
The thing is, how do i define the tag in the HMI?
Look at the attached pictures, it might help understanding ( i wanna send from PLC to HMI, both trying as string and array of char )

db.png netw.png ixDeveloperTag.png
 
I downloaded the demo version of iX and connected to a plc using nettoplcsim and got the ix display to show the string in the plc.
I had to specify the address of the string to be the address in the plc+2 e.g.

ix1.jpg
 
I downloaded the demo version of iX and connected to a plc using nettoplcsim and got the ix display to show the string in the plc.
I had to specify the address of the string to be the address in the plc+2 e.g.

but why address it as byte? ( DBB )
in the PLC, the string as a "whole" is defined as DBX ..
 
I downloaded the demo version of iX and connected to a plc using nettoplcsim and got the ix display to show the string in the plc.
I had to specify the address of the string to be the address in the plc+2 e.g.

but thank you for this, i will try it tomorrow and i'll give feedback :)
 
On PLC, address is pointer to address range.


if you have full DB-block (25bytes), then I think that you can point by symbolic DB-name. (on which case pointer is showed as P#DB20.DBX0.0 = which would be DB20.dbb0-dbb24 bytes)



You can also point

P#DB20.DBX0.0 BYTE 25 = Starting from DB20.DBX0.0 addrees and 25 bytes. (whit byte end, you can point to part of DB-block or whole DB-area

(This is absolute addressing, which should avoid on TIA.
You can also point P#DB20.DBB0 BYTE25, which would still be same address range.)


And P#DB20.DBX0.0 BYTE 10, is pointing to address range DBX0.0 - DBX9.7 (and DBB0-DBB8 of course as they overlap)



On HMI side it

L D have lenght codes on String[20] and then HMI only needs starting address as byte address (offset +2 of PLC string, as byte 0 is lenght of string on PLC side.)


So on your case you have string 25 characters on PLC p#DB20.DBX1360.0
(which is address range bytes DB20.DBB1360-1386)
DB1360 = lenght
DB1362-1386 = charachters



-> string[25] and starting from first character byte DB20.DBB1362


Another way is read every character by individually or array of bytes, but that would not be useful (so you don't need string to char block at all on PLC now as HMI can read string format directly.)
 
Last edited:
On PLC, address is pointer to address range.


if you have full DB-block (25bytes), then I think that you can point by symbolic DB-name. (on which case pointer is showed as P#DB20.DBX0.0 = which would be DB20.dbb0-dbb24 bytes)



You can also point

P#DB20.DBX0.0 BYTE 25 = Starting from DB20.DBX0.0 addrees and 25 bytes. (whit byte end, you can point to part of DB-block or whole DB-area

(This is absolute addressing, which should avoid on TIA.
You can also point P#DB20.DBB0 BYTE25, which would still be same address range.)


And P#DB20.DBX0.0 BYTE 10, is pointing to address range DBX0.0 - DBX9.7 (and DBB0-DBB8 of course as they overlap)



On HMI side it

L D have lenght codes on String[20] and then HMI only needs starting address as byte address (offset +2 of PLC string, as byte 0 is lenght of string on PLC side.)


So on your case you have string 25 characters on PLC p#DB20.DBX1360.0
(which is address range bytes DB20.DBB1360-1386)
DB1360 = lenght
DB1362-1386 = charachters



-> string[25] and starting from first character byte DB20.DBB1362


Another way is read every character by individually or array of bytes, but that would not be useful (so you don't need string to char block at all on PLC now as HMI can read string format directly.)

Yes, everything understood and works fine like that! Thanks!
Now i'm just trying to figure out how to solve another problem, when the length is different ..
If i send something like "123" but the previous was "456789", the result will be "123789".. The string array needs to be defined as constant, so probably i will need to send trailing whitespaces
 
How about if you use two tags. One for write and other as read/feedback to HMI?
Tags can be on same object on HMI or seperate objects.

Then on CPU copy writed chars to other if there is new data and zero original to null which you writed from HMI.

It is maybe possibly also some other way.
 
Or only one variable on HMI and two different on PLC.
If HMI input is same than chars before (saved chars on plc buffer) -> No copy to "CPU buffer".
If HMI input differs of buffer then move 1st null characters to buffer and then chars from HMI input.
 
I would think you need a separate tag which is the length of the string in the PLC.


Byte 0 max length
Byte 1 current length
Byte 2+ actual string.


If you never change byte 1, the PLC will never know that your string is shorter or longer than the previous.
 
Tested this.


HMI string is allways 25bytes long (DB0.DBB1 have 25 value)


If you send 1235 from HMI, it is readed as 1235$00$00...


First netwok finds 1st null character from HMI data.
Then null lenght is calculated (25-HMI first null place)

NW3 converts original 25 bytes long string from HMI to array, still 25bytes long.
NW4 fill this array with $00, so that it later converts no fixed lenght.
(I forgetted to rename temp variable to index on NW4, but it comes from NW1)


NW5 eventually converts array to another string, and it should be now fixed lenght.


With text, you need end character format or null HMI input after you have copied it to buffer on CPU.

Maybe even if you find 2*null character on end of string? o_O





Anothers solutions?

plc_string1.jpg plc_string2.jpg plc_string3.jpg plc_string4.jpg
 
Last edited:

Similar Topics

commentaire communiqué siemens s7-1200 avec vfd delta ? (cablage et sur tia portal )
Replies
0
Views
80
Hi, I have a 1214 on ip 192.168.0.100. This is connected to other modules through a switch on same network. I need to connect this to a company...
Replies
1
Views
140
Hi Experts, I would like to make firmware upgrade from v3.0 to v4.5 (S7-1200 CPU 1215C). Can I do it from v3.0 to v4.5? Do I need to take some...
Replies
6
Views
205
Hi Guys, I am trying to establish communication over profinet between Siemens S7-1200 PLC as IO device and codesys plc as IO controller. But I am...
Replies
43
Views
2,538
Which signals do I have to use to get data from camera. For example camera detects a defect and sends signal to controller. Power cable: CCB-PWRIO-05
Replies
1
Views
176
Back
Top Bottom