source: hvcontrol/src/HV.h@ 226

Last change on this file since 226 was 183, checked in by ogrimm, 15 years ago
Various updates
File size: 1.4 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 "dis.hxx"
12#define NUM_CHAINS 4
13#define NUM_CHANNELS 32
14
15#define BAUDRATE B115200
16
17// HV board control registers
18#define REG_HV0 0X20
19#define REG_HV1 0X28
20#define REG_HV2 0X30
21#define REG_HV3 0X38
22#define REG_RESET 0XF8
23#define REG_STATUS 0X80
24
25// HV board status bits
26#define BIT_OC0 (1<<3)
27#define BIT_OC1 (1<<4)
28#define BIT_OC2 (1<<5)
29#define BIT_OC3 (1<<6)
30#define BIT_RESET (1<<7)
31
32class ProcessIO;
33
34class HVBoard {
35
36 int BoardNumber;
37 class ProcessIO *m;
38
39 public:
40
41 HVBoard(int, char *, class ProcessIO *);
42 ~HVBoard();
43
44 int fDescriptor;
45 bool Overcurrent[NUM_CHAINS];
46 bool ResetButton;
47 bool WrapOK;
48 int LastWrapCount;
49 double fTimeOut; // [s] timeout to return from read
50 int ErrorCount;
51
52 char *BoardName;
53 int HV[NUM_CHAINS][NUM_CHANNELS]; // HV value in DAC units
54 double HVV[NUM_CHAINS][NUM_CHANNELS]; // HV value in volts
55
56 DimService *Name;
57 DimService *BiasVolt;
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.