Hex To string in S7 and wincc

saeed_en

Member
Join Date
Feb 2011
Location
asia
Posts
28
Hi everybody
In my program I have five bytes
MB10 w#16#62
MB11 w#16#50
MB12 w#16#24
MB13 w#16#10
MB14 w#16#00

I want to show these values in this way 6250241000 as an only one tag(string or.....) in wincc

how can I do that?
 
Hi,
if you add the 5 Bytes in WinCC as separate tags (MB10 to MB14), you can use an I/O Field and add a C-script as output value like this:
Code:
char *str;
str = SysMalloc(11); /* allocate memory for a string with 10 chars plus ending \0 '
sprintf(str, "%02x%02x%02x%02x%02x", GetTagByte("MB10"), GetTagByte("MB11"), GetTagByte("MB12"), GetTagByte("MB13"), GetTagByte("MB14"));
return str;
As trigger should add all 5 bytes, so that the script is called when one of the 5 values has changed.

If you would have 4 bytes instead of 5 bytes, it should be possible to use the hexadecimal output style of an I/O field. But then you have a different byte order.
 

Similar Topics

Hi I need to convert a DINT with HEX value e.g A0F15663 to a string with the same value 'A0F15663'. Any tips of good instructions to use ...
Replies
11
Views
3,387
Hi Guys, I have a problem with reading the following HEX string into a CompactLogix PLC. The HEX string is "D852268A" which if converted to a...
Replies
16
Views
4,632
Hello everyone, I'm working in RSLogix 5000. I have an ASCII string of letters & numbers (call it String_3) which I have used INSERT to add a...
Replies
3
Views
2,322
I'm trying to display a Allen Bradley Controller Serial Number that's in HEX to String for my SCADA to display. Any ideas?
Replies
3
Views
2,846
Hi guys. Sorry if I am asking for something solved, but I cant find any useful and easy information for me. I am looking for some solution how to...
Replies
5
Views
6,470
Back
Top Bottom