Erroneous Reporting of IO bits on Konnect - minimum example program
Posted: Sat Sep 17, 2022 12:24 pm
/*
This is a minimum demo program to troubleshoot / document an issue I am seeing with erroneous reporting
of inputs bits on a Konnect board.
The issue is two IO bits are reported as ALWAY ON, regardless of actual input state
- Bits 1046 & 1047 are reported/read as ALWAYS ON (Board 0)
- Bits 1110 & 1111 are reported/read as ALWAYS ON (Board 1)
This happens for sure when the following conditions are met:
- ch3 is configured as a step/dir driver
- ch4 is configure as a step/dir driver
- ch3 is ENABLED while ch4 is DISABLED
*** If both axis are Enabled, the Inputs are reported/read correctly
*** If ch3 is enabled and ch4 is disabled, the Inputs are reported as ALWAY ON
*** If ch3 is disabled, the Inputs are reported correctly, regardless of the state of ch4
Other notes:
- I am documenting a dual Konnect setup. This happens with just a single Konnect system as well.
- I have not tested with triple or quad Konnect systems.
*/
#include "KMotionDef.h"
//define for drive mode for Step/Dir generators
#define DRIVE_MODE_OC_QUAD 16
//step/dir geneator ID's
#define STEPDIR_CH3 3
#define STEPDIR_CH7 7
main()
{
InitAux();
AddKonnect(0,&VirtualBits,VirtualBitsEx); //JP6, first connect
AddKonnect(1,VirtualBitsEx+1,VirtualBitsEx+2); //JP6, second Konnect
//initialize ch4 as a step/dir output using STEPGEN#7 in open collector mode
ch4->InputMode=NO_INPUT_MODE;
ch4->OutputMode=STEP_DIR_MODE;
ch4->OutputChan0= STEPDIR_CH7 + DRIVE_MODE_OC_QUAD;
EnableAxis(4);
//initialize ch3 as a step/dir output using STEPGEN#3 in open collector mode
ch3->InputMode=NO_INPUT_MODE;
ch3->OutputMode=STEP_DIR_MODE;
ch3->OutputChan0= STEPDIR_CH3 + DRIVE_MODE_OC_QUAD;
EnableAxis(3);
//now, using the Kmotioin GUI, go to the Axis screen and toggle ENABLE of ch3/ch4 while watching
//the state of I/O 1046/1047,1110/1110 with NOTHING connected to the Konnect Board
}
This is a minimum demo program to troubleshoot / document an issue I am seeing with erroneous reporting
of inputs bits on a Konnect board.
The issue is two IO bits are reported as ALWAY ON, regardless of actual input state
- Bits 1046 & 1047 are reported/read as ALWAYS ON (Board 0)
- Bits 1110 & 1111 are reported/read as ALWAYS ON (Board 1)
This happens for sure when the following conditions are met:
- ch3 is configured as a step/dir driver
- ch4 is configure as a step/dir driver
- ch3 is ENABLED while ch4 is DISABLED
*** If both axis are Enabled, the Inputs are reported/read correctly
*** If ch3 is enabled and ch4 is disabled, the Inputs are reported as ALWAY ON
*** If ch3 is disabled, the Inputs are reported correctly, regardless of the state of ch4
Other notes:
- I am documenting a dual Konnect setup. This happens with just a single Konnect system as well.
- I have not tested with triple or quad Konnect systems.
*/
#include "KMotionDef.h"
//define for drive mode for Step/Dir generators
#define DRIVE_MODE_OC_QUAD 16
//step/dir geneator ID's
#define STEPDIR_CH3 3
#define STEPDIR_CH7 7
main()
{
InitAux();
AddKonnect(0,&VirtualBits,VirtualBitsEx); //JP6, first connect
AddKonnect(1,VirtualBitsEx+1,VirtualBitsEx+2); //JP6, second Konnect
//initialize ch4 as a step/dir output using STEPGEN#7 in open collector mode
ch4->InputMode=NO_INPUT_MODE;
ch4->OutputMode=STEP_DIR_MODE;
ch4->OutputChan0= STEPDIR_CH7 + DRIVE_MODE_OC_QUAD;
EnableAxis(4);
//initialize ch3 as a step/dir output using STEPGEN#3 in open collector mode
ch3->InputMode=NO_INPUT_MODE;
ch3->OutputMode=STEP_DIR_MODE;
ch3->OutputChan0= STEPDIR_CH3 + DRIVE_MODE_OC_QUAD;
EnableAxis(3);
//now, using the Kmotioin GUI, go to the Axis screen and toggle ENABLE of ch3/ch4 while watching
//the state of I/O 1046/1047,1110/1110 with NOTHING connected to the Konnect Board
}