devo.xx Posted October 19, 2012 Report Posted October 19, 2012 So I have come across the many different versions of GREATER THAN (among others) that GXWorks2 ships with. LD> AND> OR> GT(_E) Looks like GT wants "ANY_SIMPLE," and has 2 BITs as outputs. The other ones want "ANY16," and has only 1 BIT for the output. Functionally, the GT is easier for me to insert, because I don't have to worry about "Is this in the AND, OR, or LD state?" But it produces WARNINGS when I convert my ladder. Does anyone have any tips for which of these I should be using? or where one is applicable while the others aren't? The documentation doesn't mention anything about why GXWorks2 suddenly added the GT functions AND retained the LD> type as well... Quote
kaare_t Posted October 19, 2012 Report Posted October 19, 2012 This is simply what you prefer to use. I like to use the operators (GT / LT / AND ++++) since these allow me to use both bits, 16-bit and 32-bit data on the inputs (no mixing of the inputs). I like to always execute the instruction and then execute any optional bits after (in-line with the output). Just remember that IEC functions (functions that end with _E) require the EN input to change the output from it's previous state.This is my personal opinion. What warning does the GT produce? Quote
Crossbow Posted October 20, 2012 Report Posted October 20, 2012 LD>, AND> and OR> are the 3 Mitsubishi commands. The one used depends on the position in the rung. To start a rung, it's LD>. In line after something else it's AND>. To use as OR condition, it's OR>. But when you code in the software in standard ladder, you don't need to write anything other than >. The GT and GT_E are the IEC commands, and can use data types like 16-bit signed, 32-bit signed, floating point, etc. all with the same command. Typically used in structured ladder, these are the IEC compliant commands. Quote
devo.xx Posted October 22, 2012 Author Report Posted October 22, 2012 (edited) Run GT_E with an input variable of type: Word[unsigned] and it will produce a WARNING (not error): No. Result Data Name Class Content Error Code 1 Warning POU_01 Program compile A WORD/DWORD type label is being used in the return value. The instruction used for the generated code will be changed. When using the designated instruction, use ANY_SIMPLE type except WORD/DWORD type.(Ladder Block No.7) C9026 Edited October 22, 2012 by devo.xx Quote
kaare_t Posted October 22, 2012 Report Posted October 22, 2012 Well, it kind of explains itself in the last sentence of the warning: "use ANY_SIMPLE type except WORD/DWORD type" In addition, you said you used the GT and not the GT_E function. I would recommend using the "GT" (without _E) since it's easier to control the output status flag. Remember that with the _EN extension the output is only changed as long as the EN is true. In other words, if you have a high ouput when EN is high, then EN goes low the output will still stay high! This is according to the IEC standard (who knows why....), so I'm always more comfortable with the operators (GT without the EN). If you need logic then simply place it inline with the output of the GT... Quote
devo.xx Posted October 23, 2012 Author Report Posted October 23, 2012 Hmm, this is making my sort of cringe. Does this mean, that if my EN is ON, and then GT_E evaluates to TRUE. If I pull off the "d" line and EN goes OFF, then my "d" line will continue to process? Quote
kaare_t Posted October 23, 2012 Report Posted October 23, 2012 Yes, the IEC standard says that it is supposed to be like that (who invented that "smart" rule...!!??). However, there's more to that statement: The output holds it's previous state if the EN goes low, BUT you can also reset the d variable from another place in the program. In other words, basically what the instruction do is using SET/RESET inside it. When the EN is high, and the instruction triggers the output, it is SET high. Then, when EN goes low the output will still be high caused by the SET instruction. However, since the EN input is low you are allowed to RESET the output from anywhere in the program. This only apply to the comparing instructions for the IEC standard. Solutions if you have a variable in front of the EN input on these instructions: Use the output with SET/RST functionality so that the output variable is reset inside the program if neededMove the variable(s) to be inline with the output (d) on the instruction (instead of having the variable(s) inline with the EN input, move it to be inline with the d output)Use functions/operators without _E (and use any depending variables like step 2), use GE/NE/EQ/LT.....If using StructuredMode, de-select the checkboxes in the Options window in GW2 (NOT RECOMMENDED), see pictureOption 4 is NOT recommended, this will break the IEC rules, it will break the default settings, you will have to remember doing it in each of your projects and so on.... I like avoiding changing anything project related in the compiler since you must always remember to do it in every project. In addition, if the compiler does not operate in "default" mode, the next person debugging it most like will scratch his head for a while when debugging..... I highly recommend option 3. Just get used to using it and you will never have to debug programs with "ghosts". In my opinion there's really no reason not to use these. I addition, it looks cleaner in the program without all the enable inputs. In my programs I often don't really need the EN input since the instruction should always operate, so using instructions without EN actually makes it look and debug better - this is just my personal opinion... Quote
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.
Note: Your post will require moderator approval before it will be visible.