Mitsu GX Works2 Q-PLC timer help (please!)

TheRealMRDyno

Member
Join Date
Jan 2012
Location
Akron
Posts
2
Hi,
I am new to Mitsu, know RSLogix 500/5000, micros, etc, and am translating a dynamometer controller application from RSL5000 to GX Works2 on a Q04UDEH PLC.

I need a 32-bit millisecond timer, that is, I need a rolling 32-bit value that increments at 1000 Hz - I do not need an event after a long period, I need access to <= millisecond precision timing values at any time in my code, and I need to cover long periods of time.

Any help? I have not tried these yet, but I am thinking of using the second word used by the system in the TTMR instruction in the hopes that it is a millisecond-ish rolling counter value that is latched when the instruction executes. Or maybe the SD520 register (scan time value), although I am not sure that value is END<->END time or just scan time.

Thanks(!),
Joe
 
The Q04UDEH CPU is fairly quick so depending on the scan time you may be able to achieve the 1ms scan time you are after. I would say the best option would be to increment a 32bit (double) word using a 1ms clock pulse, then use a compare function to set a bit at certain intervals of time as you require.


Special flag SM414 will give you a 1ms on, 1ms off cycle specified by the setting of SD414, if the scan time is quick enough. If the scan time is slower than this you may have to compromise on the accuracy.


Good luck
James
 
Figured it out

James,

Thanks, that might have worked as I am getting about 700 Hz on this thing (yes, it is pretty fast!).

However, I figured that 2nd INT "used by the CPU module" for the TTMR thing was the last clock value from some rolling system timer, and it appears that it is, at 1000 Hz. 🍻

So, you can implement a rolling 0.001 second resolution timer in a DINT by leaving a TTMR instruction enabled forever, and using that 2nd INT value to get scan-to-scan delta values in 0.001 second counts, and adding those counts to your own rolling 32-bit, 0.001 second counter.

The catch is, that 2nd INT is rolling from 000..999,000..999, so if your delta < 0, just add 1000 to your delta.

You can then do deltas against that rolling 32-bit value and get ~2,000,000 seconds, 555 hours, 23 days worth of 0.001 second timing.

Joe
 

Similar Topics

Hello everybody. I encountered a problem - I don’t know how to update the firmware on the Mitsu MR-J5-40G-N1 (ethercat) servo amplifier. My...
Replies
2
Views
401
Hello to Mitsubishi Electric experts. I have been tasked with developing an application that gets data from a MELSEC application, using MX Sheet...
Replies
2
Views
1,248
This is my first on the job exposure to messing about in a PLC with a PC. So far it hasn't gone too bad but I'm having a problem and it all...
Replies
9
Views
2,628
Hi all... help on Ethernet comm, between builtin EthernetQ03UDE to Laser Marker I'm using sp.socopen i cant open the port... is there any command...
Replies
4
Views
2,307
Hello all, this time is my question somehow theoretical, but with high practical impact. Let asume we have simple program and we have to...
Replies
6
Views
2,285
Back
Top Bottom