kav

Time Based Interrupt

11 posts in this topic

Hello guys!!!

My system constist of:

CPU: Q03UDE

Some I/O modules

Some Intelligent Modules (Q68ADI,QJ71PB92V...)

A High Speed Digital Input card QX80H (setting responce time 0.1msec)

1 digital input from QX80H occupied to count the pulse that a flow meter sends. The pulse corresponds to the totalizer of the Flow meter (FCI ST100 series Thermal Mass) and it has fixed width 0.5msec. The flow meter sends 4 pulses / minutes approximately according to current flow rate. My Main Program has scan time 2.4msec. I think that PLC ignores some pulses because of the pulse width is lower than scan time of my program. Is it right? So, the PlC program calculates wrong total flow....

What can I do to avoid this issue?

Attached you can find a sketch what I mean...

I though to program a time based interrupt every 0.3msec. Is it right and possible in Q03UDE CPU.....? If yes, how can to do it?

Thanks a lot in advance for your any help!!!

Untitled.png

Share this post


Link to post
Share on other sites

 

Did you check the "IO response time" of QX80H in I/O Assignment menu (Q parameter Setting )?
The setting value must be according the response time of flow meter

Sem título.png

Edited by AlexMota
extra information

Share this post


Link to post
Share on other sites

I got the information in  I/O Module Type Building Block User's Manual SH (NA)-080042-AB

Edited by AlexMota

Share this post


Link to post
Share on other sites

You are correct that the scan time is the issue. The PLC needs to be reading the input state at at least double the frequency of the input pulse. So setting 0.1ms response time on the QX80H is good but 0.2ms would also be enough and maybe slightly less susceptible to noise.

The pulse input needs to be used with a high speed counter instruction in the PLC program or, like you said, with a fixed interval interrupt routine. The smallest fixed scan the Q03UDE supports is 0.5ms which is too slow.

You could try triggering an interrupt pointer with the QX80H interrupt function. However, I think you might need a dedicated hardware counter such as the QD62. Please check with Mitsubishi or maybe someone else on here knows whether the standalone QCPU will be able to catch that pulse.

 

Share this post


Link to post
Share on other sites

If you do decide to use an interrupt routine. Remember to use DX.....(direct input) instead of just X (refresh mode input) or else he will not get the latest value of the  input value.

And program a EI instruction in the normal scan program to enable interrupts

Edited by Gambit

Share this post


Link to post
Share on other sites

Yes, Gambit is right that you need the D in front of X and Ys to use or effect those bits immediately during an interrupt execution.

But isn't the input from an interrupt card mapped to pointers I0 to I15? Therefore to call an interrupt on X0 of the QX80H, you would just put I0 at the start of your interrupt program.

The manuals aren't very clear on this but I believe if the QX80H is the only interrupt digital input card (intelligent function modules are assigned differently) on the rack, its first 16 Xs are automatically mapped to I0 to I15. If another input card with interrupt capability were added further down the rack, I assume its interrupt function would not be usable.

 

I wrote an explanation of using IMASK and setting up an interrupt here if it's any use:

http://forums.mrplc.com/index.php?/topic/30309-basic-help/&do=findComment&comment=143910

Share this post


Link to post
Share on other sites

Many thanks to all for your help....

AlexMota, of course i set the response time of QX80H at 0.1msec, without any result....

I use Q312B rack and QX80H card is on the last slot..Is it restrictive to use fixed time interrupt routine?

Thanks again!!!

Share this post


Link to post
Share on other sites

The fixed time interrupts are generated by clocks inside the CPU module and are not related to other cards on the rack. But the lowest fixed time is 0.5ms which is not short enough to guarantee you will catch all 0.5ms pulses. This method would improve the "catch rate" but not 100%.

Above I mentioned triggering an interrupt from the rising edge of the X input on the QX80H. The location of the input card is important for this method. Are there any other input cards with interrupt functions on the rack?

Share this post


Link to post
Share on other sites

Luke, excuse me for the late answer but I was very busy in my job. There are no other input cards with interrupt function enabled. Generally, there is no other interrupt function in my code. I'll try to catch the idea of the interrupt mechanism, reading Mitsubishi manuals, but too dark....Is there any code example in GX Works2 that can help me...I am not so familiar with GX Developer.....

Thanks a lot again for your help!!!!

  

Share this post


Link to post
Share on other sites

There are not any code examples that I am aware of.

First you need enable the interrupt pointer you are going to use with IMASK. I posted a link above to another post where I explained how to do that with some example ladder code. For example if you are using X0 on the QX80H, you need to enable I0.

Then create a POU which is registered as "standby" (not scan) in PLC parameter program settings which is called by I0. To do this if it's a ladder program, put I0 at the top on the far left.

Then in the interrupt program do what need to do such as increment a register etc. and at the end of the program put |-----------[IRET]--|

Share this post


Link to post
Share on other sites

Ok!!! Thanks a lot for your help! I understand! I will try it and I will post back the results!!

Thanks again!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now