Search the Community

Showing results for tags 'structured function'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Found 88 results

  1. Hello. How can I get bit addressing of defined variable in function block? For example: - I define variable type DUINT with name Double_VarI_INT. - I want to get or set one bit out of it (its double word). - If I use Double_VarI_INT.0 I got error. Best regards.
  2. Gx Works 2 ve fx2n için bir fonksiyon kütüphanesine ihtiyacım var. Servo ve step motor kontrolü için.   thank you
  3. Struct as FB input

    Hello,  I am trying to define a struct as an input variable for a Function or Function Block. For example the function AddDelimiter (This is a standard Sysmac function), has a input variable with the variable type Struct, an it is possible to couple a struct to this input (See picture below). If i try to make my own function block with a struct or Structure as an input data type, i get the following error (See picture below). When I try to define a struct from the data types (In this case struct: Test) it doesn't give a error. But when I try to couple a struct to this input, that is a layer deeper than the function block struct i get the following error (See picture below). How can i define a struct as an function/ function block input? Thanks in advance.
  4. Hi, I am searching for a  Possibility to Set bits in Set or Reset State. How can i do that? in Example the Code in LD: and in ST EQ_E( Merker79 AND Referenzfahrt_TP_Ein_Aus = TRUE , bDummy , P_Achse_Istpos_pulse , 0 ); PLS( bDummy , Drehrichtung_P_Achse AND M8140 AND Loeschen_Positionszaehler_Achsen AND Startpos_anfahren_nach_Referenzi AND P_Achse_Referenziert = TRUE );
  5. Hi, I Have some Problems with this Function Block written in Codesys ST: Variables: FUNCTION_BLOCK FB_Powder_Test VAR_INPUT     bEnable: BOOL;     bPowder_On_Button: BOOL;     bPowder_Test_OnOff: BOOL;     iTime_Powdertest: INT; END_VAR VAR_OUTPUT     bReset: BOOL;     iActual_time_powdertest: INT; END_VAR VAR     PowderTest_Ton: TON; END_VAR Function Block: IF NOT bEnable THEN     bReset := TRUE;     PowderTest_Ton.IN := FALSE;     iActual_time_powdertest := 0; ELSE     IF bPowder_On_Button THEN         PowderTest_Ton(IN := bPowder_Test_OnOff, PT := (INT_TO_TIME(iTime_Powdertest) * 1000));         iActual_time_powdertest := REAL_TO_INT((TIME_TO_REAL(PowderTest_Ton.PT) - TIME_TO_REAL( PowderTest_Ton.ET)) / 1000);         bReset :=  PowderTest_Ton.Q;     END_IF END_IF and GX Works3  Variables: bEnable                                  Bit                        VAR_INPUT bPowder_On_Button            Bit                        VAR_INPUT bPowder_Test_OnOff          Bit                         VAR_INPUT iTime_Powdertest                Word [Signed]    VAR_INPUT bReset                                    Bit                        VAR_OUTPUT iActual_time_powdertest    Word [Signed]    VAR_OUTPUT PowderTest_Ton                  TON                     VAR   Function Block: IF NOT bEnable THEN     bReset := TRUE;     PowderTest_Ton.IN := FALSE;     iActual_time_powdertest := 0; ELSE     IF bPowder_On_Button THEN         PowderTest_Ton(IN := bPowder_Test_OnOff, PT := (INT_TO_REAL(iTime_Powdertest) * 1000));         iActual_time_powdertest := ((TIME_TO_INT(PowderTest_Ton.PT) - TIME_TO_INT( PowderTest_Ton.ET)) / 1000);         bReset :=  PowderTest_Ton.Q;     END_IF; END_IF; I have this Error: No.    Result    Data Name    Category    Content    Error Code 1    Warning    FB_Powder_Test    Syntax Check    Convert data type from INT type to REAL type automatically.    0x11042FD4 2    Error    FB_Powder_Test    Syntax Check    Data type of argument does not match.    0x11041F61    
  6. Hi, Many Programms we have are written in Codesys and in ST Language  and now we have a FX5U and I'm trying to Convert some of them. But the both Systems are different, I miss the Librarys like util.lib and FB like RAMP_REAL, BLINK, LIMITERROR which are in Util.lib. Are there Librarys like util.lib for GX Works 3 ? Is it possible to convert Ladder to ST? (I dont have any Idea from Ladder and I'm new in Programming)  Have someone Sample Programms for me for Training?
  7. Anyone ever used a Wait-for digital tag in a C Program? I have to use C in the Red Lion Programs.. but, I'm not at all proficient in C (or anything else for that matter ..) Here’s a nice problem for basic C programming .. I really need to solve it .. but, so far ... can't ... sigh!: I have an actuator that will be commanded to make sine wave motion.  The program that does that, in the actuator’s driver-controller, requires the actuator to first be in a zero position.  Homing has already been done, so the drive knows where the actuator is.  I cannot modify the sine wave program; but, can command a Move Absolute program in the drive, to take the actuator to zero, if it isn’t already there.  When the actuator is at zero, it is “In position” and a digital tag will go True. If the Tag is False, the actuator is not at zero, it’s at some other position,  and only the Move Absolute program can return the actuator to zero. So, when launching this position command program, In a Red Lion G3 HMI, using only Basic C programming, how would you write a control program that would test the status of the actuator’s position, and, finding it at zero (the “InPos” tag is true) would start the Sine Wave program.  And, If the “InPos” Tag is false, would start the Move Absolute program, which would return the actuator to zero, and when the actuator is In Position, would start the Sine Wave program. Here’s the tricky part. It will take only a few milliseconds to start the Move Absolute program (if required) .. but how do you get the “C” control program you are writing, to wait until the actuator actually reaches zero, and the “inPos” tag goes true … which could take several seconds? I don’t believe there is a WaitFor function in “C” , and you cannot send either the Move Absolute, or the Sine Wave program more than once .. so, if a loop is used, it can loop only one time .. presumably with conditional delays. (however that's done)  You cannot use Sleep().. that would be cheating.. the full program must run in the least amount of time, and you do not know how far the actuator is from zero. You could use if (! InPos) or if (InPos) to qualify what programs to run .. but, where does the “Wait for In position”  fit into C Programming?  You might be able to use Continue .. but, ya still have to wait for “InPos” to go True…..before running the Sine Wave.       Thanks Much, Regards, Michael
  8. KEEP in ST

    Hi, I have a fairly easy assignment for a school project that has the following components:  -1 impuls start switch  -1 impuls stop switch  -2 El-motors When you push start one motor is suppose to run. Then you push stop and it stops. The next time you start the other should run. Only one motor shoud run at the time.  I solved this using a KEEP function in ladder logic. But I want to be abel to do the same thing in structured text. So my problem is that I cant fint anything to replace the KEEP function. Any help would be much appriciated.  
  9. Structured Ladder

    Need Help! I uploaded structured ladder program into FX3S PLC. But When I try to read it from PLC it says the program cannot be opened. 
  10. Profibus Function Blocks for Q2ASCPU for Melsec ST Lite RIO inter-connection. Please assist in advising the attainment of such blocks - if any existing. Thanks
  11. Hi All, I'm still quite new to Unity and Modicon PLCs. I have a PLC program running in simulation mode for development/test and I'd like to follow the logic inside a running block. I can't seem to just double click the function block while online to see it's 'inside' logic. Is there a way to inspect the inside of a running function block? How can I check and diagnose the logic a running function block? Thanks!
  12. ESATR / EGATR Commands

    Good morning folks, I've browsed this forum often enough over the past few years that I think it's time I finally signed up.  Lots of good ideas and advice that I've benefited from and I hope to return the favour some day. So on to my question.... I'm currently knee deep in a project using a CJ2M PLC and I have to send and receive chunks of data over Ethernet/IP.  To do this, I'm using the ESATR and EGATR commands (set / get attribute).  I would like to know if these commands finish execution (ie. the ethernet port completes the transaction) even if the input conditions to the command are no longer true.  Specifically, if I use the "port ready" system flag (A202.00 is an input to my FB in this case) as a condition to trigger the ESATR command, this bit will go low once the port becomes busy (ie. during execution).  So will that interrupt the completion of the ESATR command resulting in an incomplete transaction and data loss?  I've looked through the help files on the command but don't get a clear picture of how it behaves. Perhaps the attached JPEG shows more clearly what I mean. Thanks, PC
  13. Hello,  I am working on a project to connect a PLC (Micro820 by Allen Bradley) to a simple RS-232 alphanumeric OLED display. I am not too familiar with structured text language, but I have worked with micro-controllers that use similar high-level languages (mostly C-based).  My question is: is it possible to use connected components workbench to program my Micro820 to output ASCII commands to an off-the-shelf RS-232 alphanumeric display? Are there libraries that make life easier to do this?  I welcome any recommendations to related reference material or command tutorials, thanks!
  14. Good afternoon,   I need to convert a UINT (16-bit unsigned integer) to a DINT ( 32-bit signed integer).   Apparently we can't directly assign a UINT variable's value to a DINT's or vice versa. I also couldn't find a way of casting UINT as DINT.   The reason why I need to do it is because I'm receiving data from a socket. The RXLength is a UINT but in order to scroll through  the data array (USINT[1..1])  I need to use a DINT as the array's index, but I can't compare the array index to the array's length because they are incompatible types.   Is there a cast statement similar to:       myDINTvar := (DINT) myUINTvar;   I also tried the following but it didn't work:       myDINTvar :=  (myUINTvar * 1);   Any help will be deeply appreciated.   
  15. I am very knowledgeable with RSLogix5 and RSLogix500, but want to become well-versed with RSLogix5000 advanced algorithms, strategies, and program types—(Ladder, Sequential Function Charts, Function Block Diag, Structured Text), and motion control, such as servo-controllers. . . mostly interested in structured text. I’m also interested in the nuances of RSLogix5000, ControlLogix & CompactLogix regarding design, on-line programming, and off-line programming, etc. Can anyone recommend a course or courses that cover this subject matter? Thanks!
  16. In Part One of the Question: "Can the Omron NJ CPU make the Random Sea?"     There were some fine opinions about that.   This example is what it looks like using Red Lion, Delta Motion RMC75E and LinMot:  https://www.youtube.com/watch?v=SQd6YzBWVvI Recent edit:  The "Big Trycky Omron Question was asked many, many times not shown on this Forum.   I had a very difficult time getting a straight answer from many people at Omron and LinMot.  Probably because they really never tried to do it.  By  the end of THIS thread ( part2 ), Thanks to innoaloe I know that the NJ can generate the position signal, as streaming position data with no time limit, and produce a "randomly" generated model of the ocean's surface.  The "random" part isn't added yet, but, it will work... and the LinMot part isn't added yet .. and it is still unknown if that will work.            
  17. Hi, can you help me how to make program indirect address for plc omron? I use PLC CP1E Thanks
  18. Hi... Trying to keep it simple: Want to make a G5 incremental motor wiggle, CW/CCW in a sine wave motion, Thought this might work:                                                   The variable,  "Angle" is REAL, Phase1 is REAL, AMP1 is LREAL, CSINE is LREAL .. Sysmac doesn't like "Angle" in the FOR statement .. Anyone know why..? Thanks Much, Regards, Michael
  19. can you help me? bring me some example to build function block program with Gx Works? I use Q02U CPU   thanks
  20. where are the FB libraries

    Hello, Im looking for the in built function blocks, but i cannot find it in the program files/ omron folder where the manual says (even with search for *.cxf), perhaps i dont have it installed, but where can i get them from? As i remember i downloaded cx-one from the official omron web page after login etc, so thats why i dont understand why am i missing the fb libraries What else place there is to find useful FB-s? Thanks!
  21. Hello.   A colleague sent me a screenshot (attached) with a peculiar issue. An ADD function that only sends 0 as the outcome, and a DTOS function that only sends " . I have confirmed that all variables used in the ADD block are declared as integers, and both SumInt6 and String10 are not currently being modified somewhere else.  This impatient colleague is baffled, while I am just sharing this issue in the hopes that someone will eventually come with the simple answer that we are overlooking, or a complex one that we could never hope to realize by ourselves.   Thanks in advance.
  22. Unable to Monitor in GXworks2

    Hi! Anyone can help regarding this issue. I'm not able to monitor the Motor Block that I have created. there's no error either in the output screen but i'm thinking what is the cause of not running in the simulation which shows the Motor Folder RED  even it was compiled. thanks for the help!     Note: I'm new in mitsubishi.
  23. Function block self-made

    Hi, i want to make a function block which will contain a block GP.CPRTCL (for predefined comm protocol). GP.CPRTCL has an input "Un" who only receives constant (H,K). On input of my own function block i can set a constant variable, but inside block that variable isn't a constant anymore (GP.CPRTCL doesn't recognize a variable). Is there a way for receiving constant variable in GP.CPRTCL block ("Un") if it is in another block. Regards
  24. Beckhoff PLC Counter

    Hi everyone, I need some help with my PLC programming. I am currently using a twincat 2 software and a Beckhoff CX 8090. Basically, the gist of my program is to send and receive data and datalog the input data received from the sensors and timestamp the received data for every 1 second. I want to create a boot up counter where it will count the number of times my data logging program has restarted(if it did). This boot up counter serves as a health monitoring check to ensure that my program is running perfectly and thus, not restarting randomly when it shouldn't. I am more familiar with structured text so if you have a solution, kindly post it in structured text form. Your help would be greatly appreciated. Best regards, DeadPool
  25. Hello. I'm trying to use index addressing inside function block.  The command *D200 doesn't work. Is it necessary to use IR0, ID0,... inside function block? Thanks. Best regards