GX developer: MOVP command. Why is D445 not 18,000?

The reason is that as it is a MOVP (in other words only moves for one scan when SM400 is true) it will only move that value into the D register on PLC start, again this is weird, not what most would do rather than using the always on contact & a pulse move it makes more sense to do it as expected i.e. use SM401 (I think that is the first scan bit only on for one scan when PLC is powered up & goes from stop to run) then just use a MOV.

Also see attached, my version of an increment/decrement it's simple.
The first rung compares the Max Speed value with the current & if it is less increments the speed required by 1 if the inhibit is not active every second (could use anything i.e. create your own pulse with a timer to set the speed it would increment at or even have a delay on timer so initially if the button is held it increments at a particular rate i.e. 1 second intervals and if held for X seconds then increment at a rate of 3 or 4 per second or what ever you wanted,
Note: incrementing more than one at a time would require ADDP instruction rather than increment. that only increments the word by one.

Inc_Dec.png
 
Not sure what data type D is and I am guessing K is constant, but it is mostly likely being used somewhere else and this is due screen/software refresh rate
 
D type is a Register (16 bit) 32 bit is two registers i.e. D480 + D481)
Note:It is probably changed elsewhere in the program i.e. perhaps decremented over time or used as some timer or counter value, to be honest to be sure why & how these are used you need to post any code where these registers are used.
 
Last edited:
Regarding the MOVP command, I tried changing it to
SM401 (commented as 'always off') and changed MOVP to MOV, did an F4 to compile, but D445 still showed the same value.
 
Ok I got this sorted now.
D445 is a floating point number and occupies 2 words

But I had already defined D446 for use elsewhere.
I have now freed up D446 by redefining it to an unused register, I did a F4 and wrote to PLC...now D445 is getting the value 18000.
I remember parky you told me this was something to be wary of. Cheers.
 
Ok I got this sorted now.
D445 is a floating point number and occupies 2 words

But I had already defined D446 for use elsewhere.
I have now freed up D446 by redefining it to an unused register, I did a F4 and wrote to PLC...now D445 is getting the value 18000. ...

Please excuse me for nitpicking, but this does not seem to explain what was happening.

  • The [MOVP K18000 D445] writes 16 bits (0100_0110_0101_0000 = 0x4650 = 18,000) to the 16-bit register D445;
  • That MOVP does not change, or otherwise write anything to, D446.
  • Any code elsewhere writing to D446 will not change anything in D445.
  • Even if D445+D446 compose a floating-point value (cf. here or here), the value shown here for D445 is the first (and lower) 16 bits of that 32-bit quantity.
Does anyne think the [MOVP K18000 D445] instruction (cf. this link) in the image of post #1 was/is writing a 16-bit integer with the value 18,000 decimal to D445 only, or was/is it writing the 32-bit floating-point value 18000.0 to [D445+D446]?

Other things to note, although perhaps @parky covered them:

  • that MOVP only executes on a rising edge of its input rung, so, assuming SM400 is actually "always on" i.e. 1, the MOVP will execute at most once on the first scan of this rung after the switch to RUN mode, assuming there is no pre-scan disabling of edge detection instructions occurring at the mode change.
  • Replacing SM400 (always on; 1) with SM401 (always off; 0), as OP said they did in Post #5, would would have disabled the MOV completely on all scans while in RUN mode, even though it had been changed from a MOVP.
 
Drbitboy....My mistake....I meant D444 (not D446) in my previous reply. Does that clear things up?
D444 is a floating point number and will have overwritten into D445, hence it changed the value in D445.
Do you agree with that? Thanks
 
You do have to be careful as floating point or Dintegers are two consecutive 16 bit registers, wherever possible I tend to make 32 bit (float or doubles) on the evens boundary in other words D400, D402 etc, not that it matters it's just when programming on the fly it is easy to forget but a simple xref will usually find any not used just as a matter of interest of learning any instruction that is either float or double integer the function will either have "E" or "D" in front of it, i.e. MOV = 16 bit, DMOV = 32 bit double integer & EMOV is a float.
If using SM400 and it is only needed on the first scan that needs to populate a register i.e. a starting point that may change then you do need to use the pulse of that move function, if using SM401 then there is no need to use the pulse as it is only on for the first scan, if that register never changes then there is no need to move a fixed value into a register just use "K" (constant) in the logic. I assume that it must change somewhere as I find it a little perplexing if it is not being changed elsewhere, one other possibility is that it is a pre-set or default value & can be changed on the HMI, from what I have seen of the code so far the original programmer may have been under pressure & did a number of changes on the fly, believe me been there done that, looked back later & thought why did I do it that way.
 
To add more information, D445 (value 18000) is a value that never gets updated. It represents a 30 minute countdown starting point. Some old vacuum pumps in our system need 30 minutes of "warm-up" time before being used.
 
Like I said, there was probably no need to use a register as one of the following would do
pre-set a counter with K18000, or use a timer with a time base of 100ms & pre-set it to 18000. or just compare a counter or count register with 18000.
 
Drbitboy....My mistake....I meant D444 (not D446) in my previous reply. Does that clear things up?
D444 is a floating point number and will have overwritten into D445, hence it changed the value in D445.
Do you agree with that? Thanks


Yes, thanks, I agree with that; now I don't need my OCD drugs today ;).



And the floating-point value that was being written to [D444+D445] is in the range [372.0,374.0), is that correct?
 

Similar Topics

I'm trying to verify a project with a PLC. The Transfer Setup menu item is grayed out and every time I click Verify with PLC, I get an error...
Replies
1
Views
89
Well, I've decided to start a new project, and like all projects, it has already gone horribly wrong. I purchased a PLC device (supposedly a...
Replies
2
Views
135
Does anybody have any samples of how to "Create and Use" UDT's in CCW Developer Edition? (I am using v22) I can't find any information from...
Replies
3
Views
343
I'm trying to manually convert a Beijer E200 HMI project onto to a new Mitsubishi GOT gs2107-wtbd. The PLC is a very old A-series AS1CPU and is...
Replies
1
Views
405
Hi One of the PLC's that I maintain/update is a Mitsubishi Q-Series, probably installed about 10 years ago. At the moment, ALL the wires from...
Replies
13
Views
1,210
Back
Top Bottom