585,752 active members*
4,073 visitors online*
Register for free
Login

Thread: ouput signal

Results 1 to 14 of 14
  1. #1
    Join Date
    Oct 2014
    Posts
    27

    ouput signal

    Tom, is it possible to output rs322 / 422 angular signals of rotational axes in degrees in 0/360 format? for kflop wiht canalog thanksdalmazio

  2. #2
    Join Date
    May 2006
    Posts
    4045

    Re: ouput signal

    Hi dalmazio,

    I assume you meant RS232 port?

    Yes that should be possible. Periodically sample the current axis Destination or Position, convert to degrees, perform modulo 360, write to port.

    You might look at the Modulo360.c example used to reset the current axis position to 0-360degrees
    Code:
    #include "KMotionDef.h"
    
    #define CNTS_PER_DEG 1000.0
    #define AXISA 4
    
    double modf(double, double*); // returns integer part with more han 32-bit precision
    
    double floor(double x) // truncate down toward -ininity
    {
       double y; 
       return (modf(x, &y) < 0 ? y - 1 : y);
    }
    
    main()
    {
        double dest = chan[AXISA].Dest;
        double cnts = CNTS_PER_DEG * 360.0;
        EnableAxisDest(AXISA, dest - (floor(dest/cnts)) * cnts);
    }
    HTH
    Regards
    TK
    http://dynomotion.com

  3. #3
    Join Date
    Oct 2014
    Posts
    27

    Re: ouput signal

    dear tom, I use the kanalog and if active the suggested program for the rs232 stops the system, works with the programs write and read kanalog rs232, another question, it is possible to have the imput encoder signals divided x180 on the digital outputs for two axes ? thanks dalmazio

  4. #4
    Join Date
    May 2006
    Posts
    4045

    Re: ouput signal

    Hi dalmazio,

    Sorry I don’t understand the question.
    TK
    http://dynomotion.com

  5. #5
    Join Date
    Oct 2014
    Posts
    27

    Re: ouput signal

    We can move two axes in degree with Kflop integrated in a Kanalog. Could you explain us and
    give us the indication to reach a position in degree outside the kanalog through RS232?
    Or also to reach the differential signal of the encoder divided into 180 times to follow the conversion in degrees with ARDUINO.
    The reduction is necessary because the number of pulses in the Kanalog input is very high.
    Y inform that if Y start the program ENABLE RS 232 the KFLOP crashed.
    thanks a lot Dalmazio

  6. #6
    Join Date
    May 2006
    Posts
    4045

    Re: ouput signal

    Hi Dalmazio,

    Sorry I still don't understand.

    Do you want your Arduino to send a command to KFLOP to move an axis?

    Do you want to send the current commanded Destination divided by 180 out to your Arduino?

    If you configure KFLOP to receive commands from RS232 then the USB commands will no longer function.
    TK
    http://dynomotion.com

  7. #7
    Join Date
    Oct 2014
    Posts
    27

    Re: ouput signal

    Do you want to send the current commanded Destination divided by 180 out to your Arduino?


    yes, I convert them to degrees to send them to a remote display

  8. #8
    Join Date
    May 2006
    Posts
    4045

    Re: ouput signal

    Hi Dalmazio,

    Well you can simply divide the commanded destination for channel 'x' with:

    double value;

    value = chx->Dest / 180.0;

    What format do you want to send the value in over the RS232? ASCII characters?
    TK
    http://dynomotion.com

  9. #9
    Join Date
    Oct 2014
    Posts
    27

    Re: ouput signal

    BR dear tom, I need to send the display reading out of the kflop or knalog in angular degrees format via rs232 kanalog, if it is not possible the encoder inputs divided by 180 to convert them with arduino 2

    for the rs232 in hexadecimal I think it is appropriate, tanks

  10. #10
    Join Date
    May 2006
    Posts
    4045

    Re: ouput signal

    Hi Dalmazio,

    I still don't really understand. But to convert the value as hexadecimal integer. You might:

    Code:
    double value;
    int ivalue;
    char s[20];
    
    value = chx->Dest / 180.0;  // divide destination by 180
    
    ivalue = (int)value;  // convert to integer
    
    sprintf(s,"%8X",ivalue);  // convert integer to 8 hexadecimal characters
    TK
    http://dynomotion.com

  11. #11
    Join Date
    Oct 2014
    Posts
    27

    Re: ouput signal

    HIi Tom
    double value;
    int ivalue;
    char s[20];

    stop compilation error value = chx->Dest / 180.0; // divide destination by 180

    ivalue = (int)value; // convert to integer

    sprintf(s,"%8X",ivalue); // convert integer to 8 hexadecimal characters
    tanks regards

  12. #12
    Join Date
    May 2006
    Posts
    4045

    Re: ouput signal

    Hi Dalmazio,

    Replace 'x' with your channel number. ie. ch3
    TK
    http://dynomotion.com

  13. #13
    Join Date
    Oct 2014
    Posts
    27

    Re: ouput signal

    dear tom, with the program rs232read, can only communicate with the console kamotion that prints them in hexadecimal, and does not execute the command, how can I translate it because the axis moves with a command like move0 = 500 via serial rs232 tanks dalmazio

  14. #14
    Join Date
    May 2006
    Posts
    4045

    Re: ouput signal

    Hi Dalmazio,

    Sorry I don't understand what you are doing or trying to do.

    If you want to have KFLOP receive Move commands from the RS232 port you will need to write a C Program that receives the command and parameter characters, converts the parameter characters to a value, then calls a C Function to Move.

    sscanf can be used to convert characters to a variable

    Move(0, value); can be used to move axis 0 to some destination
    TK
    http://dynomotion.com

Similar Threads

  1. convert 5v PWM signal into analog signal ranges from -10 to +10 v
    By Hamayel in forum CNC Machine Related Electronics
    Replies: 2
    Last Post: 12-12-2015, 10:05 AM
  2. Haas RS232 Data Ouput to external micro controller
    By mechplans in forum Haas Mills
    Replies: 1
    Last Post: 02-26-2015, 08:35 PM
  3. ouput for spindle
    By adamchapman in forum Hobbycnc (Products)
    Replies: 0
    Last Post: 07-15-2012, 08:10 PM
  4. Average ouput per CNC programmer/machinist
    By CNCStrategist in forum Employment Opportunity
    Replies: 10
    Last Post: 07-25-2010, 07:39 PM
  5. 1.6V-3.0V random signal voltage parallel signal from output – Any advice?
    By cjchands in forum Mach Software (ArtSoft software)
    Replies: 0
    Last Post: 11-12-2009, 11:36 AM

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
  •