Tom, is it possible to output rs322 / 422 angular signals of rotational axes in degrees in 0/360 format? for kflop wiht canalog thanksdalmazio
Tom, is it possible to output rs322 / 422 angular signals of rotational axes in degrees in 0/360 format? for kflop wiht canalog thanksdalmazio
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-360degreesHTHCode:#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); }
Regards
TK
http://dynomotion.com
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
Hi dalmazio,
Sorry I don’t understand the question.
TK
http://dynomotion.com
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
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
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
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
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
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
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
Hi Dalmazio,
Replace 'x' with your channel number. ie. ch3
TK
http://dynomotion.com
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
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