A.0v
B.24v
C.24v
D.24v
E.0v
F.0v
G.24v
H.0v will activate.
A.0v
B.24v
C.24v
D.24v
E.0v
F.0v
G.24v
H.0v will activate.
Ok thanks. A wire should always have the same voltage on both of its ends. If not, a huge current would flow and the wire would burn up.
E and G are supposedly two ends of a wire. E=0V and G=24V is probably a mistake. Please re-check those. Otherwise you have a broken wire or wiring error.
There are other inconsistencies but its probably best to go one step at a time.
You should make a correct diagram that shows two solenoids that you have instead of one, how they are actually wired, the diodes, and where they are not shorted together so it will be clear we are assuming the same things.
TK
http://dynomotion.com
This is still what Im getting.
A.0v
B.24v
C.24v
D.24v
E.0v
F.0v
G.24v
H.0v will activate.
Great. The diagram is much better, but still has one mistake. JP8 #6 and #7 are shown shorted together. I assume they aren't?
It still showing E=0V and G=24V which is impossible. Either you measured E or G wrong or there isn't a properly connected wire between E and G as your wiring diagram shows. Determine which it is.
TK
http://dynomotion.com
I missed that line.
That is the measurement I'm getting each time I take a measurement from JP6 GND to each point. I realize that it's impossible, that is why I believe I screwed up the board when 1 of the diodes were backwards. All of the connections were working before I plugged in that 5a power supply. I replaced the 5a power supply with 1a supplies so hopefully that doesn't happen again, and I ordered a new Kanalog board so well see if that is the problem. If not I'll have a spare board.
The wiring diagram now looks perfect. But I think you are missing the point. What you are indicating is more a violation of electronics/physics. Kanalog may be good or bad but it can't violate the laws of electronics.That is the measurement I'm getting each time I take a measurement from JP6 GND to each point. I realize that it's impossible, that is why I believe I screwed up the board when 1 of the diodes were backwards.
An analogy might be someone tells you they have a rigid horizontal solid rod. And they tell you the left end of the rod moving left and the right end of the rod moving right. Either they made a mistake determining the direction of the right or left ends, by say measuring the ends of different rods, or else it is not a rigid rod, by say it being broken.
When we find out one of our assumptions is incorrect it is really necessary to dig into it and figure out our mistake. Otherwise everything moving forward is invalid. Also if something is wrong and we swap in a new board that board might be damaged.
Kanalog might be good or bad but regardless it can either pull the #6 pin down to 0V or allow it to be at 24V. No matter what it does the other end E must be the same voltage.
My best guess is that you are not actually measuring at point E and point E is at 24V. The reasons I think this is because Kanalog doesn't have any 24V available to put out to G. So the only way G can be at 24V is if it comes from E. Furthermore if E was really at 0V then Solenoid #1 would have 24V applied across it and turn on. If E was really at 24V then there would be the same voltage on both pins of the solenoid, the solenoid would "see" 0V to it, and be off. I believe you indicated solenoid #1 is off.
HTH
TK
http://dynomotion.com
Ok good. Both solenoids have 24V across them and should therefore be activated. Are they?
TK
http://dynomotion.com
One is and one is not, and nothing can be controlled with the digital I/O screen.
Since both solenoids have power applied the solenoid that is not activated must be bad. Unless you made a mistake measuring the voltages. You might swap the solenoids. Or with everything else disconnected connect the 24V supply directly to each solenoid to see if it activates.
TK
http://dynomotion.com
I received a new kanalog board and after carefull install, everything works as it should.
I now need help with C code recognizing the S (speed)in my CNC G code to increase or decrease speed.
I believe the code should probably be an if/then statement like:
If(S>current speed) then set bit 159, and will it just clear when it reaches S?
Bit 158 is used to decrease, and bit 159 to increase.
Great.
That might work. The fist step will be to configure so that you are able to measure current speed. Do you have a quadrature encoder on your Spindle? What encoder input is it wired to? If so, configure and unused axis for Encoder Input and the InputChan0 to where it is connected. Then Configure KMotionCNC to display the Spindle speed as described here. Then verify the speed is measured and displayed correctly in KMotionCNC.
TK
http://dynomotion.com
Yes I have a speindle encoder hooked up to channel 7 and it reads and is displayed in KmotionCNC. I don't know if its displayed correctly, as far as I'm not sure it's exactly correct but it measures close to the speed dial on the machine. It was configured according to the dynomotion web site spindle settings information.
So, what do I just put in my c code to recognize S in the G code?
So, what do I put in my c code to recognize S in the G code? I may have found the answer to this question, but do I keep "UserData[9]" or change it to "UserData[7]"?
(float spd = *(float *)&persist.UserData[9]; // s value from g code)
You might try this. Set KMotionCNC S Action to pass the RPM in Var 9. And assign this program to execute/wait in Thread #3. It should monitor the speed 10 times per second, command the increase/decrease bits whenever the RPM is out of tolerance, and whenever in tolerance turn off the bits. After being in Tolerance continuously for 2 seconds it will terminate.
Code:#include "KMotionDef.h" #define TOL 10 #define STABLE_COUNT 20 void main() { float CurrentRPM, DesiredRPM; int Count=0; while (Count < STABLE_COUNT) // loop until stable at desired RPM { DesiredRPM = *(float *)&persist.UserData[9]; // s value from g code CurrentRPM = Spindle.TrueSpeedRPS * 60.0; if (CurrentRPM < DesiredRPM - TOL) // Need to increase? { ClearBit(158); SetBit(159); Count=0; // reset count } else if (CurrentRPM > DesiredRPM + TOL) // Need to decrease? { ClearBit(159); SetBit(158); Count=0; // reset count } else // within range { ClearBit(158); ClearBit(159); Count++; } Delay_sec(0.1); // don't change too quickly } }
TK
http://dynomotion.com
I ran this code last night and for some reason Bit 159 will not clear. I disconnected 159 from JP8 and disconnected the solenoid but the bit still would not clear. I'll try today to restart the computer and test it in the digital I/O screen to make sure everything is good on that end. I will also switch the solenoid with a spare I have to make sure it's not the solenoid.
Other than this is there anything else you can recommend I do?
To debug I'd change the Delay to 1 second to slow it down and add a print in the while loop before the delay such as:
printf("DesiredRPM = %f, CurrentRPM = %f\n", DesiredRPM, CurrentRPM);
Then look to see if the Desired RPM is being passed correctly and the Current RPM is being measured correctly.
TK
http://dynomotion.com
Ok, I did this but I don't know what screen I need to be looking at for debugging, Regardless I hooked everything back up and tested again and the same problem occurred. I disconnected the solenoid to Bit 159 and did some more test. I have found that in KmotionCNC, If I initialize the spindle CW or CCW then push the spindle stop button, Bit 159 will not clear, but if I push the large stop button which clears my Init. code and clears all axes (makes them turn yellow) then I can reset Bit 159.
I thought that if I added ClearBit (159); to the top of my Init. file that would help, but it did not. I also added ClearBit (159); to my spindle CW, CCW, and Stop codes which also did nothing to clear the problem.
Any suggestions?
The Console ScreenOk, I did this but I don't know what screen I need to be looking at for debugging,
Well that somewhat makes sense. When the Spindle Speed program is running it is looping constantly setting/clearing the bits. So you can't then change them manually. Actually you can but the program will immediately change them back to what it thinks they should be. What doesn't make sense to me is why the Spindle CW, CCW, or OFF button starts the program running. You were supposed to assign the program to the S Action. Not the M3, M4, M5 buttons. But yes once the Program runs it will loop and take over the bits until it thinks the speed is correct and then terminate itself and stop controlling the bits. If it never thinks the speed is correct then it will run forever controlling the bits or until The Red Stop button kills all programs (except Thread #1). Please post your Tool Setup | M0-M30 Actions so we can see how you configured them.I have found that in KmotionCNC, If I initialize the spindle CW or CCW then push the spindle stop button, Bit 159 will not clear, but if I push the large stop button which clears my Init. code and clears all axes (makes them turn yellow) then I can reset Bit 159.
TK
http://dynomotion.com
This is how their Configured. Bit 159 will activate as soon as I initiate the program regardless if S calls to speed up or down, even if Bit 158 is active.
I also included my Init. file. maybe I did something wrong setting up the Spindle DAC7