How do I use a FB in Structured Text on Omron

theColonel26

Lifetime Supporting Member
Join Date
Feb 2014
Location
West Michigan
Posts
792
I've wrapped a Function Block around a OneShot/R_TRIG and I want to use it in structured text.

I have an Input bool called In and a Output called Out. My FB instance is called OneShot1.

However I am getting these errors
  • unexpected syntax for the '.'
  • Undefined identifier 'Out'

Code:
OneShot1(In:=Running);
If OneShot1.Out = true Then

END_IF;

The FB Logic
attachment.php


ST using the FB
attachment.php


SB-BEN 2016-12-15 - 09-04-54-001.png SB-BEN 2016-12-15 - 09-06-51-001.png
 
https://echannel.omron247.com/marcom%5Cpdfcatal.nsf/PDFLookupByUniqueID/AE0D88A3A45ED8DE862575A700707901/$File/CX_programmer_V8.1_manual_en_200902.pdf?OpenElement

Check out the following SECTION 3 - Creating Function Blocks
You should have a variable table as well.

Hope this helps you out.
Regards,

Yes I have already declare an instance of FB OneShot as OneShot1.

It appear after deciphering this terrible documentation that you have to put an output variable in your call. You can't access the instances output varaible directly.

Way to follow standards omron.

Code:
OneShot1(In:= Running, Out=> OS_Out);
 

Similar Topics

Is there a way in CX-Programmer to call Ladder Instructions from a structured text program? I can see several functions in the autocomplete...
Replies
3
Views
2,323
Is there a way in CX-Programmer to call functions from a structured text program? I have found this manual that seems to describe the process...
Replies
1
Views
1,241
I have an array of DINTs that I am going to use the bits of for alarms. Trying to use a loop in structured text to make my life easier (120...
Replies
5
Views
248
I´ve being trying wrap head around FOR loops.. When and what can this be used for? I´ve mostly seen it move data, resettting arrays etc. I made a...
Replies
14
Views
890
Hi! When is CASE preffered? CASE uses a numreric variable for the cases and doesnt handle BOOL, but this can be done with numreric and bool using...
Replies
4
Views
374
Back
Top Bottom