Search the Community
Showing results for tags 'st'.
-
I am playing with sending ASCII string commands back and forth between my CP1H and another device. I learned first how to do it using ladder and now that I'm getting into more advanced stuff (parsing, searching for certain chars, converting to INT, ect) I want to do it in Structured Text because the ladder for this gets hard to follow. My very first experiment (count string length) throws an error at me: It apparent takes exception that I've use the "STRING" data type But it this works just fine in ladder: So am I really not allowed to use STRING data type in ST on CP1H or am I doing something wrong?
-
Hello, I would like to address D memory addresses dynamically with GX Works2. To move data from data field elements to individual data registers. For example, "D[i+1000] := MyArray". Is there such a possibility? The programming language is ST.
-
Hello, I would like to address D memory addresses dynamically with GX Works2. To move data from data field elements to individual data registers. For example, "D[i+1000] := MyArray". Is there such a possibility? The programming language is ST.
-
Hello fellow members, It’s Beaning a wail that I have post on this form. But i need some help. I have experience with programming plc in ladder and function blokes. But not whit structured tekst. I have made a recipe so that the machine can switched easy to divert parameters. No I have problem whit the ‘default settings’ for some parameters that van be de basic when something goes wrong. Can anyone tell me wot I do wrong I have sent son screenshot to help you understand what I mean. Thank you in advance Device varible to device is not a problem Not varible to device is a problem For example what i mean whene I make it in ladder.
-
Hello. I am writing a function block and i am getting the following error: ERROR: STRING type or an Input Output variable is not supported by the PLC of this unit version. Check the unit version in program check options. When i try to remove the string i get error: instruction is not available for current plc Is there somewhere where i can see which instructions i can use? Or is it not the string or one of my in or outputs I am doing something wrong with? Kind regards, Ralf
-
Hello, I have a problem that I need to solve in a PLC program has it's projectlib locked. I work for a company that contracted a PLC programmer before my time to program their new version of their control cabinets. The company did not write any specific contract with the contractor and just relied on his work. The guy later delevered a buggy software that is kind of functional (the bugs came up at the commissioning after the guy was paid and now he refuses to help or to provide more consultations). I have as a task to freshen this up and make it work without bugs, the problem is that the Projectlib is locked and I cannot access the source code. The only thing that I can changes that I can make to the code is to put some logical circuits between the I/O of the already existing function blocks, which solved some problems, but not all and it keeps one of the most important ones as well. Anyways, that's my story, so now my question is, is there and possible way of unlocking the projectlib? Any feedback would be highly appreciated. Thanks in advace!
- 11 replies
-
- fx5u
- mitsubishi
-
(and 3 more)
Tagged with:
-
Hey guys I am strugeling with how to code a autotune algorithm in Gx Works 2 structured text. Does someone have any useful information or code to lend me, this is for a school project please help
-
Dear Sir, In order to help people to learn Structured Text programming I have written and public the book "PLC Controls with Structured Text (ST): IEC 61131-3 and best practice ST programming” The book can be used for all PLC brands, including CODESYS, Delta PLC, Beckhoff and Siemens Get the book in English, Spanish, Arabic or Danish versions Used for higher educations in Denmark More than 1000 sold world wide! The book provides systematically by describing the basic programming, including tips/advices and 25-years practical experiences from the author. CONTENTS - Background, advantage and challenge when ST programming - Syntax and fundamental ST programming - Widespread guide to reasonable naming of variables - CTU, TOF, TON, CASE, STRUCT, ENUM, ARRAY, STRING - Guide to split-up into program modules and functions - More than 90 PLC code examples - FIFO, RND, 3D ARRAY and digital filter - Examples: From LADDER to ST programming - Guide to solve programming exercises ISBN: 978-87-4300-241-3 (Paper Back, English Edition) ISBN: 978-87-4300-242-0 (Paper Back, black/white, English budget Edition) ISBN: 978-87-4300-636-7 (eBook, English Second Edition) ISBN: 978-87-4300-637-4 (eBook, English First Edition) ISBN: 978-87-4300-843-9 (Paper Back, Arabic Edition) ISBN: 978-87-4300-957-3 (Paperback, Monochrome Arabic Edition) ISBN: 978-87-4300-909-2 (Paper Back, Spanish Edition) ISBN: 978-87-4300-995-5 (Paper Back, black/white Spanish Edition) ISBN: 978-87-4309-932-1 (eBook, Spanish Edition) ISBN: 978-87-4300-097-6 (Paper Back, Danish Edition) ISBN: 978-87-4300-895-8 (O-Wire, Danish Edition) ISBN: 978-87-4300-517-9 (eBook, Danish Edition) (Google the ISBN number to find bookshop near you) FEEDBACK Daniel Berggren, Application & Support Manager, Lenze Nordic (Finland) “Truly a good one. We at Lenze use ST as main language and have invested in this book. We use it for both internal use as well as selected customers” Students at AP Graduate in Automation Engineering (Denmark) "What could we have done without your book?" Review: Edison yu, Work as an automation engineer (China) “Thank you for the great book, that will have people to write more powerful and useful PLC program. #PLCProgram,#LearningPLC” Torben Kjaer, Managing director, Alsinger Integration (Australia) “Have been using the book for referencing on a number of occasions, great asset to have in your tool bag. Thank you Tom for creating this book, great benefit to the general industry” Peter Paul Dallmann, Automation system and industrial support (Denmark) “I have got your book and have to say that it is the first one that comes close to the point. For our in house training your book will become a “must read”.” Pedro Jose Barretto, Bachelor Degree in Instrumentation Engineering (India) “I have purchased this book and am using it to train myself in PLC applications requirements having ST programming. A High recommend to Engineers involved with PLC controls, design and Applications using ST programming.” Jakob Sagatowski, Software Engineer at European Southern Observatory (Germany) I just wanted to say that you are doing a great job with your education material for the field of automation. I've recommended your PLC-book for two friends that want to switch industry and start within the world of automation Carsten Damkjær Jensen, Lecturer, University College Lillebælt (Denmark) “We use the book on training module (OB1) in Automation & Operation. Nice book about structured text programming for beginners/mid level”
-
Hello. I'm having difficulties of how to write REAL constant in ST. For example (Gap1 is defined as REAL): Gap1:= UDINT_TO_REAL(P_Cycle_Time_Value) / +1000.0; RETURNS ERROR ERROR: Conversion cannot convert from Integer Literal to REAL I have also tried 1000.0 If I use: Gap1:= UDINT_TO_REAL(P_Cycle_Time_Value) / INT_TO_REAL(1000); COMPILES OK My question.. How do I write REAL constant in Structure text? I don't want to use INT_TO_REAL anytime I want to do calculations with constants.. Thanks. BR.
- 1 reply
-
- structure text
- st
-
(and 2 more)
Tagged with:
-
Hello. I am trying to develop some structured text POUs in Gx Works3 (function or function block) which are to do some calculations over array. Say it will be crc32. So I need to pass an array to such POU. It would be very nice if POU could work with array of arbitrary size. I have found some built-in functions which take arrays and their respective arguments have type of ANY16. But when try to declare an input variable of type ANY16 and use it with indexer I get the compile error that it is not an array. Also I tried to declare input variable as an array of the size of one element. It compiles but does not work. As I understand, there is an index register that can help solving such problem but I have no idea of how to apply it to arbitrary input parameter. Does anybody know how to iterate over an array input parameter and how to declare it properly?
-
Hello group. I am practicing ST programming and am doing this by converting an existing Ladder Logic program into Structured Text. I have created the following attachment and I can see my BOOL objects change state when I touch the respective buttons on my HMI. The issue I am having is the Accumulating Timer will not start timing when the conditions are met. Can someone with experience in ST advise me what I am missing or doing wrong. Thanks
-
Hello all, I'm quite new to PLC programming, but having learnt digital electronics and programming in PASCAL and C in the 90s, I'm trying to implement a Finite State Machine within an FX5u PLC to control an industrial automation. If it was something for myself that wouldn't require flexibility, I hard-wired it using logic gates, a counter, and latches for inputs and outputs, done several Karnaugh diagrams to simplify the circuit, and so on. If it did require flexibility and it was for a hobby, I'd probably gone for an Arduino or a simple program running in a raspberry pi. However, and since it's for work, I have to use the tools that my fellow co-workers use. Now, in my company they use mostly Mitsubishi PLCs, but they tend to program everything in ladder and using huge, complex programs which are a pain to trace and debug, with a very slow execution time. They also tend to program in iterative steps, but they rely on a clean initial condition (meaning: if there is an error or a power cut, the operator of the machine must empty the material from the automation, home the robot, even reset all the cylinders to their initial positions (with a homing program activated from the HMI), and then restart the machine. To prevent that, and make it more user-friendly, I'm thinking to implement a modular finite state machine where the different modules for the machine (material loading ports, doors, conveyors, robot) are all interlocked together. Having a background in PASCAL programming, it seems like going with ST language will be easier for me to get started in PLC programming. To begin, I've declared a series of global variables for each module, called STATE_<module-name>_CURRENT and STATE_<module-name>_NEXT, all of them set as unsigned int words, so they can store an integer value and I can use them with a CASE statement. Now, for clarity, I was planning on using global constants in those CASE statements. So, if I declare the constant ST_MACHINE_INIT as unsigned int word with value 0, typing ST_MACHINE_INIT should be the same as typing 0 in the CASE statement, and if ST_MACHINE_MANUAL_MODE is declared as a constant with a value of 1, it should be the same as typing 1, right? at least, in PASCAL (upon which the ST language seems to be based) would work like that. I have checked several manuals from Mitsubishi, but I didn't find anything in regard to that. They only say: CASE <variable> OF <value1>: <statement1>; <value2>: <statement2>; END_CASE; However, I've noticed that when I use a constant as value1 (declared as global labels with an unsigned integer value, same as the variables), GX Works 3 is giving me syntax errors after OF and after the statements (represented as ~). CASE <variable> OF~ <value1>: <statement1>;~ <value2>: <statement2>;~ END_CASE; If I replace the constant by the integer value, the syntax error goes away. It seems, then, that GX Works is not accepting constants as values. Is that the case? I prefer to use constants or variables with a fixed, known value instead of just typing the integers for code clarity and because they allow for posterior modifications easily. Does anyone have experience in this? Thanks.
-
Hi, I can’t find an answer to the following and I was advised to ask it here.I’m programming an Omron CJ2M with an MD212 high speed I/O card. I usually do all my programming in Structured text, simply because I like it a lot over ladder or sft.Now, if I want to read the hight speed counter (incremental encoder), I have to make a ladder section and use the PRV instruction to store the present value in a chosen location.The manual says the current PV is stored in A271, but I can’t get a readout there. Apparently the only way to read it is through this instruction.Does anyone know if there is an equivalent to the PRV instruction for Structured text? or another way perhaps? Again, when I check the actual memory adress, there’s no value there withouth the use of the PRV instr.
-
Hi all, I'm making a program for Delta AS228-T using ST and I want to use the pulse instruction . Is there an analogue for LDP instruction from IL for ST? Or is there another way to replace this instruction somehow? Thanks.
-
Hello, I am new to SCL programming in TIA Portal. I have some experience in TwinCat3, but i have difficulties getting som simpelt code to work in TIA. This code works fine in TwinCat, but i does not work in TIA. "Timer".TOF(IN:=NOT "Timer".Q, PT:=T#2s); "TimerOneShot"(CLK := "Timer".Q); IF "TimerOneShot".Q THEN "Test" := "Test" + 1; END_IF; Can anyone help me in the right track.... ??
-
Hi. This regards ventilation. A room has two air inlet dampers (pretty much like a big air valve in a ventilation duct). Only one is used at a time to regulate temperature in the room, and the other is then closed. When switching the inlet of air from one damper to another; i have not decided what method to use yet. I consider splitting the regulator output in two and let the one damper ramp down to this value, and the other ramp up. When these values are reached one ramps up to the full regulator output and the other to zero. Not quite sure this is the best solution, and the code is not written yet :) Anyone done anything similar or has suggestions? Cheers!
-
- st
- structured text
-
(and 2 more)
Tagged with:
-
Sysmac Studio Failed to write variable in ST
Dantesauron posted a topic in NJ Series / Sysmac Studio
Hello: Im new on this foroum, and Im glad to become a member, and new on the Sysmac studio too . I have the following ST program line: My_array[0]:= y[0]; Where My_array, is a array of bool, and y array too. After load and all, on monitoring return a "!" Sign, and trying to change value retuns "Failed to write variable, check if variable or memory area are alloed to write". I tried to move both arrays from global to local, and change adressing in "AT" field, witout changes. Any help will be wellcome. Thanks in advance Dante- 2 replies
-
- sysmac studio
- array
-
(and 1 more)
Tagged with:
-
Hi everybody I'm trying to create a code to count an absolute value from my Q64AD module. I found absolute value function ABS, but its working somewhat strange, and i do not see the difference between real value and absolute value. Then I created a timer for an absolute value with some mathematics: SUM1:= SUM1 + napr1; Nsum := Nsum + 1; IF timer_sr.Q THEN timer_sr(IN:= NOT timer_sr.Q , PT:= T#100ms); outsr := SUM1 /Nsum; Nsum := 0; SUM2 := 0; END_IF; where napr1 - is value from Q64AD module ch1. It worked on codesys, but not working here. Data type of sum1, napr1, nsum is Word[signed]. In codesys Nsum was INT type. What's the difference and what i did wrong?