SCL combining output tag and temp tag

dwoodlock

Lifetime Supporting Member
Join Date
Nov 2012
Location
Cincy/nKY
Posts
565
Hello all,

trying to write a FB to handle cam outputs, and my typical method of "do what I would do in VBA" isn't working this time.

I was hoping when I called the block the output array would be displayed individually so I could attach physical output to each one, but it doesn't work that way.

I then thought perhaps I could combine a temp value and a output value and generate the output that way, but losing that battle too.

any suggestions?

cams logic.jpg
 
I defrosted my brain and came up with a way that does work, I was wanting to combine it into the for loop......... because I'm picky.

//for cams 0-9 if the press position is GEQ the start and LEQ the end then the "cam output" is true
FOR #x :=0 TO 7 BY 1 DO
#"cam output"[#x] := (#"press position" >= #cam[#x]."cam start" AND #"press position" <= #cam[#x]."cam end");
END_FOR;
//set outputs
#"cam 0" := #"cam output"[0];
#"cam 1" := #"cam output"[1];
#"cam 2" := #"cam output"[2];
#"cam 3" := #"cam output"[3];
#"cam 4" := #"cam output"[4];
#"cam 5" := #"cam output"[5];
#"cam 6" := #"cam output"[6];
#"cam 7" := #"cam output"[7];
 

Similar Topics

HI i would like to know how to get a variable that will store the amount of times a program has been executed. The issue is I have 3 DBs for 1 FB...
Replies
2
Views
63
Hi, I have an intermediate-advance knowledge of programming with TIA Porta in Ladder, would you recommend me to start learning SCL for it to...
Replies
11
Views
551
Hello nice to meet you, im new in here, I'm currently trying to convert code written in STL for a S7-400 to SCL for an S7-1500, because when i run...
Replies
5
Views
314
Hi everyone, I am new to this amazing world of PLC, well... I mean, in practice, since I already knew electronics, programming languages, IT, and...
Replies
7
Views
650
Hi all, This is my first post; I am new to PLC Controls stuff and English is not my native language, so I apologize in advance if something is...
Replies
4
Views
510
Back
Top Bottom