A KFLOP C program can finish issuing a motion command before its thread is halted. Troubleshoot the system in this order: separate thread execution from axis motion, load the DAC-servo configuration into KFLOP, verify stable feedback, then test homing. Do not use an unconfigured homing move as the first motion test.
Understand why Halt does not stop motion
The KMotion Halt button stops the selected C-program thread. It does not recall a Move command that the thread already issued, so the destination can continue changing after the program stops.
| Action | Result | Use |
|---|---|---|
| Halt the C-program thread | Stops further C-code execution but leaves an issued move active | Stop program logic |
| Clear the axis Enable checkbox | Disables the axis and causes an abrupt, uncontrolled stop | Emergency diagnostic action, not a normal controlled stop |
Command Jogx=0
|
Commands axis x to zero speed |
Controlled stop request |
When evaluating a Halt test, monitor both the program-thread state and the axis destination. They represent different controller activities.
Load the DAC-servo configuration before moving
KFLOP defaults to Step/Direction operation. Selecting DAC Servo in the KMotion configuration screens does not change the active controller configuration until you download those settings to KFLOP or convert them to C code and execute that program.
- Select the required DAC-servo output type and enter the axis parameters in the KMotion configuration screens.
- Download the screen configuration to KFLOP, or use
C Code -> Clipboardand place the generated axis configuration in the initialization program. - Configure the amplifier-enable output in that initialization program. For drive-enable bit
145, useSetBit(145);. - Enable and test the axis with the Step Response screen before running the homing program.
A direct DAC console command only proves that the DAC is connected to the amplifier and can make the motor respond. It does not prove that the axis channel is configured, enabled, or stable under feedback control.
Diagnose fixed-speed or one-direction motion
MaxOutput limits the analog DAC output; it is not the requested axis speed. In the reported speed-mode system, changing the programmed move speed from 1000 to 5 did not alter the observed motor speed, while changing MaxOutput did. The reported DAC command was limited to 200.
This combination—output pinned at the limit, little response to the requested speed, and motion that remains in one direction—indicates that the servo loop must be checked before homing. Reversed feedback was subsequently confirmed in this case. With positive instead of negative feedback, a small position error drives the output toward its limit and produces a runaway condition.
- Keep the axis away from mechanical stops and begin with restrictive output limits.
- Use the Step Response screen to enable the axis and verify that it holds position.
- If the axis immediately runs away or pins the output, disable it and correct the feedback direction before continuing.
- Make controlled moves, increase limits only after stable operation, and tune the axis response.
Do not treat a lower MaxOutput as the final speed-control solution. It can reduce the severity of a runaway while leaving the underlying feedback error unresolved.
Verify the home input only after tuning
A bit changing state in the Digital I/O window proves that KFLOP can observe that input. It does not prove that the homing C program is reading the same bit or testing the correct polarity.
- Configure, test, and tune the servo axis before starting a home search.
- Identify the limit-switch bit referenced by the homing code.
- Operate the switch manually and confirm that this exact bit changes state in the Digital I/O window.
- Print the value read by the program and confirm that its transition matches the condition used to stop or reverse the search.
- Run the first search where the axis can be stopped before reaching a hard mechanical limit.
If the displayed input changes but motion continues to a hard stop, compare the program's bit selection and logical condition with the observed input state. Do not assume the physical switch and C-code test are connected merely because an I/O indicator changes.
Initialize safely and verify from the console
Use an initialization C program to load channel values, establish the motion configuration, enable the required axes and amplifiers, and then run continuous machine monitoring. Wire amplifier enables so they default off until KFLOP has initialized the channels and can actively control the DAC outputs. This prevents an amplifier from becoming active before the controller is ready to hold the motor stationary.
Common settings can be changed without a power cycle. Unless Flash User Memory is selected, the settings are lost when power is cycled; flashing user memory was not recommended for normal use in the evidence. A power cycle is therefore not required after each ordinary download and should not be used as a substitute for confirming which configuration the controller is executing.
Use console output to verify program variables. KFLOP emits the line only after receiving a newline character:
double x = 89.89;
printf("This is a double:%f\n", x);
int state = 1;
printf("Input state:%d\n", state);
Use %f for floating-point values and %d for integers. If output resembles an unrelated address or value, check whether the code is printing a pointer instead of the referenced variable.
FAQ
Why does KFLOP keep moving after I press Halt?
Halt stops the C-program thread, not a Move command already issued to the axis. Request a controlled stop with Jogx=0; clearing axis Enable stops it abruptly.
Why does changing the KMotion move speed not change motor speed?
Confirm that the DAC-servo configuration was downloaded or executed as C code and that feedback is negative and stable. An output pinned at MaxOutput, such as the reported value of 200, can indicate a feedback-direction fault rather than a valid speed command.
How do I enable KFLOP drive output bit 145 in C?
Place SetBit(145); in the system initialization program after the axis configuration is established. Ensure the amplifier-enable circuit defaults off until KFLOP has initialized and can control the DAC output.