nocturnalz Posted July 1 Share Posted July 1 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: NX1P2-9024DT1 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 ELSE BIO_Output_Bit_00 := FALSE; BIO_Output_Bit_09:= FALSE; END_IF; 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: PROGRAM Main VAR Counter: INT := 0; END_VAR METHOD IncrementCounter : BOOL Counter := Counter + 1; RETURN TRUE; END_METHOD METHOD MainTask : BOOL IF IncrementCounter() THEN // Do something when the counter is incremented successfully END_IF RETURN TRUE; END_METHOD 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. Regards, Ron. Quote Link to comment Share on other sites More sharing options...
DonNH Posted July 20 Share Posted July 20 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. 1 Quote Link to comment Share on other sites More sharing options...
nocturnalz Posted July 21 Author Share Posted July 21 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. Quote Link to comment Share on other sites More sharing options...
DonNH Posted July 24 Share Posted July 24 I at least was able to take Omron's Sysmac training class, but it was a lot to take in within a 3-day period for an old guy like me with no real PLC background. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.