586,036 active members*
3,532 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > Dynomotion/Kflop/Kanalog > How to set arbitrary encoder position in C file
Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2006
    Posts
    25

    How to set arbitrary encoder position in C file

    quick Q:

    how do we set arbitrary encoder position when homing in C file instead of Zero(ch)?

    is that right:
    DisableAxis(CHNO_X);
    chan[CHNO_X].Position = -0.1234567E+8; // X init point
    EnableAxis(CHNO_X);

  2. #2
    Join Date
    Jun 2004
    Posts
    355

    Re: How to set arbitrary encoder position in C file

    you want to use EnableChanDest(int ch, double Dest).

    So from your post -
    Code:
    DisableAxis(CHNO_X);
    EnableChanDest(CHNO_X, -0.123456E+8); X init Point

  3. #3
    Join Date
    May 2006
    Posts
    4045

    Re: How to set arbitrary encoder position in C file

    I think it is actually Axis not Chan

    Code:
    DisableAxis(CHNO_X);
    EnableAxisDest(CHNO_X, -0.123456E+8); // X init Point
    TK
    http://dynomotion.com

  4. #4
    Join Date
    Jun 2004
    Posts
    355

    Re: How to set arbitrary encoder position in C file

    You could well be right, and that would explain why my lathe still occasionally disables due to following error during initialisation...

  5. #5
    Join Date
    Aug 2006
    Posts
    25
    That does not work. It alters destination but not current position. Verified this on console. "Pos" reads the same value before and after EnableAxisDest:

    Click image for larger version. 

Name:	screen.jpg 
Views:	1 
Size:	20.3 KB 
ID:	392523

  6. #6
    Join Date
    Jun 2004
    Posts
    355

    Re: How to set arbitrary encoder position in C file

    I've not got a KFlop handy to test, but I thought that function should set the position to match the destination.

    You may need to use
    Code:
    ch0->position=-0.123456E6;
    However, AFAIK you can't use a constant to select the channel number, and I'm not sure if you'd also have to set the destination to match before enabling.

  7. #7
    Join Date
    Aug 2006
    Posts
    25
    that is same as was suggested in initial header post. "chan[CHNO_X].Position" type syntax allows to put some definition in to [] braces. And later "EnableAxis" seems to reset destination to current Pos. All looks to be working but lets wait confirmation from TomKerekes if there is no underwater stones doing so.
    Last edited by funding33; 05-05-2018 at 08:51 PM.

  8. #8
    Join Date
    Jun 2004
    Posts
    355

    Re: How to set arbitrary encoder position in C file

    So it is.
    In my defence, I've had a hard day!

    As long as it's updating the values how you want, then it's fine.
    I'm assuming you're now using chan[CHNO_X].Position to set the position, followed by EnableAxisDest[CHNO_X] to enable at the value you want?

Posting Permissions

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