Use of in built timers in Interrupt Service Routine-FATEK FBs Series PLC

Join Date
Aug 2023
Location
Rawalpindi
Posts
11
Dear all,
I want to use the interrupt service routine in FATEK PLC using WinproLadder Software. I had configured the interrupt in software as External Interrupt attached to input contact "X0" and it will be triggered when rising postive edge is detected. After programming, the interrupt routine works well but the standard timers attached inside the sub routine does not get enable and not even starts running.
I think the timers does not get more than one scan time as ISR returns to main program immediately at the end of RTI instruction or may be it is a different issue. Need your help in how I can manage to run timers inside the interrupt ISR Routine in sub program part of WinproLadder?
Thanks
 
The interrupt service routine is not obeying classical PLC scan, and timers are functioning according to classical PLC scan cycle. it could be that timer can not see positive edge. You could to set M bit by X0 and start timer with that M bit.
 
Yes, I am setting M bit and using it to enable Timer but the Timer did not function and if I remove timer from ladder then the ladder starts functioning as far as Timer has not included inside of it.
 
Why are you using a timer in an input interrupt ?
Perhaps set a bit in ther interrupt & use the timer to trigger a routine in the normal scan. what are you trying to achieve.
 
Why are you using a timer in an input interrupt ?
Perhaps set a bit in ther interrupt & use the timer to trigger a routine in the normal scan. what are you trying to achieve.

^This.

Where is the logic that will react to the timer expiry? If it is on the interrupt routine, then that logic cannot execute until there is another interrupt, so the timer may not update, even though it is probably actually "timing."
 
Actually I am using timers in Interrupt Service Routine not in input interrupt. I want to execute Emergency Switch as Input Interrupt and when that interrupt triggers and execute interrupt service routine , the timers inside the routine will run for 3 or 5 sec to scan the sensor feedback and after their expiry they would set a bit and that will be us d in normal program or main program
 
First of all, the interrupt (not the input one) apparently it seems from your post that it is the input interrupt that initially triggeres it then a timer 3-5 s to set a bit that is used in the scan program(s) why?.
what is the reason, you say scan the input(s) of a sensor what happens during that 3-5s ?, when the time is up what happens with this bit you have set used in the main scan, is there anything that needs to happen during this 3-5s time period ? is this "Sensor" you need to scan updated faster than the scan of the main program ?.
Some suggestions assuming the scan is a problem use a time interrupt i.e. 10ms there you could increment a variable & compare it to 300 for 3 seconds then set your bit timers are not that accurate the longer the time the error gets larger due to being updated when in scan.
Another sugestion is to create a function that is called in the main scan multiple times with update peripheral Inputs, split your other programs into small chunks and call the update function many times inbetween the calls to the other programs, for example a total program scan time of 20ms with say 5 programs, although not consistent scan of each program would give you a rough update of 4-5ms on the peripheral input update. have used this on a PLC that did not have Input interrupt capabilities.
 
Thanks for ur feedback. I would surely try to implement timer interrupt. Actually, I am reading pressure transmitter output within 4mA to 20mA range and I only wanted to keep a watch on its specific value so that if it remains consistent within 3-5 sec range then to take decision otherwise no. This is the purpose of using timer.
If you can provide any other method of keeping a check on sensor value for few seconds and then take a decision based on final value similarly like keeping note of values and then averaging it to get final mean value in ladder diagram as doing in other languages is easy by using loops and taking average ?
Thank you
 
It sounds like a debounce, where you don't want to react to the analog value briefly crossing a threshold, but if it stays below or near that threshold for an extended period (3-5s in this case), then do something.

I don't see the point in using interrupt routine for that, but then I don't fully understand your process.
 
Why don't you post the program so we can check it?

Here are the program screenshots, as you can see the timers "T150" & "T151" is not running in Interrupt Service Routine of Emergency Switch Interrrupt in image "Capture.PNG".
What is your opinion?

Capture.PNG Capture_2.PNG
 

Attachments

  • program_FATEK.zip
    2.8 KB · Views: 4
Last edited:
The chances are that the analogue is only updated at the end of scan of the program so there would probably be no point in using interrupts at all, also the conversion of analogues to digital values are pretty slow compared to digital inputs and almost certainly longer than your scan time. As already posted, timers require successive scans to work as they are only updated in scan.
 

Similar Topics

Dear all, what type of built in port does fx2n-80mr plc has? i mean is it rs232, r rs422 or rs485. and which module should i use to convert to...
Replies
5
Views
117
Does anyone have any recommendations for Electronic Circuit Breakers with 0V Terminals built-in and Fieldbus (IO-LINK, MODBUS TCP, EtherNet/IP?)...
Replies
2
Views
193
My PLC (S7-1200) and HMI (KTP-1200 Basic) has been delivered on-site to the customer. To be able to do "off-line" updates to the code, I am using...
Replies
4
Views
223
I am wondering if anyone has seen an input IO block that has a built in AND function for the inputs and the output of the block is a normal M12 5...
Replies
13
Views
886
Hi, My PLC hardware has been delivered to customer site - many thanks for the invaluable help on this forum! I was looking into see if it's...
Replies
12
Views
2,510
Back
Top Bottom