Page 1 of 1

Can't zero axis Kflop+Kanalog

Posted: Mon Feb 26, 2018 10:59 am
by EX854508
Hello everyone! Can't zero axes on Kflop+Kanalog board. I use virtual bits 36 and 37 of Kanalog Board JP2 terminals to zero axes by encoders' zero marks, but it doesn't work. SetDirectionBit(36,0) and SetDirectionBit(37,0) are announced. I've tried to use virtual bits 6 and 7 of JP1 terminal to zero axis and it worked, but I need them for another device. Kmotion version is 4.34j. Please help :!:

#include "KMotionDef.h"

int DoPC(int cmd);
int DoPCInt(int cmd, int i);
#define GATH_OFF 0 // define the offset into the Gather buffer where strings are passed

main()
{

SetBitDirection(36,0); // Х
SetBitDirection(37,0); // Y
//for X
Jog(0,-2500);
while (ReadBit(140)) ;
Zero(0);
Jog(0,0);
Jog(0,1000);
while (!ReadBit(36)) ;
Zero(0);
Jog(0,0);


//for Y
Jog(1,15000);
while (!ReadBit(141)) ;
Zero(1);
Jog(1,0);
Jog(1,-1000);
while (!ReadBit(37)) ;
Zero(1);
Jog(1,0);

MDI("G92.1"); // clean offsets
}

// put the MDI string (Manual Data Input - GCode) in the
// gather buffer and tell the App where it is
int MDI(char *s)
{
char *p=(char *)gather_buffer+GATH_OFF*sizeof(int);
int i;

do // copy to gather buffer w offset 0
{
*p++ = *s++;
}while (s[-1]);

// issue the command an wait till it is complete
// (or an error - such as busy)
return DoPCInt(PC_COMM_MDI,GATH_OFF);
}


// Put an integer as a parameter and pass the command to the App
int DoPCInt(int cmd, int i)
{
int result;
persist.UserData[PC_COMM_PERSIST+1] = i;
return DoPC(cmd);
}

// Pass a command to the PC and wait for it to handshake
// that it was received by either clearing the command
// or changing it to a negative error code
int DoPC(int cmd)
{
int result;

persist.UserData[PC_COMM_PERSIST]=cmd;

do
{
WaitNextTimeSlice();
}while (result=persist.UserData[PC_COMM_PERSIST]>0);

return result;
}

Re: Can't zero axis Kflop+Kanalog

Posted: Mon Feb 26, 2018 6:47 pm
by TomKerekes
Hi EX854508,

It isn't clear what you are doing.

Bits 36 and 37 are not Virtual Bits. Those are real physical IO Bits. They default as inputs so it isn't necessary to set their direction, but it doesn't do any harm. When using Kanalog, KFLOP Bits 36 and 37 receive the differential signals connected to Kanalog JP2 A4 and B4. Do you have your Axis 0 Index Pulse wired to Kanalog JP2 pins 1 and 2? Do you have your Axis 1 Index Pulse wired to Kanalog JP2 pins 3 and 4? This is described here:
http://dynomotion.com/Help/SchematicsKa ... analog.htm

You will also need the RJ45 connection between KFLOP JP5 and Kanalog JP9 for this to work.

Regards

Re: Can't zero axis Kflop+Kanalog

Posted: Mon Feb 26, 2018 8:28 pm
by EX854508
Yes, Axis 0 Index pulse connected to JP2 1 and 2 pins, Axis 1 Index Pulse connected to Kanalog JP2 pins 3 and 4.
When I wired Axis 0 Index Pulse to JP1 pins 13 and 14, Axis 1 Index Pulse to JP1 pins 15 and 16 and changed bits as nessesary for bits 6 and 7 it all worked.
Kanalog connected with kflop vith rj45 connection.

Re: Can't zero axis Kflop+Kanalog

Posted: Mon Feb 26, 2018 8:50 pm
by TomKerekes
Hi EX854508,

I don't know. That should work.

Is the RJ45 cable plugged all the way in insecurely? Does the RJ45 cable look damaged? Is it the straight through cable Dynomotion supplied?

You might test JP2 pins 1 & 2 by connecting an encoder channel. Then see if Bit 36 Toggles as the Encoder moves.

Or apply a fixed voltage such as 3.3V to + and GND to - to see if Bit 36 comes on. Then reverse to apply 3.3V to - and GND to + to see if Bit 36 goes off.

Regards

Re: Can't zero axis Kflop+Kanalog

Posted: Tue Feb 27, 2018 11:25 am
by EX854508
Hi, Tom!
Everything worked when I used 40 and 41 bits.

Re: Can't zero axis Kflop+Kanalog

Posted: Tue Feb 27, 2018 12:41 pm
by EX854508
tried to check 36 and 37 pins as you wrote, it doesn't work

Re: Can't zero axis Kflop+Kanalog

Posted: Tue Feb 27, 2018 4:29 pm
by TomKerekes
You didn’t tell us which things you tried and what happened.

You might check KFLOP IO 36 and 37. Unplug Kanalog. Set IO 36 and 37 as Outputs. Toggle their state. Check if they change.

You might Flash New Version to remove any configuration changes or programs you might have made. Then power cycle and test before running any of your C Programs.