Recent Posts

Pages: 1 [2] 3 4 ... 10
General Discussions / Re: HSC in cusfn
« Last post by BetterBath on October 27, 2022, 06:25:04 AM »
I learned a little c++, so this topic seemed a bit familiar to me. Thank you for sharing.
Junk removalPet sitting Port St Lucie, Fl
General Discussions / Re: PLC Trafic light
« Last post by BetterBath on October 21, 2022, 03:06:30 AM »
Very interesting, but it's a bit difficult for me to understand all these technical nuances. However, thank you for the post.
About usOur companyVisit usbathroomremodeldesignideabestshowerbathtubClick herefor more aboutour siteshower installation
Technical support / Re: PLC INPUT Interrupt Behavior
« Last post by support on October 14, 2022, 01:44:07 PM »
Hi Gary,

Thanks for the details explanation of your setup.

One thing about the particular CPU chip family that is used on Fx, FMD and Nano-10 PLCs is that the interrupt input operates using the "input capture interrupt" mechanism and due to the CPU chip hardware limitation, when used in "input capture interrupt" mode the logic level on the input pin cannot be reliably read by the firmware. Hence when a digital input has been defined as interrupt input (especially for input 1 to 4) the pin logic state are no longer visible to the ladder logic. This is due to chip hardware limitation that could not be overcome by the firmware. When you INTROFF an input pin inside an ISR , it will be reset to become a general purpose input again.

The general purpose input logic state are only updated during the I/O scan which normally occurs only at the end of the ladder logic scan. or after running a REFRESH statement. So right after your ISR has disabled the input interrupt, the digital input status will not change regardless of the actual physical voltage level. At the end of the ladder logic scan the I/O scan routine is the one to update the the physical input but the software filtering may yet filter out the new state and therefore requires another scan before the new logic state is finally determined.

The new Wx100 CPU is different in that the actual logic state of the physical input is still visible to the firmware when it is being defined as an interrupt or a HSC input so I believe your experience with Wx100 CPU should be different.

Frequently Asked Questions / Re: can we send sms?
« Last post by KellyP on October 12, 2022, 09:29:38 AM »
If your PLC can send an e-mail then it can send a text message. For example a Verizon customer could be texted by sending an e-mail to if their number is (123)456-7890. I am not very familiar with the Direct Logics PLC's ability to e-mail, but the PAC 3000 can (though I could not get the SMTP server to work) and a C-More panel definitely can (I 've tried it succesfully). Hope this helps.

Creative Resurfacing Solutions                                                                           
Technical support / Re: PLC INPUT Interrupt Behavior
« Last post by garysdickinson on October 09, 2022, 05:41:22 PM »
I am using the EZWire-1616.

I am using the edge triggered interrupts to terminate a stepper motion on the edge of a limit switch.  I am running the stepper at a very low step rate with no acceleration.  This way the StepStop command will stop the motion as close to the edge event as possible w/o the stepper losing position.

If I do this without using the interrupt system the the stepper can be 50 steps past the edge event as I am limited by the ladder logic scan rate.  Without using interrupts, I have to issue  a one-step motion command to detect the edge event.  These steps are limited by the ladder logic scan rate.  I can get 20..50 pps out of ladder logic.  My stepper hardware can run at 1000 pps and be stopped with StepStop without losing position.  ISR edge detection saves about 8 sections for each stepper based positioner.

If I had 4 additional INPUTS, I could wire 2 PLC inputs in parallel for each limit switch input.  This would get me both ISR and ladder logic visibility to the limit switches.  I will still have to disable the ISRs either by disabling them or substituting a non functional CF for those times when I don’t want the stepper system to be stopped on edge events on the limit switches.

    What how I think that the PLC handles INPUTs and INPUT interrupts:
    • Physical INPUT states are scanned and registered once per scan of the ladder logic. If an INPUT is acting as an interrupt source it’s valve when viewed by ladder logic is always 0, independent of the voltage on the INPUT pin.
    • INPUT interrupts are handled synchronously to the ladder logic scans.  I believe that these are handled directly by the PLC’s CPU. My ISR sets a RELAY to indicate that the edge condition was detected. My ISR, also turns off the INTERRUPT system for the the INPUT before exiting.
    • Ladder logic contacts, INPUTS included, can be differentiated or edge sensitive.  To detect an edge requires 2 successive scans of the ladder logic.
    • I suspect that it takes 2 full ladder scans to get the INPUT state correct after an INPUT interrupt is turned off. But because of the asynchronous behavior of the ISR, it may take a 3rd scan of the ladder logic to get the INPUT working.  My test code counts the number of scans from when a rising edge ISR runs until ladder logic detects the the INPUT is non-zero.  This code sees 2 full scans for about 9 out of 10 tests and 3 scans about 1 out of 10.

    I don’t think that I am observing contact or switch bounce.  I disable the ISR in the ISR routine. I would like to believe that your system level code would disable the CPU ISR before the PLC ISR code exits. Even if the ISR executed 2x, the PLC code will see only a single event from the ISRs.

    I believe that waiting 3 scan times following the ISR detected edge event will allow the PLC INPUT logic to return to "normal" (digital filtering is working), differentiated INPUTs working, …

    As you know, I am just guessing how the PLC operates. I am just picking your brains to see if I am missing something.  I appreciate anything that you can think of.


    Gary Dickinson

