Step7 TIA Portal - Checking String Length

SDixon578

Member
Join Date
Feb 2014
Location
Lincolnshire
Posts
3
Hello,

Let me start out by saying that I'm new to PLC programming & The Siemens Step7 TIA Portal.

We have a setup that includes 5 cameras looking for a 2D code and comparing that result to the expected 2D code. In a nutshell, it makes sure we are using the correct packaging.

I keep having trouble with my program due to the cameras only returning a partial result - even though they shouldn't. I want to add logic to only fire the output when the string is 8 characters long.

Is it possible to do this?

Thanks,

Stacy
 
Hi Stacy

Welcome to the Forum.

If you go to Extended Instructions you should find 'String + Char', click the arrow to open the folder, go down to 'further instructions' and you will find LEN. LEN returns the length of a String.

A quick note on strings. A string is a bunch of characters in sequential memory locations followed by a NULL character. If the NULL character is missing then it isn't a string and string operations will fail. So you might need to be careful if the camera is only sending part of a string.
 
Hi Stacy

Welcome to the Forum.

If you go to Extended Instructions you should find 'String + Char', click the arrow to open the folder, go down to 'further instructions' and you will find LEN. LEN returns the length of a String.

A quick note on strings. A string is a bunch of characters in sequential memory locations followed by a NULL character. If the NULL character is missing then it isn't a string and string operations will fail. So you might need to be careful if the camera is only sending part of a string.
Thank you for the reply.

I can't seem to find Extended Instructions.

Also, the cameras send an array, then the characters move to string where then the comparisons are taking place.

Thanks,

Stacy
 
Which PLC are you using? I only have access to the S7-1200, so maybe there are differences in the instruction set. You can see Extended in the attached picture.

TIA Instructions.jpg
 
Sorry - please excuse my blonde moment.

I was looking through all of instructions on the website looking for these instructions - didn't realise you were talking about the TIA portal.

Thank you!
 

Similar Topics

Hi all, I would like to introduce my software for emulation of conveyor systems. This programm provides you to create some objects as conveyors...
Replies
0
Views
1,355
Just wondering if anyone has managed to set up safety Comms between two safety s7-300 controllers. With one programmed via Tia portal and one...
Replies
1
Views
2,164
I have been using TIA portal 13 for several projects HMI. The HMI is 1200 panel. On the previous project, I could connect to the PLC and use...
Replies
26
Views
18,727
This is a question for Siemens Step7 Programmers. I'm interested to know how many of you have now taken the leap to using TIA portal and how many...
Replies
13
Views
25,786
hi folks, I want to create a function like IN1 ---> OUT 1 IN 2 ----> OUT 2 However, I want when I call my function, it has an add to insert how...
Replies
2
Views
3,109
Back
Top Bottom