Seperate +/- limit switch status bits.

This commit is contained in:
Ron Sluiter
2002-07-05 19:27:24 +00:00
parent 1252efb6b3
commit 71bc4b0e2d
5 changed files with 118 additions and 66 deletions
+24 -10
View File
@@ -3,9 +3,9 @@ FILENAME... drvIM483PL.c
USAGE... Motor record driver level support for Intelligent Motion
Systems, Inc. IM483(I/IE).
Version: $Revision: 1.5 $
Version: $Revision: 1.6 $
Modified By: $Author: sluiter $
Last Modified: $Date: 2002-04-15 20:20:23 $
Last Modified: $Date: 2002-07-05 19:22:33 $
*/
/*
@@ -260,7 +260,7 @@ STATIC int set_status(int card, int signal)
int status;
int rtn_state;
double motorData;
BOOLEAN plusdir;
BOOLEAN plusdir, ls_active = OFF;
cntrl = (struct IM483controller *) motor_state[card]->DevicePrivate;
motor_info = &(motor_state[card]->motor_info[signal]);
@@ -341,10 +341,24 @@ STATIC int set_status(int card, int signal)
recv_mess(card, buff, 1);
status = atoi(&buff[5]);
if ((plusdir == ON && (status & 1)) || (plusdir == OFF && (status & 2)))
motor_info->status |= RA_OVERTRAVEL;
/* Set limit switch error indicators. */
if (status & 1)
{
motor_info->status |= RA_PLUS_LS;
if (plusdir == ON)
ls_active = ON;
}
else
motor_info->status &= ~RA_OVERTRAVEL;
motor_info->status &= ~RA_PLUS_LS;
if (status & 2)
{
motor_info->status |= RA_MINUS_LS;
if (plusdir == OFF)
ls_active = ON;
}
else
motor_info->status &= ~RA_MINUS_LS;
send_mess(card, "? ] 1", IM483PL_axis[signal]);
recv_mess(card, buff, 1);
@@ -383,12 +397,12 @@ STATIC int set_status(int card, int signal)
if (!(motor_info->status & RA_DIRECTION))
motor_info->velocity *= -1;
rtn_state = (!motor_info->no_motion_count ||
(motor_info->status & (RA_OVERTRAVEL | RA_DONE | RA_PROBLEM))) ? 1 : 0;
rtn_state = (!motor_info->no_motion_count || ls_active == ON ||
(motor_info->status & (RA_DONE | RA_PROBLEM))) ? 1 : 0;
/* Test for post-move string. */
if ((motor_info->status & RA_DONE || motor_info->status & RA_OVERTRAVEL) &&
nodeptr != 0 && nodeptr->postmsgptr != 0)
if ((motor_info->status & RA_DONE || ls_active == ON) && nodeptr != 0 &&
nodeptr->postmsgptr != 0)
{
strcpy(buff, nodeptr->postmsgptr);
send_mess(card, buff, IM483PL_axis[signal]);
+24 -10
View File
@@ -3,9 +3,9 @@ FILENAME... drvIM483SM.c
USAGE... Motor record driver level support for Intelligent Motion
Systems, Inc. IM483(I/IE).
Version: $Revision: 1.5 $
Version: $Revision: 1.6 $
Modified By: $Author: sluiter $
Last Modified: $Date: 2002-04-19 18:14:28 $
Last Modified: $Date: 2002-07-05 19:22:35 $
*/
/*
@@ -261,7 +261,7 @@ STATIC int set_status(int card, int signal)
int status;
int rtn_state;
double motorData;
BOOLEAN plusdir;
BOOLEAN plusdir, ls_active = OFF;
cntrl = (struct IM483controller *) motor_state[card]->DevicePrivate;
motor_info = &(motor_state[card]->motor_info[signal]);
@@ -342,10 +342,24 @@ STATIC int set_status(int card, int signal)
recv_mess(card, buff, 1);
status = atoi(&buff[5]);
if ((plusdir == ON && (status & 1)) || (plusdir == OFF && (status & 2)))
motor_info->status |= RA_OVERTRAVEL;
/* Set limit switch error indicators. */
if (status & 1)
{
motor_info->status |= RA_PLUS_LS;
if (plusdir == ON)
ls_active = ON;
}
else
motor_info->status &= ~RA_OVERTRAVEL;
motor_info->status &= ~RA_PLUS_LS;
if (status & 2)
{
motor_info->status |= RA_MINUS_LS;
if (plusdir == OFF)
ls_active = ON;
}
else
motor_info->status &= ~RA_MINUS_LS;
send_mess(card, "] 1", NULL);
recv_mess(card, buff, 1);
@@ -384,12 +398,12 @@ STATIC int set_status(int card, int signal)
if (!(motor_info->status & RA_DIRECTION))
motor_info->velocity *= -1;
rtn_state = (!motor_info->no_motion_count ||
(motor_info->status & (RA_OVERTRAVEL | RA_DONE | RA_PROBLEM))) ? 1 : 0;
rtn_state = (!motor_info->no_motion_count || ls_active == ON ||
(motor_info->status & (RA_DONE | RA_PROBLEM))) ? 1 : 0;
/* Test for post-move string. */
if ((motor_info->status & RA_DONE || motor_info->status & RA_OVERTRAVEL) &&
nodeptr != 0 && nodeptr->postmsgptr != 0)
if ((motor_info->status & RA_DONE || ls_active == ON) && nodeptr != 0 &&
nodeptr->postmsgptr != 0)
{
strcpy(buff, nodeptr->postmsgptr);
send_mess(card, buff, NULL);
+25 -27
View File
@@ -2,9 +2,9 @@
FILENAME... drvMM3000.c
USAGE... Motor record driver level support for Newport MM3000.
Version: $Revision: 1.7 $
Version: $Revision: 1.8 $
Modified By: $Author: sluiter $
Last Modified: $Date: 2001-12-14 20:50:31 $
Last Modified: $Date: 2002-07-05 19:27:22 $
*/
/*
@@ -251,6 +251,7 @@ STATIC int set_status(int card, int signal)
MOTOR_STATUS mstat;
int rtn_state, charcnt;
double motorData;
BOOLEAN plusdir, ls_active = OFF;
cntrl = (struct MMcontroller *) motor_state[card]->DevicePrivate;
motor_info = &(motor_state[card]->motor_info[signal]);
@@ -289,6 +290,8 @@ STATIC int set_status(int card, int signal)
else
motor_info->status |= RA_DIRECTION;
plusdir = (motor_info->status & RA_DIRECTION) ? ON : OFF;
if (mstat.Bits.inmotion == OFF)
{
motor_info->status |= RA_DONE;
@@ -307,31 +310,26 @@ STATIC int set_status(int card, int signal)
else
motor_info->status &= ~RA_DONE;
/* Set Travel limit status bit. */
if (mstat.Bits.inmotion == OFF)
{
if (mstat.Bits.plustTL == OFF && mstat.Bits.minusTL == OFF)
motor_info->status &= ~RA_OVERTRAVEL;
else
{
motor_info->status |= RA_OVERTRAVEL;
/* Until status is modified to distinguish +/- limits;
* Set RA_DIRECTION to match travel limit switch. */
if (mstat.Bits.plustTL != OFF)
motor_info->status |= RA_DIRECTION;
else
motor_info->status &= ~RA_DIRECTION;
}
}
/* Set Travel limit switch status bits. */
if (mstat.Bits.plustTL == OFF)
motor_info->status &= ~RA_PLUS_LS;
else
{
if ((mstat.Bits.plustTL != OFF && mstat.Bits.direction != OFF) ||
(mstat.Bits.minusTL != OFF && mstat.Bits.direction == OFF))
motor_info->status |= RA_OVERTRAVEL;
else
motor_info->status &= ~RA_OVERTRAVEL;
motor_info->status |= RA_PLUS_LS;
if (plusdir == ON)
ls_active = ON;
}
if (mstat.Bits.minusTL == OFF)
motor_info->status &= ~RA_MINUS_LS;
else
{
motor_info->status |= RA_MINUS_LS;
if (plusdir == OFF)
ls_active = ON;
}
if (mstat.Bits.homels == OFF)
motor_info->status &= ~RA_HOME;
else
@@ -399,12 +397,12 @@ STATIC int set_status(int card, int signal)
if (!(motor_info->status & RA_DIRECTION))
motor_info->velocity *= -1;
rtn_state = (!motor_info->no_motion_count ||
(motor_info->status & (RA_OVERTRAVEL | RA_DONE | RA_PROBLEM))) ? 1 : 0;
rtn_state = (!motor_info->no_motion_count || ls_active == ON ||
(motor_info->status & (RA_DONE | RA_PROBLEM))) ? 1 : 0;
/* Test for post-move string. */
if ((motor_info->status & RA_DONE || motor_info->status & RA_OVERTRAVEL) &&
nodeptr != 0 && nodeptr->postmsgptr != 0)
if ((motor_info->status & RA_DONE || ls_active == ON) && nodeptr != 0 &&
nodeptr->postmsgptr != 0)
{
strcpy(outbuff, nodeptr->postmsgptr);
send_mess(card, outbuff, NULL);
+25 -9
View File
@@ -2,9 +2,9 @@
FILENAME... drvMM4000.c
USAGE... Motor record driver level support for Newport MM4000.
Version: $Revision: 1.8 $
Version: $Revision: 1.9 $
Modified By: $Author: sluiter $
Last Modified: $Date: 2001-12-14 20:50:33 $
Last Modified: $Date: 2002-07-05 19:27:23 $
*/
/*
@@ -312,6 +312,7 @@ STATIC int set_status(int card, int signal)
MOTOR_STATUS mstat;
int rtn_state;
double motorData;
BOOLEAN plusdir, ls_active = OFF;
cntrl = (struct MMcontroller *) motor_state[card]->DevicePrivate;
motor_info = &(motor_state[card]->motor_info[signal]);
@@ -345,6 +346,8 @@ STATIC int set_status(int card, int signal)
else
motor_info->status |= RA_DIRECTION;
plusdir = (motor_info->status & RA_DIRECTION) ? ON : OFF;
if (mstat.Bits.inmotion == OFF)
{
motor_info->status |= RA_DONE;
@@ -363,10 +366,23 @@ STATIC int set_status(int card, int signal)
else
motor_info->status &= ~RA_DONE;
if (mstat.Bits.plustTL == OFF && mstat.Bits.minusTL == OFF)
motor_info->status &= ~RA_OVERTRAVEL;
if (mstat.Bits.plustTL == OFF)
motor_info->status &= ~RA_PLUS_LS;
else
motor_info->status |= RA_OVERTRAVEL;
{
motor_info->status |= RA_PLUS_LS;
if (plusdir == ON)
ls_active = ON;
}
if (mstat.Bits.minusTL == OFF)
motor_info->status &= ~RA_MINUS_LS;
else
{
motor_info->status |= RA_MINUS_LS;
if (plusdir == OFF)
ls_active = ON;
}
if (mstat.Bits.homels == OFF)
motor_info->status &= ~RA_HOME;
@@ -420,12 +436,12 @@ STATIC int set_status(int card, int signal)
if (!(motor_info->status & RA_DIRECTION))
motor_info->velocity *= -1;
rtn_state = (!motor_info->no_motion_count ||
(motor_info->status & (RA_OVERTRAVEL | RA_DONE | RA_PROBLEM))) ? 1 : 0;
rtn_state = (!motor_info->no_motion_count || ls_active == ON ||
(motor_info->status & (RA_DONE | RA_PROBLEM))) ? 1 : 0;
/* Test for post-move string. */
if ((motor_info->status & RA_DONE || motor_info->status & RA_OVERTRAVEL) &&
nodeptr != 0 && nodeptr->postmsgptr != 0)
if ((motor_info->status & RA_DONE || ls_active == ON) && nodeptr != 0 &&
nodeptr->postmsgptr != 0)
{
strcpy(buff, nodeptr->postmsgptr);
send_mess(card, buff, NULL);
+20 -10
View File
@@ -238,6 +238,7 @@ STATIC int set_status(int card, int signal)
response[BUFF_SIZE];
int status, rtn_state = 0;
double motorData;
BOOLEAN ls_active;
cntrl = (struct MMcontroller *) motor_state[card]->DevicePrivate;
motor_info = &(motor_state[card]->motor_info[signal]);
@@ -296,16 +297,25 @@ STATIC int set_status(int card, int signal)
else
motor_info->status &= ~RA_PROBLEM;
motor_info->status &= ~RA_OVERTRAVEL;
motor_info->status |= RA_DIRECTION;
if (dir_char == '+')
motor_info->status |= RA_DIRECTION;
else
motor_info->status &= ~RA_DIRECTION;
if (status_char == 'L')
{
motor_info->status |= RA_OVERTRAVEL;
ls_active = ON;
if (dir_char == '+')
motor_info->status |= RA_DIRECTION;
motor_info->status |= RA_PLUS_LS;
else
motor_info->status &= ~RA_DIRECTION;
}
motor_info->status |= RA_MINUS_LS;
}
else
{
ls_active = OFF;
motor_info->status &= ~RA_PLUS_LS;
motor_info->status &= ~RA_MINUS_LS;
}
motor_info->status &= ~RA_HOME;
@@ -345,12 +355,12 @@ STATIC int set_status(int card, int signal)
if (!(motor_info->status & RA_DIRECTION))
motor_info->velocity *= -1;
rtn_state = (!motor_info->no_motion_count ||
(motor_info->status & (RA_OVERTRAVEL | RA_DONE | RA_PROBLEM))) ? 1 : 0;
rtn_state = (!motor_info->no_motion_count || ls_active == ON ||
(motor_info->status & (RA_DONE | RA_PROBLEM))) ? 1 : 0;
/* Test for post-move string. */
if ((motor_info->status & RA_DONE || motor_info->status & RA_OVERTRAVEL) &&
nodeptr != 0 && nodeptr->postmsgptr != 0)
if ((motor_info->status & RA_DONE || ls_active == ON) && nodeptr != 0 &&
nodeptr->postmsgptr != 0)
{
strcpy(buff, nodeptr->postmsgptr);
strcat(buff, "\r");