Technical support / Re: PLC INPUT Interrupt Behavior
« Last post by support on October 09, 2022, 01:02:28 PM »
It is generally not recommended to use a digital input both as a general purpose D/I and an interrupt input at the same time by manipulating with INTRDEF and INTROFF especially if you need the D/I to function immediately within the next scan. Note that the interrupt is edge-triggered whereas the general purpose digital input is level-determined. The PLC firmware also deploys a software filtering mechanism to filter out what it deemed as "glitches" whereas when defined as interrupt input there is no filtering and that can also add to some uncertainty. For most PLC logic if the current scan misses the new input state change it is generally harmless to delay to the next scan to pickup the new input level.

My guess is that when the ISR is triggered the voltage level may still be midway between logic '0' and logic '1' but the edge transition has triggered the ISR to run and after you have disabled the input as interrupt it still may not reach the logic '0' or logic '1' voltage and hence is not picked up by the I/O scan (throw in some switch bouncing and that may further complicates the scenario). I hope that make sense...

BTW which specific PLC model are you using for this test?

Technical support / Re: PLC INPUT Interrupt Behavior
« Last post by garysdickinson on October 06, 2022, 09:42:05 PM »
I wrote some test code to see if I could figure out how long it takes from the time that an active INPUT ISR is turned off via the IntrOff statement to when the state of the physical INPUT can been "seen" by ladder logic.

The amount of time is 2 to 3 scans of the ladder logic. In most cases it takes 2 scans.

I have attached a image of the ladder logic and the complete program for the test to this reply.

The CF, Ch1FndLowSw sets up the interrupt for the INPUT[1] and issues a StepMove command.  The RELAY, GO, will invoke the CF.

The ISR CF, Ch1LmtSLo_Int, will be triggered when the INPUT[1], Ch1LmtSwLo goes active. The ISR is configured to respond to a rising edge event.  The ISR does two important things:
1. Turns off the ISR
2. Sets the RELAY, Ch1Intr to indicate that the interrupt has been serviced.

The CF, IncScanCount increments the TBASIC variable A on each scan of the ladder logic that the CH1Intr RELAY is active.

The PLC code is very simple.  Just complicated enough to answer some of my questions.

Best regards,

Gary Dickinson
Technical support / PLC INPUT Interrupt Behavior
« Last post by garysdickinson on October 05, 2022, 03:12:18 PM »
I have been working on using the INPUT interrupts that are tied to end limit switches for a stepper based motion system.  I have gotten them to work, but am a little confused about the timing.

This is the code for one of the ISRs:

' Ch1LoLmtISR - Interrupt handler for Ch1LmtSwLo
' This code aborts the CH1_Y stepper system when the interrupt condition is met
StepStop CH1_Y          ' Abort Stepper Motion
IntrOff Ch1LmtSwLo_Int  ' Disable interrupts for this Input
SetIO Ch1Intr           ' Set ISR event RELAY

I am aware that while an ISR is active, following the execution of IntrDef, that the INPUT pin status is NOT latched at the end of the ladder logic scan. When the ISR for an input is disabled, the INPUT status is "visible" to ladder logic.  So my "initial fix" was to re-sych the Ch1Intr RELAY at the end of the ladder logic to control a 2nd RELAY, Ch1IntrDly, with something that looks like this:


My assumption is that if the ISR set CH1Intr then waiting one scan time the delayed version of CH1IntrDLY in ladder logic, that the physical INPUT would be visible to the ladder logic.

Sometimes this works and sometimes it does not.  So I added more logic to delay the CH1Intr by a 2nd scan and this worked a bit better, but sometimes failed.



My "ultimate" fix was to make Ch1IntrDly a TIMER and not a RELAY. This will result in multiple scan times before the TIMER goes off.  Now everything is visible to the ladder logic.

Do you have any suggestions on a better approach to "know" when the INPUTs are working after turning off an INPUT interrupt?

Is there some other timing issue that I am missing?

Does the SetStop take a lot of time to execute? If so should I have rearranged the order of the lines of code in the ISR?
Does the IntrOFF statement take effect immediately, or is it delayed to some point in time that is tied to the ladder logic scanner?

Beat regards,

Gary Dickinson
General Discussions / Re: comparing value of two DM
« Last post by KellyP on September 28, 2022, 05:59:22 AM »
Got this question answered?
atlanta wedding photographer                                                                           
Pages: 1 [2] 3 4 ... 10