How to set arbitrary encoder position in C file


Results 1 to 6 of 6

Thread: How to set arbitrary encoder position in C file

  1. #1
    Member
    Join Date
    Aug 2006
    Location
    USA
    Posts
    25
    Downloads
    0
    Uploads
    0

    Default 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
    Member
    Join Date
    Jun 2004
    Location
    Scotland
    Posts
    355
    Downloads
    0
    Uploads
    0

    Default 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
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default 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


    Regards
    TK http://dynomotion.com


  4. #4
    Member
    Join Date
    Jun 2004
    Location
    Scotland
    Posts
    355
    Downloads
    0
    Uploads
    0

    Default 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
    Member
    Join Date
    Aug 2006
    Location
    USA
    Posts
    25
    Downloads
    0
    Uploads
    0

    Default

    That does not work. It alters destination but not current position. Verified this on console. "Pos" reads the same value before and after EnableAxisDest:

    Attachment 392523



  6. #6
    Member
    Join Date
    Jun 2004
    Location
    Scotland
    Posts
    355
    Downloads
    0
    Uploads
    0

    Default 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
    Member
    Join Date
    Aug 2006
    Location
    USA
    Posts
    25
    Downloads
    0
    Uploads
    0

    Default

    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.



  8. #8
    Member
    Join Date
    Jun 2004
    Location
    Scotland
    Posts
    355
    Downloads
    0
    Uploads
    0

    Default 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
  •  


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

How to set arbitrary encoder position in C file

How to set arbitrary encoder position in C file