Syntax help

PLC Pie Guy

Member
Join Date
Jun 2013
Location
Halifax
Posts
1,144
Hey all.
A quick FTV V8. question.

I want to display the value of an integer (Line speed) if the value of (Line Running) is 1. If the value is 0 than display 0. What is wrong with my syntax?

If {Main_Line_Running} == 1 Then {Main_Line_Speed} else == 0

I am trying to show the value in a numeric display.

Thanks
 
If that's correctly typed, you shouldn't have the "==" between "else" and "0"

If {Main_Line_Running} == 1 Then {Main_Line_Speed} else 0
 
I don't know this particular software, but you are not assigning Main_line_Speed or 0 to anything.

I suspect you need something like:

If {Main_Line_Running} == 1 Then
X={Main_Line_Speed}
else
X= 0

Also make sure your syntax is right.
== is usually for comparing, not assigning.
You need semicolons?
You need an end or endif?
 
@Boneless no, you do not have to make an assignment. For an IF A THEN onething ELSE anotherthing expression, the value of onething or anotherthing will be returned.
 
Sorry if I weren't clear.
I am wanting to display the value of mainline speed on the screen.
If the line running bit = 0 I want to display 0.
I am not trying to assign anything.
Simply display the value of the main line speed only if the line is running.

Thanks
 
@Boneless no, you do not have to make an assignment. For an IF A THEN onething ELSE anotherthing expression, the value of onething or anotherthing will be returned.

OK, thank you! :). I have been spending to much time playing with my Arduino ;).
 
If {Main_Line_Running} == 1 Then {Main_Line_Speed} else 0


This is the winner. The issue I had was for some reason the project did not like being referenced to an actual input (main drive running). Once I made this tag look at a B3 bit all is well.

Thanks
 

Similar Topics

Hello all, first time poster here! I have a toggle button "REVERSE_ENABLE_BUTTON" on our HMI's that disables our "bad product rejections" by...
Replies
4
Views
2,175
Hi there all. I am VERY new to PLC's and my team seems to be stumped by a ladder syntax error. I feel like this is a specific error that wont...
Replies
2
Views
2,140
Hi everyone, I'm trying to write an expression in the indicator field of a multistate indicator but it doesnt matter what i do it isnt giving me...
Replies
1
Views
1,663
Can anyone help me with proper code syntax for setting or stuffing the value of one tag into another (PLC = HMI tag). I have FactoryTalk SE...
Replies
7
Views
2,689
I am using 64 bit IO cards and want to move IO bits to MW. Could someone please help with syntax. It does not have to be Ladder. FBD is also fine...
Replies
4
Views
1,607
Back
Top Bottom