BL19LXU/BL29XUL Experimental Station Control Software Manual

VME Counter API Manual

Functions
int api_vmecounter_init(const int st, const int bd);
int api_vmecounter_read_count(cont int st, const int bd, const float time, long *count);

Defined constants
API_VMECOUNTER_STn    (n=1,2,...)
API_VMECOUNTER_BOARD_n    (n=0,1,...)
API_VMECOUNTER_INVALID_STATION
API_VMECOUNTER_INVALID_BOARD

Description
int api_vmecounter_init(const int st, const int bd);
This function will initialize the VME based counter/timer specified by st (the station number) and bd (the board number). For each board this function should be called. The function returns API_VMECOUNTER_TRUE if the board was initialized. Otherwise the error code API_VMECOUNTER_INVALID_STATION or API_VMECOUNTER_INVALID_BOARD will be returned.

int api_vmecounter_read_count(cont int st, const int bd, const float time, long *count);
This function will count the signal for time sec. The board is specified by st (the station number) and bd (the board number). The function returns API_VMECOUNTER_TRUE when the counting was finished. The error code API_VMECOUNTER_INVALID_STATION or API_VMECOUNTER_INVALID_BOARD will be returned immediately.

Example

#include "api_sock.h"
#include "api_vmecounter.h"

int main(void)
{
  int err;
  long c[8];
  float time;

  /* Open socket to BL WS */
  api_sock_open();
  /* Initialize VME based counter/timer board */
  err=api_vmecounter_init(API_VMECOUNTER_ST1, API_VMECOUNTER_BOARD_0);
  if(err < 0) printf("error code=%ld\n", err);
  time=1.0;
  /* Count for 1.0 sec */
  err=api_vmecounter_read_count(API_VMECOUNTER_ST1, API_VMECOUNTER_BOARD_0, time, c);
  /* Display the result */
  printf("counter ch0=%ld cps\n", c[0]);
  /* close the socket */
  api_sock_close();
  return(0);
}

BACK