587,034 active members*
3,184 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > Dynomotion/Kflop/Kanalog > starting my C program, any guidance would be appreciated.
Page 7 of 11 56789
Results 121 to 140 of 215
  1. #121

    Re: starting my C program, any guidance would be apreciated.

    A.0v
    B.24v
    C.24v
    D.24v
    E.0v
    F.0v
    G.24v
    H.0v will activate.

  2. #122
    Join Date
    May 2006
    Posts
    4047

    Re: starting my C program, any guidance would be apreciated.

    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

  3. #123

    Re: starting my C program, any guidance would be apreciated.

    This is still what Im getting.
    A.0v
    B.24v
    C.24v
    D.24v
    E.0v
    F.0v
    G.24v
    H.0v will activate.
    Attached Thumbnails Attached Thumbnails JP8.png  

  4. #124
    Join Date
    May 2006
    Posts
    4047

    Re: starting my C program, any guidance would be apreciated.

    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

  5. #125

    Re: starting my C program, any guidance would be apreciated.

    Quote Originally Posted by TomKerekes View Post
    Great. The diagram is much better, but still has one mistake. JP8 #6 and #7 are shown shorted together. I assume they aren't?
    I missed that line.

    Quote Originally Posted by TomKerekes View Post
    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.
    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.
    Attached Thumbnails Attached Thumbnails JP8.png  

  6. #126
    Join Date
    May 2006
    Posts
    4047

    Re: starting my C program, any guidance would be apreciated.

    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.
    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.

    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

  7. #127

    Re: starting my C program, any guidance would be apreciated.

    Quote Originally Posted by TomKerekes View Post
    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.
    I disconnected and reconnected all the wires then measured again, and now I'm getting 0v on all of the neutral wires and 24v on all the pos(+) wires.
    Attached Thumbnails Attached Thumbnails JP8.png  

  8. #128
    Join Date
    May 2006
    Posts
    4047

    Re: starting my C program, any guidance would be apreciated.

    Ok good. Both solenoids have 24V across them and should therefore be activated. Are they?
    TK
    http://dynomotion.com

  9. #129

    Re: starting my C program, any guidance would be apreciated.

    One is and one is not, and nothing can be controlled with the digital I/O screen.

  10. #130
    Join Date
    May 2006
    Posts
    4047

    Re: starting my C program, any guidance would be apreciated.

    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

  11. #131

    Re: starting my C program, any guidance would be apreciated.

    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.

  12. #132
    Join Date
    May 2006
    Posts
    4047

    Re: starting my C program, any guidance would be apreciated.

    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

  13. #133

    Re: starting my C program, any guidance would be apreciated.

    Quote Originally Posted by TomKerekes View Post
    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.
    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?

  14. #134

    Re: starting my C program, any guidance would be apreciated.

    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)

  15. #135
    Join Date
    May 2006
    Posts
    4047

    Re: starting my C program, any guidance would be apreciated.

    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

  16. #136

    Re: starting my C program, any guidance would be apreciated.

    Quote Originally Posted by TomKerekes View Post
    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
        }
    }
    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?

  17. #137
    Join Date
    May 2006
    Posts
    4047

    Re: starting my C program, any guidance would be apreciated.

    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

  18. #138

    Re: starting my C program, any guidance would be apreciated.

    Quote Originally Posted by TomKerekes View Post
    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.
    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?

  19. #139
    Join Date
    May 2006
    Posts
    4047

    Re: starting my C program, any guidance would be apreciated.

    Ok, I did this but I don't know what screen I need to be looking at for debugging,
    The Console Screen

    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.
    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.
    TK
    http://dynomotion.com

  20. #140

    Re: starting my C program, any guidance would be apreciated.

    Quote Originally Posted by TomKerekes View Post
    The Console Screen
    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.
    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.

    Quote Originally Posted by TomKerekes View Post
    Please post your Tool Setup | M0-M30 Actions so we can see how you configured them.
    I also included my Init. file. maybe I did something wrong setting up the Spindle DAC7

Page 7 of 11 56789

Similar Threads

  1. Starting at New CNC Build -- Guidance Needed!!
    By dtmille2 in forum DIY CNC Router Table Machines
    Replies: 21
    Last Post: 01-02-2013, 05:00 AM
  2. Need some guidance on starting out
    By AlanDv in forum DIY CNC Router Table Machines
    Replies: 2
    Last Post: 08-20-2011, 05:13 AM
  3. starting program
    By chucker in forum Fanuc
    Replies: 2
    Last Post: 11-10-2009, 07:28 PM
  4. Starting program in fanuc 6m
    By Bolle_Ma in forum Fanuc
    Replies: 4
    Last Post: 10-17-2008, 09:11 AM
  5. Starting knee-mill retrofit. Your input appreciated.
    By jamma in forum Uncategorised MetalWorking Machines
    Replies: 2
    Last Post: 03-01-2007, 05:41 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •