pvbrowser manual
Back Content Forward

mask1_slots.h

//###############################################################

// todo: uncomment me if you want to use this data aquisiton
// also uncomment this classes in main.cpp and pvapp.h
// also remember to uncomment rllib in the project file
//extern rlModbusClient     modbus;
//extern rlSiemensTCPClient siemensTCP;
//extern rlPPIClient        ppi;
extern unsigned char sendData[512];
extern unsigned char receiveData[512];
extern rlThread pbus;

typedef struct // (todo: define your data structure here)
{
}
DATA;

static int slotInit(PARAM *p, DATA *d)
{
  if(p == NULL || d == NULL) return -1;
  //memset(d,0,sizeof(DATA));
  return 0;//###
}

static int slotNullEvent(PARAM *p, DATA *d)
{
  if(p == NULL || d == NULL) return -1;
  pvPrintf(p,labelInput0,"%2X",receiveData[0]);
  pvPrintf(p,labelInput1,"%2X",receiveData[1]);
  return 0;
}

<snip>

static int slotSliderEvent(PARAM *p, int id, DATA *d, int val)
{
  if(p == NULL || id == 0 || d == NULL || val < -1000) return -1;
  pbus.lock();
  if(id == spinOutput0) sendData[0] = val;
  if(id == spinOutput1) sendData[1] = val;
  pbus.unlock();  
  return 0;
}

Back Content Forward