Jump to content
OMRON Forums

Basic setup for ST development project


Recommended Posts

Hi everyone,

I'm new to PLC development, specifically, this question pertains structural text program-only workflow.

I’m currently trying to get together a basic workflow for creating a structural text program-only based environment in Sysmac Studio.

 My setup is:


Sysmac Studio v1.54

Windows 11 Pro


I’ve been able to create a new project -> delete the default ladder program0 -> add in a new ST program0 -> and pasted the following:

IF (InputSignal = TRUE) THEN

            BIO_Output_Bit_00 := TRUE; // Turns on '00' output

            BIO_Output_Bit_09 := TRUE; // Turns on '09' output


            BIO_Output_Bit_00 := FALSE;

            BIO_Output_Bit_09:= FALSE;


And I can add in an HMI with a linked-InputSignal button and linked-BIO_Output_Bit_00 and it will simulate with no issues.


However, I’m trying to achieve a basic hello world-like skeleton ST base script where there is a program entry, variable declarations, etc.

In C, it would be the equivalent:


#include <headers>

#global variables here…

int main()
               # some local variables

               # main code, etc…


In the case of Structural Text, I’ve been reading online and seeing in tutorials, the basic program appears to be:


    Counter: INT := 0;

METHOD IncrementCounter : BOOL
    Counter := Counter + 1;

    IF IncrementCounter() THEN
        // Do something when the counter is incremented successfully



However, when I try to add this code or anything similar, Sysmac Studio does not recognize the PROGRAM or VAR/END_VAR or METHOD/END_METHOD keywords.

I’ve gone into more detail in W501 – NJ/NX-series CPU Unit Software User’s Manual but it provides usage details for the different variable types, constructs and expression definitions etc.

There isn’t details on how to set-up a generic program and how to implement it into a new project. Is there any literature separate from W501, are you able to provide an example ST project script that can demonstrate what I am trying to achieve?

My guess is that it should be possible – I’ve seen MATLAB generated PLC ST code that uses the VAR/END_VAR, FUNCTION_BLOCK/END_FUNCTION_BLOCK etc keywords and simulated with no errors. Probably an implementation detail on my end(?).


Please and thank you – much appreciated in advance for your help/assistance. 



Link to comment
Share on other sites

  • 3 weeks later...

I see this question is a couple weeks old, so you've probably figured things out already . . . 

I'm a newbie also - trying to get up to speed with an NX1P2 and an NX102 to communicate with and control a mobile robot.

My understanding of the variable definition part of the program is that this is basically handled behind the scenes based on the variable definitions created in the Variables window, within the I/O map, or on-the-fly in the program.

So far I've managed to make some lights go on and off on a breadboard setup with the NX1P2, and turn a couple conveyors on and off with the NX102. Struggling a bit to get the NX102 to talk to the LD250 robot so far.

  • Thanks 1
Link to comment
Share on other sites

Hi DonNH,

Thank you for replying - much appreciated. Yes, you are correct on the variable definition/declarations and workflow. It took a long struggle to get myself up to speed in understanding how the development flow iss in Sysmac. My mistake was that I thought that ST was a well-defined IEC standard (I think I came across two other videos where the softwares used a similar structure in declaration and code paradigm) - so I thought Sysmac would be something similar. I also kept thinking along the lines of a standard C/C++ type coding scheme.

'Love the software and love the environment now that I'm becoming accustomed to it. BUT I'm still a newbie. Good luck in your work and all the best.



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...