Mitsubishi - Analogue output with variable ramp time and output voltage

Another approach. Not shown are the steps to convert between REAL and TIME, and back again, or to calculate the RAMP and DWELL presets at TIME data types, which would make this messy. But otherwise the basic logic flow is pretty nice.


  • PXL_20240710_211524363.jpg
    269.8 KB · Views: 4
I did go down the route of trying the RAMP function (is RAMPF the one your referring to ? only one i could find in gxworks 3) but couldn't get it to work very well in simulation mode. Looking through help files referred to changing the scan time which is something I've never played about with before so felt a little out of my comfort zone. I also didn't have the control panel at that point so couldn't try it on a real PLC.
Yes I had the same problem at first I wrote the block to be called in ladder (just the RAMPF) after a bit of time playing with setting the interrupts got it to work, then I wrote it in FBD but could not get it to work, I do seem to remember in one document some mention that interrupt programs need to be in ladder there also seemd to be some problem with converting the floats to integers when in the interupt block (would not compile) but did compile when in normal scan block.
I don't know if it's the simulator is a bit buggy there does seem to be a few issues whith GXW3, I do not have that problem in GXW2.
I will try again to see if it works in ladder but the rest in FBD I think it may be to do with FBD uses jumps to subroutines rather than strait ladder type processing for example when FBD blocks are called it jumps to a subroutine then returns, but if you use that in an interrupt block it effectively jumps out of the interrupt to a subroutine then returns so that is probably why, you should not jump out because it may get interrupted.
Here is a project that uses the RAMPF function could not get it to work in interrupt or fixed scan I think it is the simulator there are limitations when simulating.
I have created a function block to call the RampF function & passed the parameters to it, this works well there is no overflow when it reaches the required output.
Note: the ramp time is in seconds or should I say in 100ms pulses so 5.0 is 50 ramp pulses if you need minutes instead of 10 you need to change the multiplication factor to 60. Note: the RAMPF function the output of it is an array of 2 integers it is passed as an array i.e. Raw_out, however, when you use the values reference them as Raw_out[0] or Raw_out[1] (Raw_out[0] is the actual ramp value Raw_Out[1] is the number of scans


  • Ramp.pdf
    168.7 KB · Views: 2
    177.5 KB · Views: 2
Nice !

I never thought to question whether the simulator was at fault when trying to test my original software using the RAMPF function block. I just assumed it was my programming.

Thank you for sharing that
I don't know what limitations are but certainly Analogues, special cards & fast I/O like PWM, encoders (encoder hardware counters tied internally to inputs X0-7)
So it is possible interupts also do not work well.
All I did was create the function block & call it with the 100ms special bit SM410, that is almost the same as running it in a 100ms interupt or event block, .
On the simulator for GXDev & GXWorks2 it has a message on it stating functions are limited. I could not find the manual for GXSim3 but for GXDev Sim there are probably 60 plus functions that are not supported.
The envent interrupts do work, on the simulator, I forgot to enable interrupts lol,
If you use the RAMPF function in an interrupt what you need to do is
1. In your main program block on the first line enable interrupts AND TRUE EI
2. Create a seperate program file & call the RAMPF the EN bit should be the one that starts the ramping,
3. when the output (Array[0]) reaches or is greater than the Max reset the EN bit. Remember to force the Array[0] back to 0 when the process finishes.
4. Drag the program with the RAMPF in it from the scan to the fixed scan task open up the program setting of that & set the interrupt to I28 (100ms)
Then it will work, Why not try it on the simulator


  • Valve_Ramp (2).zip
    176.4 KB · Views: 2

Similar Topics

MY plc CONFIGURATION RACK 1 Q02HCPU QX40 X0-XF QX40 X10-X1F QX40 X20-X2F QX40 X30-X3F QX40 X40-X4F Q68ADI X/Y50-X/Y5F Q68ADI X/Y60-X/Y6F...
Hi, I'm planning to install a new Analogue Input module Q68AD-G. It will inserted on Rack 0 Slot 4. When it's installed, will the code recognise...
Hi, I've got a Q68AD-G card (8 channel). I want to configure it for 0-10v analogue input. I've enabled the channel by using Un\G0. Then I used the...
Hi, I've run out of analogue input channels on my Q68AD-G module. If I add a new Q68AD-G module and install it into a spare (blanked-off) slot, it...
I'm creating a programme offline (as a training exaple, there is no physical PLC to connect to), and I can't figure out how to use any Analogue...
Top Bottom