source: hvcontrol/src/HV.h@ 152

Last change on this file since 152 was 126, checked in by ogrimm, 15 years ago
Implemented DIM servers
File size: 1.5 KB
Line 
1#ifndef HV_H_SEEN
2#define HV_H_SEEN
3
4#include <termios.h> // POSIX terminal control definitions
5#include <fcntl.h> // File control definitions => fcntl() in fcn OpenPort()
6#include <errno.h>
7#include <stdio.h>
8#include <unistd.h>
9#include <sys/ioctl.h>
10
11#include "HVConfig.h"
12#include "dis.hxx"
13
14#define BAUDRATE B115200
15
16// HV board control registers
17#define REG_HV0 0X20
18#define REG_HV1 0X28
19#define REG_HV2 0X30
20#define REG_HV3 0X38
21#define REG_RESET 0XF8
22#define REG_STATUS 0X80
23
24// HV board status bits
25#define BIT_OC0 (1<<3)
26#define BIT_OC1 (1<<4)
27#define BIT_OC2 (1<<5)
28#define BIT_OC3 (1<<6)
29#define BIT_RESET (1<<7)
30
31class ProcessIO;
32
33class HVBoard {
34
35 int BoardNumber;
36 class ProcessIO *m;
37
38 public:
39
40 HVBoard(int, char *, class ProcessIO *);
41 ~HVBoard();
42
43 int fDescriptor;
44 bool Overcurrent[NUM_CHAINS];
45 bool ResetButton;
46 bool WrapOK;
47 int LastWrapCount;
48 double fTimeOut; // [s] timeout to return from read
49 int ErrorCount;
50
51 char *BoardName;
52 int HV[NUM_CHAINS][NUM_CHANNELS]; // HV value in DAC units
53 double HVV[NUM_CHAINS][NUM_CHANNELS]; // HV value in volts
54
55 DimService *Name;
56 DimService *BiasVolt[NUM_CHAINS][NUM_CHANNELS];
57 DimService *BiasDAC[NUM_CHAINS][NUM_CHANNELS];
58
59 void ClearVoltageArrays();
60 int Reset();
61 int GetStatus();
62 int SetHV(int, unsigned int, int);
63 int GetBoardNumber() {return BoardNumber;}
64 int Communicate(unsigned char*, int);
65 void SetTimeOut(double);
66};
67
68#endif
Note: See TracBrowser for help on using the repository browser.