Viewing console from KmotionCNC - Page 2


Page 2 of 2 FirstFirst 12
Results 13 to 21 of 21

Thread: Viewing console from KmotionCNC

  1. #13
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2930
    Downloads
    0
    Uploads
    0

    Default Re: Viewing console from KmotionCNC

    Hi Mark,

    Thanks but unfortunately I'm not able to see any delay with these files or any others I've tried.

    One remote possibility is:

    IPR = Rate / RPM;

    this could be a divide by zero if the Spindle RPM is zero or near zero. That could result in IPR being a 300+ digit number causing the 80 char array buffer to overrun and cause memory corruption. But forcing that didn't seem to do what you see. There should really be a test for near zero ie. if (RPM < 0.01)

    Otherwise any other info/clues you could provide on how to duplicate would help. It appears you have some other C Programs to set the Start Cycle time and such that you haven't provided. Also the Tool Setup for Threads, Vars, etc... might be helpful.

    You might also delete functionality piece-by-piece to find specifically what triggers the issue. It might even be totally unrelated to the custom screen for that matter.

    Regards



  2. #14
    Registered
    Join Date
    May 2012
    Location
    canada
    Posts
    315
    Downloads
    0
    Uploads
    0

    Default Re: Viewing console from KmotionCNC

    Hi Tom,

    Thanks for the help. As a test i blocked all the calculations with comments and just set IPR equal to 0.010 and its still slow. And on the other hand I tried letting all the calculations run and blocked the DROLabel(1000, 151,s); line and it runs perfect. So seems like this line is causing the trouble. Runs ok with this code:

    Code:
    for (;;)  // forever loop
    	{
    
    		// set jog rate
    		UpdateJogSpeeds();
    		Delay_sec(0.05);
    		// end set jog rate
    
    
    		//Display FPR
    		
    		t0=WaitNextTimeSlice();
    		x0 = ch0->Dest / CNTS_PER_INCH_X;
    		y0 = ch1->Dest / CNTS_PER_INCH_Y;
    		z0 = ch2->Dest / CNTS_PER_INCH_Z;
    		t1=WaitNextTimeSlice();
    		dx = ch0->Dest / CNTS_PER_INCH_X - x0;
    		dy = ch1->Dest / CNTS_PER_INCH_Y - y0;
    		dz = ch2->Dest / CNTS_PER_INCH_Z - z0;
    		
    		d = sqrt(dx*dx + dy*dy + dz*dz);
    
    		Rate = d/(t1-t0)*60.0;
    		
    		float RPM = *(float *)&persist.UserData[9]; // s value from g code
    
    		
    		IPR = Rate / RPM;
    		if (!ReadBit (154) && !ReadBit (155)) IPR = 0;
    
    		sprintf(s,"Feed = %1.3f ipr\n",IPR);
    		//DROLabel(1000, 151,s);
    	}
    Let me know if you have any more suggestions. Also you said 1000 refers the portion of memory used to handle this, would it be worth trying a different number? Thanks again.

    Mark



  3. #15
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2930
    Downloads
    0
    Uploads
    0

    Default Re: Viewing console from KmotionCNC

    Hi Mark,

    Well that confirms sending the data is the issue as expected. But no clue why you have an issue and I don't.

    When KMotionCNC reads the persist 151 as non zero indicating a new string to display it reads a fixed block of 200 characters from the gather buffer. The 200 characters are read as hex values so each character takes about 2 bytes through the USB. So it involves about 400 bytes of USB traffic.

    The example program SimpleFormsCS.exe has a button to test USB Speed. I have a fairly fast computer and get:
    KFLOP->PC N=100000 Int32, Time=1.971 sec, 450KBytes/sec

    So 400 bytes should take < 1ms, so should only use ~ 1% of the USB bandwidth (KMotionCNC only checks for messages to upload every 100ms regardless of how often you set them to upload in KFLOP).

    Please run the test on your computer and see what you get.

    Do you have a USB Isolator or anything between KFLOP and your Computer?

    Regards



  4. #16
    Registered
    Join Date
    May 2012
    Location
    canada
    Posts
    315
    Downloads
    0
    Uploads
    0

    Default Re: Viewing console from KmotionCNC

    Quote Originally Posted by TomKerekes View Post
    Hi Mark,

    Well that confirms sending the data is the issue as expected. But no clue why you have an issue and I don't.

    When KMotionCNC reads the persist 151 as non zero indicating a new string to display it reads a fixed block of 200 characters from the gather buffer. The 200 characters are read as hex values so each character takes about 2 bytes through the USB. So it involves about 400 bytes of USB traffic.

    The example program SimpleFormsCS.exe has a button to test USB Speed. I have a fairly fast computer and get:
    KFLOP->PC N=100000 Int32, Time=1.971 sec, 450KBytes/sec

    So 400 bytes should take < 1ms, so should only use ~ 1% of the USB bandwidth (KMotionCNC only checks for messages to upload every 100ms regardless of how often you set them to upload in KFLOP).

    Please run the test on your computer and see what you get.

    Do you have a USB Isolator or anything between KFLOP and your Computer?

    Regards
    Hi Tom,

    Im ran the test and here are the results. Older computer with windows 7. Seems pretty good. The PC to kflop times are much slower. Is that ok? Also you mention kmotion reads a fixed block of 200 characters from the gather buffer. Should we be spacing out the offset in the C program by 200 as well? I used 1000,1100 and 1200 I think.

    So just to be sure were on the same page, the actual DRO was updating fine. Displaying IPR and updating very fast. Trouble im having is a delay when hitting the button to open tool offsets and fixture offsets. Thanks again.

    Mark

    Attached Thumbnails Attached Thumbnails Viewing console from KmotionCNC-test-jpg  


  5. #17
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2930
    Downloads
    0
    Uploads
    0

    Default Re: Viewing console from KmotionCNC

    Hi Mark,

    The PC to kflop times are much slower. Is that ok?
    That seems slow. I've never seen any computer have rates < 300KB/s.

    I think I had things running I wasn't aware of before. Now with nothing except SimpleFormsCS.exe I'm getting

    PC->KFLOP N=100000 Int32, Time=1.670 sec, 531KBytes/sec
    KFLOP->PC N=100000 Int32, Time=1.057 sec, 840KBytes/sec

    Note that this USB test uses the Gather buffer from 0-400000 so it causes KMotionCNC to get all manner of errors if the DROLabels are using that range.

    Also you mention kmotion reads a fixed block of 200 characters from the gather buffer. Should we be spacing out the offset in the C program by 200 as well? I used 1000,1100 and 1200 I think.
    That shouldn't matter as long as the Label messages are less than 100 characters long. It just means the next message is uploaded to KMotionCNC (and not used) instead of extra empty/junk data after the real message.

    Sorry I can't duplicate it or imagine what it might be. To bring up the Dialogs doesn't require any communication. It only reads a disk file and displays a dialog. I don't believe the Offset Screen even needs to read a disk file (the offsets are in memory). But adding the DRO traffic somehow causes it. Bizarre. It seems KMotionCNC is stalled/busy waiting for something. I would expect every GUI operation to be delayed not just those dialogs.

    You might try removing and updating the KFLOP USB Driver to the one in V4.34

    Would it be possible to try a different computer?

    Are you able to compile and debug KMotionCNC? If so if you can cause the delay and quickly hit "break all" in Visual Studio KMotionCNC would likely be in a tight loop doing something or waiting on something. What it was doing would be a big clue.

    Sorry for no simple answer.

    Regards



  6. #18
    Registered
    Join Date
    Jun 2004
    Location
    Scotland
    Posts
    319
    Downloads
    0
    Uploads
    0

    Default Re: Viewing console from KmotionCNC

    Could it be the USB port on the computer is going via a couple internal hubs, which happen to be handling something else causing bandwidth latency/speed issues?

    Another port may avoid the problem.
    I can't remember exactly where, but in device manager it is possible to get a hierarchy view, so you can see how many hubs any given device is actually passing through.



  7. #19
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2930
    Downloads
    0
    Uploads
    0

    Default Re: Viewing console from KmotionCNC

    Hi Mark,

    I wouldn't expect a hub to be a problem unless the other USB devices have extreme traffic. My tests were performed through a hub.

    Microsoft has a tool called USB Device Viewer. Here is a View on my system:

    Viewing console from KmotionCNC-usbview-jpg

    My system already had it as I installed the SDK at some point. Here is Microsoft info:
    https://docs.microsoft.com/en-us/win...to-get-usbview

    Regards



  8. #20
    Registered
    Join Date
    May 2012
    Location
    canada
    Posts
    315
    Downloads
    0
    Uploads
    0

    Default Re: Viewing console from KmotionCNC

    Quote Originally Posted by TomKerekes View Post
    Hi Mark,

    That seems slow. I've never seen any computer have rates < 300KB/s.

    I think I had things running I wasn't aware of before. Now with nothing except SimpleFormsCS.exe I'm getting

    PC->KFLOP N=100000 Int32, Time=1.670 sec, 531KBytes/sec
    KFLOP->PC N=100000 Int32, Time=1.057 sec, 840KBytes/sec

    Note that this USB test uses the Gather buffer from 0-400000 so it causes KMotionCNC to get all manner of errors if the DROLabels are using that range.

    That shouldn't matter as long as the Label messages are less than 100 characters long. It just means the next message is uploaded to KMotionCNC (and not used) instead of extra empty/junk data after the real message.

    Sorry I can't duplicate it or imagine what it might be. To bring up the Dialogs doesn't require any communication. It only reads a disk file and displays a dialog. I don't believe the Offset Screen even needs to read a disk file (the offsets are in memory). But adding the DRO traffic somehow causes it. Bizarre. It seems KMotionCNC is stalled/busy waiting for something. I would expect every GUI operation to be delayed not just those dialogs.

    You might try removing and updating the KFLOP USB Driver to the one in V4.34

    Would it be possible to try a different computer?

    Are you able to compile and debug KMotionCNC? If so if you can cause the delay and quickly hit "break all" in Visual Studio KMotionCNC would likely be in a tight loop doing something or waiting on something. What it was doing would be a big clue.

    Sorry for no simple answer.

    Regards
    Hi Tom,

    I appreciate the help but I think I might just let this one go. I really dont need IPR display, it was sort of nice on the Mazak I used to run at my old job, but as I said I really dont need it. Sounds like it could be a lot of work to get this going and I dont really have the time right now to invest for something so simple. Im not sure how to compile and debug Kmotioncnc. I dont have any programming experience or knowledge other then the little bit of C programming that I learned just to use with kflop.

    I don't have an extra computer to try right now but I was planning on setting up another one as a backup just in case this one causes trouble. If I ever get around to that ill try it again and see if theres any difference. But for now I think ill just live with out feed per rev display. Thanks again for all the help.

    Mark



  9. #21
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2930
    Downloads
    0
    Uploads
    0

    Default Re: Viewing console from KmotionCNC

    Hi Mark,

    Ok thanks for posting back. Let us know if things change.

    Regards



Page 2 of 2 FirstFirst 12

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

Viewing console from KmotionCNC

Viewing console from KmotionCNC