Overview

This group defines all required functions to calibrate dosing units or to set the internal position counter of devices to a defined state.

+ Collaboration diagram for Calibration:

Functions

long NemCalibrate (TNemesys *Nemesys, uint32_t Velocity)
 Execute reference move (homing move) for single dosing unit. More...
 
long NemRestorePos (TNemesys *Nemesys, int32_t dwPos)
 Restore position value. More...
 

Function Documentation

long NemCalibrate ( TNemesys Nemesys,
uint32_t  Velocity 
)

Execute reference move (homing move) for single dosing unit.

If the device executes an reference move, then the pusher is moved towards the lower limit sensor.

Parameters
[in]NemesysDevice to calibrate
[in]VelocitySpeed of calibbration move in mrpm (millirevolutions per minute)
Returns
Error code - ERR_NOERR indicates success
493 {
494  long Result;
495 
496  //
497  // Set operation mode to homing mode
498  //
499  Result = Nem_SetOpMode(Nemesys, NEM_OP_MODE_HOMING);
500  if (ERR_NOERR != Result)
501  {
502  return Result;
503  }
504 
505  //
506  // set homing mode
507  //
508  Result = Nem_SetHomingMode(Nemesys, HM_POS_LIM);
509  if (ERR_NOERR != Result)
510  {
511  return Result;
512  }
513 
514  //
515  // set homing speed in mrpm/min
516  //
517  Result = Nem_SetHomingSpeed(Nemesys, Velocity);
518  if (ERR_NOERR != Result)
519  {
520  return Result;
521  }
522 
523  //
524  // After calibration the position counter should contain the value 0
525  //
526  Result = Nem_SetHomePos(Nemesys, 0);
527  if (ERR_NOERR != Result)
528  {
529  return Result;
530  }
531 
532  //
533  // Enable drive
534  //
535  Result = Nem_SetControlWord(Nemesys, CW_OP_EN);
536  if (ERR_NOERR != Result)
537  {
538  return Result;
539  }
540 
541  //
542  // Give drive some time to process first control word
543  //
544  CsiSleep(50);
545 
546  //
547  // Now start homing
548  //
550 }
homing mode - required for calibration and position counter stting
Definition: nem_rs232_api.c:93
Move reference to positive limit switch (calibration)
Definition: nem_rs232_api.c:189
static long Nem_SetHomingMode(TNemesys *Nemesys, THomingMode Mode)
Change homing mode for refernce move.
Definition: nem_rs232_api.c:692
static long Nem_SetHomingSpeed(TNemesys *Nemesys, uint32_t Velocity)
Change speed for calibration move.
Definition: nem_rs232_api.c:683
static long Nem_SetOpMode(TNemesys *Nemesys, TNemOpModes OpMode)
Change operation mode of neMESYS device.
Definition: nem_rs232_api.c:664
#define CWBIT_HOMING_START
controlword bit start homing move
Definition: nem_rs232_api.c:40
set device operational
Definition: nem_rs232_api.c:161
#define ERR_NOERR
No error.
Definition: err_codes.h:102
static long Nem_SetControlWord(TNemesys *Nemesys, uint16_t wControlWord)
Transmits the controlword to the device.
Definition: nem_rs232_api.c:711
static long Nem_SetHomePos(TNemesys *Nemesys, int32_t dwHomePos)
Set the value of the psotion counter on end of refernce move.
Definition: nem_rs232_api.c:702
CSI_API void CsiSleep(uint32_t Milliseconds)
Function to sleep for a certain amount of milliseconds.
Definition: csi_common.c:30

+ Here is the call graph for this function:

long NemRestorePos ( TNemesys Nemesys,
int32_t  dwPos 
)

Restore position value.

If the neMESYS device is switched off, the internal position value will get lost. If the device is swicthed on again later, normally a calibration move is necessary to initialize the internal position counter. If the application stored the last position value before device switch off, then it is possible to restore the position value by calling this function.

Parameters
[in]NemesysDevice to setup
[in]dwPosThe position value to store in internal position counter.
Returns
Error code - ERR_NOERR indicates success
1099 {
1100  long Result;
1101 
1102  //
1103  // Set operation mode to homing mode
1104  //
1105  Result = Nem_SetOpMode(Nemesys, NEM_OP_MODE_HOMING);
1106  if (ERR_NOERR != Result)
1107  {
1108  return Result;
1109  }
1110 
1111  //
1112  // set homing mode
1113  //
1114  Result = Nem_SetHomingMode(Nemesys, HM_ACTUAL_POSITION);
1115  if (ERR_NOERR != Result)
1116  {
1117  return Result;
1118  }
1119 
1120  //
1121  // Set position counter to position value
1122  //
1123  dwPos = 0 - dwPos; // we need invertet value
1124  Result = Nem_SetHomePos(Nemesys, dwPos);
1125  if (ERR_NOERR != Result)
1126  {
1127  return Result;
1128  }
1129 
1130  //
1131  // Enable drive
1132  //
1133  Result = Nem_SetControlWord(Nemesys, CW_OP_EN);
1134  if (ERR_NOERR != Result)
1135  {
1136  return Result;
1137  }
1138 
1139  //
1140  // Give drive some time to process first control word
1141  //
1142  CsiSleep(50);
1143  //
1144  // Now start homing
1145  //
1146  return Nem_SetControlWord(Nemesys, CW_OP_EN | CWBIT_HOMING_START);;
1147 }
homing mode - required for calibration and position counter stting
Definition: nem_rs232_api.c:93
static long Nem_SetHomingMode(TNemesys *Nemesys, THomingMode Mode)
Change homing mode for refernce move.
Definition: nem_rs232_api.c:692
Take actual position as home position (setting position counter)
Definition: nem_rs232_api.c:190
static long Nem_SetOpMode(TNemesys *Nemesys, TNemOpModes OpMode)
Change operation mode of neMESYS device.
Definition: nem_rs232_api.c:664
#define CWBIT_HOMING_START
controlword bit start homing move
Definition: nem_rs232_api.c:40
set device operational
Definition: nem_rs232_api.c:161
#define ERR_NOERR
No error.
Definition: err_codes.h:102
static long Nem_SetControlWord(TNemesys *Nemesys, uint16_t wControlWord)
Transmits the controlword to the device.
Definition: nem_rs232_api.c:711
static long Nem_SetHomePos(TNemesys *Nemesys, int32_t dwHomePos)
Set the value of the psotion counter on end of refernce move.
Definition: nem_rs232_api.c:702
CSI_API void CsiSleep(uint32_t Milliseconds)
Function to sleep for a certain amount of milliseconds.
Definition: csi_common.c:30

+ Here is the call graph for this function: