ouput signal

1. ## 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. ## 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

3. ## 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. ## Re: ouput signal

Hi dalmazio,

Sorry I don’t understand the question.

5. ## 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. ## 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.

7. ## 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. ## 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?

9. ## 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. ## 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```

11. ## 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. ## Re: ouput signal

Hi Dalmazio,

Replace 'x' with your channel number. ie. ch3

#### Posting Permissions

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