Eric Nelson
Lifetime Supporting Member + Moderator
Sorry to say, I'm back at the Mitsubishi stuff again...
Originally, our customer had opted for no operator interface on the machines to save money, so I did the "cheapo" blinking fault lamp to indicate the fault. It blinks a 2-digit code, which they lookup in the manual to determine the fault (similar to a GM automobile's "Check Engine" lamp). Well, they got tired of having to lookup the faults, so now they want to add an operator interface.
My "standard" method of fault handling for use with an operator interface doesn't seem to translate well to Mitsubishi-ish, so I'm just making sure I'm taking the right approach...
I'm using bits M200-M296 to store my individual "fault" latches. They get latched when a specific fault in the sequence occurs, and are used to display the fault description on the operator terminal.
My questions are...
1.) How to know when one (or more) of these bits is set, and
2.) How to reset the entire range...
This is quite a simple task in the other PLCs that I normally use, but seems like a PITA with the FX1S processor. I understand how to group bits together (in 4 bit units) using KnM. IOW, K4M200 gives me the word equivalent of bits M200-M216.
Regarding my first question...
Mitsubishi's compare (CMP) instruction can only be used as an output instruction, so it doesn't lend itself to easily comparing multiple words. In other brands, it's simple...
.
etc., for as many words as needed (sooooo easy!)
With the Mitsubishi, each time the compare instruction executes, it creates a set of 3 consecutive bits (>, =, <) as the result of the comparison. Like this...
.
.
That's all well and good, but I want to look at MORE than 16 bits. Yes, I can look at a double-word group by using K8M200 (M200-M232), but that only gets me a total of 32 bits...
If I execute the compare instruction a second time, it will (of course) overwrite my comparison bits (M500-M503) with the new result. I'm guessing that I'll have to specify different result bits in the additional comparisons? IOW, to check if at least one bit is ON in 3 consecutive words, I'll have to do something like this?...
.
It just seems like a rather half-assed way to accomplish this... Eating up 9 bits just to do a simple comparison? Is this the only solution?
On to my second question... Resetting bits M200-M296.
Normally, I'd just RESET the range, or FILL the range with zeros, but that's not a valid method in the FX-1S. The only way I can think of accomplishing it is to MOVE zeros into each word. As far as I can tell, I can't zero a double word. So my logic would be like this...
.
etc., up to M296
Is this really the simplest method for resetting a range of bits?...
beerchug
-Eric
Note to self: Add Mitsubishi to my list of PLCs I dislike...
Originally, our customer had opted for no operator interface on the machines to save money, so I did the "cheapo" blinking fault lamp to indicate the fault. It blinks a 2-digit code, which they lookup in the manual to determine the fault (similar to a GM automobile's "Check Engine" lamp). Well, they got tired of having to lookup the faults, so now they want to add an operator interface.
My "standard" method of fault handling for use with an operator interface doesn't seem to translate well to Mitsubishi-ish, so I'm just making sure I'm taking the right approach...
I'm using bits M200-M296 to store my individual "fault" latches. They get latched when a specific fault in the sequence occurs, and are used to display the fault description on the operator terminal.
My questions are...
1.) How to know when one (or more) of these bits is set, and
2.) How to reset the entire range...
This is quite a simple task in the other PLCs that I normally use, but seems like a PITA with the FX1S processor. I understand how to group bits together (in 4 bit units) using KnM. IOW, K4M200 gives me the word equivalent of bits M200-M216.
Regarding my first question...
Mitsubishi's compare (CMP) instruction can only be used as an output instruction, so it doesn't lend itself to easily comparing multiple words. In other brands, it's simple...
| WORD 1 > 0
|-----] [-------+-----(FAULT DETECTED)
| |
| WORD 2 > 0 |
|-----] [-------+
| |
| WORD 3 > 0 |
|-----] [-------+
| |
...
.
etc., for as many words as needed (sooooo easy!)
With the Mitsubishi, each time the compare instruction executes, it creates a set of 3 consecutive bits (>, =, <) as the result of the comparison. Like this...
| ALW_ON
|-----] [-------------(CMP K0 K4M200 M500]
|
| M500 <--{Word K4M200 (Bits M200-M215) > 0}
|-----] [-------------(FAULT DETECTED)
.
.
That's all well and good, but I want to look at MORE than 16 bits. Yes, I can look at a double-word group by using K8M200 (M200-M232), but that only gets me a total of 32 bits...
If I execute the compare instruction a second time, it will (of course) overwrite my comparison bits (M500-M503) with the new result. I'm guessing that I'll have to specify different result bits in the additional comparisons? IOW, to check if at least one bit is ON in 3 consecutive words, I'll have to do something like this?...
| ALW_ON
|-----] [-------+-----(CMP K0 K4M200 M500]
| |
| |
| +-----(CMP K0 K4M216 M503]
| |
| |
| +-----(CMP K0 K4M232 M506]
|
| M500
|-----] [-------+-----(FAULT DETECTED)
| |
| M503 |
|-----] [-------+
| |
| M506 |
|-----] [-------+
.
It just seems like a rather half-assed way to accomplish this... Eating up 9 bits just to do a simple comparison? Is this the only solution?
On to my second question... Resetting bits M200-M296.
Normally, I'd just RESET the range, or FILL the range with zeros, but that's not a valid method in the FX-1S. The only way I can think of accomplishing it is to MOVE zeros into each word. As far as I can tell, I can't zero a double word. So my logic would be like this...
| RST_FLTS
|-----] [-------+-----(MOV K0 K4M200]
| |
| |
| +-----(MOV K0 K4M217]
| |
| |
| +-----(MOV K0 K4M233]
| |
...
.
etc., up to M296
Is this really the simplest method for resetting a range of bits?...
beerchug
-Eric
Note to self: Add Mitsubishi to my list of PLCs I dislike...