I physically connected a limit switch (positive end) signal pin to IO0 (see the attached picture), but in the program, I have to configure LimitSwitchPosBit as 1, as shown below:
ch1->LimitSwitchOptions=0x112;
ch1->LimitSwitchPosBit=1;
SetBitDirection(1,0);
It works. But somehow, IO0 and IO1 are high and low at the same time based on the digital I/O screen, and they look like IO0 and IO1 are interconnected internally.
If I configure LimitSwitchPosBit as 0, the same as the physical pin connection. I cannot move ch1's axis toward the positive limit switch even if it's not triggered at all.
ch1->LimitSwitchOptions=0x112;
ch1->LimitSwitchPosBit=0;
SetBitDirection(0,0);
Is my KFlop broken?
KFlop digital IO pins are swapped?
Moderators: TomKerekes, dynomotion
- TomKerekes
- Posts: 2676
- Joined: Mon Dec 04, 2017 1:49 am
Re: KFlop digital IO pins are swapped?
If an input is left floating and open it state is indeterminate. It may follow a nearby signal based on parasitic resistance and capacitance. So just ignore its state (or drive it high or low).
It may be the signal has noise (glitch spikes). In that case the limit will always trigger. It may be the glitches are not introduced into the nearby inputs.
Here is a program to watch for a glitch:
You can reduce noise by using shielded cables, or by adding a 0.1uF Capacitor to GND near KFLOP, or by using opto isolated 24V signals as with our Konnect Option.
It may be the signal has noise (glitch spikes). In that case the limit will always trigger. It may be the glitches are not introduced into the nearby inputs.
Here is a program to watch for a glitch:
Code: Select all
include "KMotionDef.h"
// Simple check for Glitch on Input Pin
main()
{
while (!ReadBit(0)) ; // tight loop while input is low
printf("Input was high!!\n");
}
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.