BL19LXU/BL29XUL Experimental Station Control Software Manual

VME Pulse Motor Controller API Manual

Functions
int api_vmepmc_write_position(const int st, const int ch, const long dest);
int api_vmepmc_read_position(cont int st, const int ch, long *position);
int api_vmepmc_write_speed(const int st, const int ch, const int speed);
int api_vmepmc_read_speed(const int st, const int ch, int *speed);
int api_vmepmc_write_limit(const int st, const int ch, const int dir, const long limit);
int api_vmepmc_read_limit(const int st, const int ch, const int dir, long *limit);
int api_vmepmc_preset_position(const int st, const int ch, const long position);

Defined constants
API_VMEPMC_STn    (n=1,2,...)
API_VMEPMC_STn _CH_NO    (n=0,1,...)
API_VMEPMC_UPPER_LIMIT
API_VMEPMC_LOWER_LIMIT
API_VMEPMC_INVALID_STATION
API_VMEPMC_INVALID_CH
API_VMEPMC_INVALID_SPEED

Description
int api_vmepmc_write_position(const int st, const int ch, const long dest);
int api_vmepmc_read_position(cont int st, const int ch, long *position);

int api_vmepmc_write_speed(const int st, const int ch, const int speed);
int api_vmepmc_read_speed(const int st, const int ch, int *speed);

int api_vmepmc_write_limit(const int st, const int ch, const int dir, const long limit);
int api_vmepmc_read_limit(const int st, const int ch, const int dir, long *limit);

int api_vmepmc_preset_position(const int st, const int ch, const long position);
This function will set the pulse value specified by st (the station number) and ch (the channel number) to position. The fucntion returns API_VMEPMC_TRUE when new pulse value was set. Otherwise the error code API_VMEPMC_INVALID_STATION or API_VMEPMC_INVALID_CH will be returned.

Example

#include "api_sock.h"
#include "api_vmepmc.h"

int main(void)
{
  int err, ch;
  long p;

  /* Open socket to BL WS */
  api_sock_open();

  /* Move ch-0 relatively 100 pulse */
  ch=0;

  /* Read present pulse */
  err=api_vmepmc_read_position(API_VMEPMC_ST1, ch, &p);
  if(err < 0) {printf("error code=%ld\n", err); api_sock_close(); exit(0);}
  printf("now ch-0 = %ld pulse\n", p);

  /* Move 100 pulse */
  p=p+100;
  err=api_vmepmc_write_position(API_VMEPMC_ST1, ch, p);
  if(err < 0) {printf("error code=%ld\n", err); api_sock_close(); exit(0);}

  /* Read new pulse */
  err=api_vmepmc_read_position(API_VMEPMC_ST1, ch, &p);
  if(err < 0) {printf("error code=%ld\n", err); api_sock_close(); exit(0);}
  printf("now ch-0 = %ld pulse\n", p);

  /* close the socket */
  api_sock_close();
  return(0);
}

BACK