Working with TON() in structured text?
I can successfully get the TON() function block to work with the function block diagram method... however, I can't seem to get it to work using structured text.
I have used the same input and output variables using both methods but when using the structured text method, the ET and Q never change. It is as if the timer never starts. Can someone provide a structured text example of the TON() function in PLCnext Engineer? I can't seem to find one online.
Additionally, if I create a function block program, is it possible to somehow open the "code" behind it? Ie. view it as structured text? It would be helpful to see what is going on behind the scenes as an example.
Thank you,
I have used the same input and output variables using both methods but when using the structured text method, the ET and Q never change. It is as if the timer never starts. Can someone provide a structured text example of the TON() function in PLCnext Engineer? I can't seem to find one online.
Additionally, if I create a function block program, is it possible to somehow open the "code" behind it? Ie. view it as structured text? It would be helpful to see what is going on behind the scenes as an example.
Thank you,
Comments
Even if you initially set the input trigger to high (a rising edge as shown in the help section) if the function does not continue to see a HIGH on the IN parameter it will not continue to run / update the outputs.
You need to think of an IEC task as running on a single thread. If a timer FB instance is not called in the program, the code in the timer doesn't run, and the timer will not "time".
Unlike in some other PLCs, FBD and LD are not converted to Instruction List (IL) under the hood. PLCnext Engineer compiles all languages to a binary that cannot be easily interpreted by people. We do not make the source code of built-in FBs and functions publicly available. The Help system is intended to give enough information to use these blocks.
If you have any other questions, please let us know.
~ Martin.
I have found resources online for other PLC brands which have been helpful, and although the language is "standardized" I think I see some slight differences in maybe how the different IDEs prefer to see instructions. Maybe I am wrong but it would streamline the process of writing structured text in PLCnext Engineer for beginners to see examples. It took me over an hour of trial and error to figure this out.
Thank you,
depending on the function blocks we offer simple examples up to complex application guides.
Built Functions and Functionblocks are according to the IEC 61131-3 specification and there we include normally no additional code examples in the help.
However, I'll give internal the ping that this might be something to improve.
External libraries coming from Phoenix Contact (maybe from the PLCnext Store) does always include examples, as the context of use is usually a bit more special.
Take care,
Frank