Wincc Flex I/O field End of string has on HMI

adamplc

Member
Join Date
Dec 2009
Location
usa
Posts
92
Can somebody help I am displaying a scanned string via a intermec hand scanner onto a MP377 with a I/O field on wincc flex.The string field length is declared as 16 but the barcode is only 10 chars long at the end of the 10 it displays 1644105806đť” đť” đť” đť”  I don't want to reduce the string length as in the future the string may get longer than 10 how can I remove the đť”  đť”  đť”  đť” o_O
Thanks for any help
 
When you want to read a new bar code, fill the string with spaces first. You will have to provide the logic to determine when the string should be filled with spaces.

fill.jpg
 
Adamplc

For anyone to help, I believe we still need screen shots of tag data setup and show us the field info too

I want to test this
Im very curious

edit-------


Well
Looks like LD has it figured out
 
The string declaration in DB8 is not initialised so contains zeros which I guess is what causes the squares on the screen.
 
It is correct that the squares are because the memory area of the string has not been initialised.
I think it is not enough to merely fill all the bytes with zeroes.

A STRING is formatted so that the first byte contains the reserved length in characters/bytes, the second byte contains the length of the actually used characters/bytes, and from the third byte and to the end of the string you have the real charachters.

To initialise, create a an empty STRING in a DB (only contains the '', but has same reserved length as the STRING to store the barcode), then BLKMOV this empty string to the barcode STRING memory.
edit: That actually doesnt empty the memory of the characters, it just sets the actual length to zero. The STRING will correctly be displayed as empty on the HMI despite that the character memory is not cleared.
To fill the string with characters from the barcode scanner, you have to detect the number of actual characters, and store this value in the second byte.
 
Last edited:
It is correct that the squares are because the memory area of the string has not been initialised.
I think it is not enough to merely fill all the bytes with zeroes.

A STRING is formatted so that the first byte contains the reserved length in characters/bytes, the second byte contains the length of the actually used characters/bytes, and from the third byte and to the end of the string you have the real charachters.

To initialise, create a an empty STRING in a DB (only contains the '', but has same reserved length as the STRING to store the barcode), then BLKMOV this empty string to the barcode STRING memory.
edit: That actually doesnt empty the memory of the characters, it just sets the actual length to zero. The STRING will correctly be displayed as empty on the HMI despite that the character memory is not cleared.
To fill the string with characters from the barcode scanner, you have to detect the number of actual characters, and store this value in the second byte.

If I view db8 in a varable table the first 2 bytes in the string I have "1"and "6" this doesn't change even if I scan different length barcodes I would expect the second byte to change depending on the string length right :unsure:
My next thing I am not that confident to do what JespersMP has suggested to detect the number of actual characters, and store this value in the second byte .
I have simply tried to fill the P#DB8.DBX2.0 BYTE 16 with 0 and then rescan the barcode I have got rid of 2 đť” đť”  so I now have 2 more to remove
I am unable to attach the hmi project as it is 2 large maybe more screen shots if needed
 
The "1" and "6" doesnt change by itself, You have to write the code to do that.

The "1" in the 1st byte is wrong, it should be 16. However, it is irrelevant for WinCC Flexible because it uses the specified string length of the string tag and the string output field (whichever is shorter).

The "6" in the 2nd byte can also not be right as the length displayed in your screenshot is clearly 14 characters.
I am positive that the second byte MUST be the active string length. If you are sure to always have 10 characters you can set the value "10" manually in code.

What is the string tag length and address ?
How many characters have you setup for the output field ?
Monitor the string in a vat.
Byte 0, and byte 1 must be "DEC".
Bytes 2 to 17 must be "CHARACTER".
 
I agree with LD that you need to clear the storage area of the string. On the other hand I would fill it with Null [16#00] and not spaces[16#20].
When I read a barcode into a S7 plc I declare a array of chars as long as I need.
This I will fill with null before every scan. Point the FC to the array as area to write/save too. In winCC declare a tag as CharString with the array as address and use this tag to display it in a IO field. It saves the complexity of the max and actual string lengths in S7.
 
I agree with LD that you need to clear the storage area of the string. On the other hand I would fill it with Null [16#00] and not spaces[16#20].
When I read a barcode into a S7 plc I declare a array of chars as long as I need.
This I will fill with null before every scan. Point the FC to the array as area to write/save too. In winCC declare a tag as CharString with the array as address and use this tag to display it in a IO field. It saves the complexity of the max and actual string lengths in S7.

I will give this a try I just don't get why it does this. I am currently doing the install and will trouble shoot this when power is back on.
How do you clear it out on every scan?
I am just clearing it out before a new scan.
Thanks for everyones help
 
How do you clear it out on every scan?
I am just clearing it out before a new scan.
Thanks for everyones help
I have a global DB where I write all my display data too.
Once I receive data from the scanner the NDR (new data received ) of the FC goes high. This I use to Block move the read buffer into my DB for display values if i want to display this code.
Once the block move is complete I will immediately clear the read buffer.
Are you constantly reading data from the com's port or just when you are expecting data?
 
I have a global DB where I write all my display data too.
Once I receive data from the scanner the NDR (new data received ) of the FC goes high. This I use to Block move the read buffer into my DB for display values if i want to display this code.
Once the block move is complete I will immediately clear the read buffer.
Are you constantly reading data from the com's port or just when you are expecting data?

I am only reading data when expecting it, but need to display it always on the hmi.
 

Similar Topics

Hi I am trying to vary the number of decimal places via a script (MP377) Dim obj Set obj =...
Replies
0
Views
1,308
I want to use a symbolic IO-field in WinCC Flex, but I don't want to use a fixed textlist to display. The selection I wan't to show is not know at...
Replies
0
Views
3,885
Dear all, I have come across a problem. A plant is controled by an S314C-2DP connected to an OP177B. In the operator panel there are three I/O...
Replies
4
Views
3,641
Hi On my project I have a status area on the template screen with date and time text fields, which indicate the panels date and time. Every...
Replies
4
Views
2,490
Hi everyone, Well, I'm still working on my panel (for those who have seen my other posts, I'm having problems and delays figuring out the...
Replies
1
Views
3,561
Back
Top Bottom