Hurco BMC20 Dynomotion Retrofit - Page 22


Page 22 of 23 FirstFirst ... 121920212223 LastLast
Results 421 to 440 of 459

Thread: Hurco BMC20 Dynomotion Retrofit

  1. #421
    Member Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    578
    Downloads
    0
    Uploads
    0

    Default Re: Hurco BMC20 Dynomotion Retrofit

    Hi Tom,
    Think i got my return to home button delay figured out. I made another C code program (below) that does a move instead of a MDI. You see any potential problems with code below?

    Code:
    #include "KMotionDef.h"
    
    #define X 0
    #define Y 1
    #define Z 2
    
    
    main()
    {
        Move(Z,0);
    	while(!CheckDone(Z)) ;
    	Delay_sec(.1);
    
    
    	Move(Y,0);
    	Move(X,214428.75);
    	Delay_sec(.1);	
    	
    
    }
    Thanks,
    Troy

    www.tsjobshop.com, www.homecncstuff.elementfx.com


  2. #422
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Hurco BMC20 Dynomotion Retrofit

    Hi Troy,

    That should work.

    The XY motion moves independently and so may not be a straight line but I wouldn't think that matters to you.

    It starts the XY motion but doesn't wait for it to finish before exiting. But I doubt if that matters for a button.

    Code is indented poorly

    Regards
    TK http://dynomotion.com


  3. #423
    Member Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    578
    Downloads
    0
    Uploads
    0

    Default Re: Hurco BMC20 Dynomotion Retrofit

    Quote Originally Posted by TomKerekes View Post
    Hi Troy,

    .....

    Code is indented poorly
    Sorry teach...think it happened when i pasted it

    Thanks again,
    Troy

    www.tsjobshop.com, www.homecncstuff.elementfx.com


  4. #424
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Hurco BMC20 Dynomotion Retrofit

    Don't forget to check your work. Neatness counts.

    Regards
    TK http://dynomotion.com


  5. #425
    Member Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    578
    Downloads
    0
    Uploads
    0

    Default Re: Hurco BMC20 Dynomotion Retrofit

    I can be messy sometimes when iam trying to figure out things

    Now got the 2nd Konnect board connected with my momentary buttons and LEDs wired to it. Currently trying to get the Flood Coolant Button and its LED to work. Below is what i have so far but i get a compile error when i have 2 ClearBits in the "if" statement.
    What am i missing?

    Code:
    /// Handle Flood Coolant Pump
    result = Debounce(ReadBit(FLOODBBIT), &cocount, &colast, &colastsolid);
    if (result == 1)
    {
    	if (ReadBit(157) == 1)		//FloodPump
    	    ClearBit(157);		//FloodPump
    	ClearBit(1062);			//FloodButtonLED
    
    	else
    
    	SetBit(157);			//FloodPump
    	SetBit(1062);			//FloodButtonLED
    }


    www.tsjobshop.com, www.homecncstuff.elementfx.com


  6. #426
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Hurco BMC20 Dynomotion Retrofit

    Hi Troy,

    if/else only operate on one instruction or block. To operate on multiple instructions place them in a curly bracket block. You might read this article.

    Code:
    /// Handle Flood Coolant Pump
        result = Debounce(ReadBit(FLOODBBIT), &cocount, &colast, &colastsolid);
        if (result == 1)
        {
            if (ReadBit(157) == 1)    //FloodPump
            {
                ClearBit(157);        //FloodPump
                ClearBit(1062);        //FloodButtonLED
            }
            else
            {
                SetBit(157);        //FloodPump
                SetBit(1062);        //FloodButtonLED
            }
        }


    Regards
    TK http://dynomotion.com


  7. #427
    Member Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    578
    Downloads
    0
    Uploads
    0

    Default Re: Hurco BMC20 Dynomotion Retrofit

    Hi Tom,
    I tried a "variation" of that before and it didnt work. Reading and understanding c+ instructions is still a bit Greek to me.

    Now iam working on the Custom screen physical buttons and was doing a ScreenScript as you suggested a few posts back. Had to update to V4.35B as 4.34 did not support it. The custom screen buttons are working now but every time i power cycle machine no inputs are seen by Kmotion nor does any outputs work from Kanalog or Konnects. Until i click the INIT button on KMCNC screen. Never had to do this before. Currently have a physical button that runs the main INIT ccode and it works in version 4.34 after power cycle but not V4.35b.
    Did i miss a setting in KMCNC ?

    Thanks,
    Troy

    www.tsjobshop.com, www.homecncstuff.elementfx.com


  8. #428
    Member Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    578
    Downloads
    0
    Uploads
    0

    Default Re: Hurco BMC20 Dynomotion Retrofit

    I forgot my original setup used a keyboard emulator that my INIT button was also connected so i could overcome this issue after a power cycle. Is there a way to do this without a usb keyboard or mouse?

    Troy

    www.tsjobshop.com, www.homecncstuff.elementfx.com


  9. #429
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Hurco BMC20 Dynomotion Retrofit

    Hi Troy,

    So if I understand correctly the scenario is:

    1. You are running KMotionCNC
    2. Power down KFLOP (See disconnect message)
    3. Click OK on disconnect message
    4. Power up KFLOP
    5. Push hardware buttons connected to Konnect - nothing happens

    This would be expected as nothing is running in KFLOP to monitor buttons or execute things.

    The only solution I can think of is to Flash a program into KFLOP Thread #1 that runs on power up. It might be your Init Program or a stripped down version of it that does most of what the Init Program does except enabling the axes or communicating immediately with KMotionCNC (as it may not always be running when KFLOP is powered up).

    Or it might only configure Konnect, monitor the External Init Button, push the Init User Button. In this case only the External Init Button would work until the system was initialized. As a test I Flashed this:
    Code:
    #include "KMotionDef.h"
    
    #define TMP 10 // which spare persist to use to transfer data
    #include "KflopToKMotionCNCFunctions.c"
    
    main()
    {
    	while (ReadBit(46)) ;
    	DoPCInt(PC_COMM_USER_BUTTON,0);
    }
    HTH

    Regards
    TK http://dynomotion.com


  10. #430
    Member Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    578
    Downloads
    0
    Uploads
    0

    Default Re: Hurco BMC20 Dynomotion Retrofit

    The scenario is correct.

    Is this the correct procedure for flashing user program to selected thread at boot up?
    1. In Kmotion Ccode window open ccode in thread1.
    2. Click Download button in Kmotion Ccode window.
    3. Select Thread1 on Kmotion Config/Flash window.
    4.Click User Memory button on Config/Flash window.
    5. After flash is complete ,PowerCycle Kflop,Kanalog,Konnects.

    Here is ccode i tried but still nothing happens after boot up. If i open the below ccode in Kmotion and execute, then main INIT code runs.
    Code:
    #include "KMotionDef.h"
    #define TMP 10					// which spare persist to use to transfer data
    #include "KflopToKMotionCNCFunctions.c"
    
    main()
    {
    	InitAux();
    	AddKonnect(1, &VirtualBits, VirtualBitsEx);
    
    	{
    		while (ReadBit(1088));
    		DoPCInt(PC_COMM_USER_BUTTON, 0);
    	}
    }
    Troy

    www.tsjobshop.com, www.homecncstuff.elementfx.com


  11. #431
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Hurco BMC20 Dynomotion Retrofit

    Hi Troy,

    Between Step 1 and 2 you should push "Compile". Otherwise you could be downloading some earlier version of the program (the last compiled).

    I assume after power cycle you push the External INIT Button?

    You might add a 1 second delay after AddKonnect to be sure the bits are updated before checking the bit.

    Is your KMotionCNC running when you cycle power?

    Does IO 1088 go on or off when you push the button?

    After cycling power you might run KMotion.exe and check if Thread #1 has a green bar to indicate it has a running program before pushing the External Button.

    Regards
    TK http://dynomotion.com


  12. #432
    Member Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    578
    Downloads
    0
    Uploads
    0

    Default Re: Hurco BMC20 Dynomotion Retrofit

    Tom,

    Yes, i am Compiling before Download.

    "I assume after power cycle you push the External INIT Button?"
    Yes

    "You might add a 1 second delay after AddKonnect to be sure the bits are updated before checking the bit."
    Added delay.

    "Is your KMotionCNC running when you cycle power?"
    Tested with KMCNC running and not running with same issue.

    "Does IO 1088 go on or off when you push the button?"
    No.

    "After cycling power you might run KMotion.exe and check if Thread #1 has a green bar to indicate it has a running program before pushing the External Button."
    No green bar at any time unless i run it with Kmotion.

    Troy

    www.tsjobshop.com, www.homecncstuff.elementfx.com


  13. #433
    Member Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    578
    Downloads
    0
    Uploads
    0

    Default Re: Hurco BMC20 Dynomotion Retrofit

    Think i made a mistake with adding my second Konnect board. Changed code to what is below and now the Input 1088 is active and responds to my button press but main init code still will not run. And the thread is not running in Kmotion.

    Code:
    #include "KMotionDef.h"
    #define TMP 10					// which spare persist to use to transfer data
    #include "KflopToKMotionCNCFunctions.c"
    
    main()
    {
    	InitAux();
    	AddKonnect(1, VirtualBitsEx + 1, VirtualBitsEx + 2);
    
    	{
    		while (ReadBit(1088));
    		DoPCInt(PC_COMM_USER_BUTTON, 0);
    	}
    }
    Troy

    www.tsjobshop.com, www.homecncstuff.elementfx.com


  14. #434
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Hurco BMC20 Dynomotion Retrofit

    Hi Troy,

    "Does IO 1088 go on or off when you push the button?"
    No.
    I was asking the polarity of the switch and wiring. When the External Button is working correctly is the state normally off but then goes on when pushed?

    I don't see a delay in your corrected code.

    Is User Button 0 the INIT Button?

    As a sanity check you might try the program I posted. Verify the Green Bar remains on indicating Thread 1 is running after a power cycle. The verify the system initializes if you turn off KFLOP's LED (Bit46).

    Another test would be to blink an LED in the Program to verify it actually runs on power up. Such as add:

    Code:
    	int i;
    	for (i=0; i<10; i++)  // blink led 10 times
    	{
    		ClearBit(47);
    		Delay_sec(0.5);
    		SetBit(47);
    		Delay_sec(0.5);
    	}
    btw the code has an unnecessary set of curly brackets. Won't have any effect but just makes it confusing to read.

    Regards
    TK http://dynomotion.com


  15. #435
    Member Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    578
    Downloads
    0
    Uploads
    0

    Default Re: Hurco BMC20 Dynomotion Retrofit

    "I was asking the polarity of the switch and wiring. When the External Button is working correctly is the state normally off but then goes on when pushed?"
    Yes, goes on when pushed.

    I have the delay in the code i was testing on the mill itself.

    The blink code you posted will not compile. Says " declaration expected".

    Troy

    www.tsjobshop.com, www.homecncstuff.elementfx.com


  16. #436
    Member Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    578
    Downloads
    0
    Uploads
    0

    Default Re: Hurco BMC20 Dynomotion Retrofit

    Did a test by Flashing my entire Main INIT program to boot in 1st thread. After Kflop boot up the main init program runs and enables machine like the program always does and DigitalIO screen in Kmotion shows all inputs are working, including 1088 which is my main INIT button. But,KMCNC does not recognize that the main INIT program has been ran.Also, KMCNC does not respond when i try to reinitialize with my physical main INIT button, until i use the USB keyboard or mouse to click the on screen button to run main INIT program for the first time. Button is labeled IDC_But0 in the screen editor.

    Troy

    www.tsjobshop.com, www.homecncstuff.elementfx.com


  17. #437
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Hurco BMC20 Dynomotion Retrofit

    Hi Troy,

    "I was asking the polarity of the switch and wiring. When the External Button is working correctly is the state normally off but then goes on when pushed?"
    Yes, goes on when pushed.
    In this case we should wait while the bit is not on rather then while it is on. Change:

    while (ReadBit(1088));

    to

    while (!ReadBit(1088));


    The blink code you posted will not compile. Says " declaration expected".
    I meant the first program I posted that waits for Bit46 to be turned off to push the button. The blink code is only some code that could be inserted into a program.


    But,KMCNC does not recognize that the main INIT program has been ran
    I'm not sure what you mean by this.

    Regards
    TK http://dynomotion.com


  18. #438
    Member Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    578
    Downloads
    0
    Uploads
    0

    Default Re: Hurco BMC20 Dynomotion Retrofit

    Tom,

    In this case we should wait while the bit is not on rather then while it is on. Change:

    while (ReadBit(1088));

    to

    while (!ReadBit(1088));
    Thats all that was needed . It works now.


    Onto other buttons, there is a few more i will need help with...... in ccode here.

    One is the Block Delete button. I have it toggling the check box in KMCNC but cant figure out how to toggle the LED for this button. Here is code i have so far.


    Code:
    /// Handle Blk Del Button
    result = Debounce(ReadBit(BLKDELBBIT), &blkdelbcount, &blkdelblast, &blkdelblastsolid);
    if (result == 1)
    {
    	SetBit(1059);				//BlkDel Button LED
    	ScreenScript("WinMsg:DlgName;IDC_BlockDelete;BM_CLICK");	//toggle
    	//ClearBit(1059);
    	//ScreenScript("WinMsg:DlgName;IDC_BlockDelete;BM_SETCHECK;BST_CHECKED");   //Check it
    	//ScreenScript("WinMsg:DlgName;IDC_BlockDelete;BM_SETCHECK;BST_UNCHECKED");
    }
    Troy

    www.tsjobshop.com, www.homecncstuff.elementfx.com


  19. #439
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Hurco BMC20 Dynomotion Retrofit

    Hi Troy,

    Toggling a bit is easy: "If on, turn off, else turn on"

    Code:
    	if (ReadBit(1059))  // on?
    		ClearBit(1059);  // yes, turn off
    	else
    		SetBit(1059);  // no, turn on
    Or easier still "Set state to opposite state"

    Code:
        SetStateBit(1059,!ReadBit(1059));  // toggle bit

    But I see a problem. There isn't a way for KFLOP to read the Block Delete. So if the Operator clicks on the screen to toggle it then the screen and your LED will be out of sync. I can't think of a solution other than adding functionality to read checkboxes.

    Regards
    TK http://dynomotion.com


  20. #440
    Member Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    578
    Downloads
    0
    Uploads
    0

    Default Re: Hurco BMC20 Dynomotion Retrofit

    Is there another way besides checking a box?Or can Check Box be changed to something else? For me i dont need to see the on screen status if my LED would be in sync.

    www.tsjobshop.com, www.homecncstuff.elementfx.com


Page 22 of 23 FirstFirst ... 121920212223 LastLast

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
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Hurco BMC20 Dynomotion Retrofit

Hurco BMC20 Dynomotion Retrofit