Expression for trend help please

bright676

Member
Join Date
Nov 2012
Location
va
Posts
494
for the trend pen I have one integer, N10:80 that can be 0=2, 1=3 or 2=4.

For the expression I have written, if{N10_80}==0 then 2 else is where i am stuck.

I am not sure how to finish it. I tried adding on to the end of it, if 1==3 and 2==4 else 0 but when I check the syntax it says else is missing.

Can some one point me in the right direction?

Thanks
 
Can you not just add 2 to the tag? I loathe FCTMe View, so I rarely work with it, then try to drink away the memories, but you should be able to create a HMI tag with scaling that takes care of this offset for you, then just trend that tag.
 
Just as you need to count your open and close parenthesis, and make sure you have the same amount, you need to do the same with your IF's, THEN's and ELSE's.

Code:
[b][u]IF[/b][/u] ({N10_80}==0) [b][u]THEN[/b][/u] 2 [b][u]ELSE[/b][/u]
so far so good, one of each...
Code:
[b][u]IF[/b][/u] ((1==3) and (2==4)) [b][u]ELSE[/b][/u] 0
...but no THEN for this IF expression!

Also, it will help you to use parenthesis like they're going out of fashion. Put all of your expressions inside them, and where you have groups of expressions (like 1==3 and 2==4) then put the whole group inside another set. Like I have done above. It helps both you (as you're entering the data to make sure you've got everything lined arranged correctly) and also helps the computer, as you are leaving no ambiguity about which order to assess your code in.
 
I got it, I just put add 2 after the tag.
The problem I was having is it is a multi state switch, (selector switch). When you touch the tag you can select one of 2 other bins. All the tag said was selector switch. When you touched the switch it counted up one on a counter 0, 1, 2 for the 3 bins that are labeled 2, 3, and 4. That is what the integer was reading 0, 1, 2, not 2, 3, 4. I could not find where it it was adding 2 to each one, but I'm sure its in there some where. I just made a tag and assigned it the integer.

For making the expression I was trying to figure the if's, then's and equal's and the verify kept giving errors. so I finally put +2 in the expression. It was a simple solution that Rockwell made seem complex.

I wish Rockwell would have made there instructions a bit more novice friendly, as I am learning this all on my own and the help of this forum for which I am forever gratefull.
 

Similar Topics

I'm writing some structured text that's handling a data structure that comes from a PC. The PC structure is in the "new" LREAL 64-bit floating...
Replies
3
Views
481
Good Morning, I've been working on an HMI using the Panel View 5000 series. I admittedly was not very good at Factory Talk View Studio, but I...
Replies
7
Views
978
Hey everyone, I am trying to right an expression in FTView and getting syntax errors. If {[PLC]System.Auto} Then 1 OR If {[PLC]System.Estopped}...
Replies
2
Views
557
I asked this question briefly in my previous post long post, I'm asking again here as the main point so it doesn't get buried. I am pretty new at...
Replies
3
Views
1,510
Hello Everyone, First time poster here. I have run into a problem with testing my HMI program. (I'm using FactoryTalk View Studio ME Edition...
Replies
2
Views
1,358
Back
Top Bottom