source: hvcontrol/src/HV.h@ 98

Last change on this file since 98 was 98, checked in by ogrimm, 15 years ago
Fixed bug with loading of HV settings. Negative DAC values are set to zero without error.
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 "HVConfig.h"
12
13#define BAUDRATE B115200
14
15// HV board control registers
16#define REG_HV0 0X20
17#define REG_HV1 0X28
18#define REG_HV2 0X30
19#define REG_HV3 0X38
20#define REG_RESET 0XF8
21#define REG_STATUS 0X80
22
23// HV board status bits
24#define BIT_OC0 (1<<3)
25#define BIT_OC1 (1<<4)
26#define BIT_OC2 (1<<5)
27#define BIT_OC3 (1<<6)
28#define BIT_RESET (1<<7)
29
30class ProcessIO;
31
32class HVBoard {
33
34 int BoardNumber;
35 int fTestModeWrap;
36 bool fTestMode;
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
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 void ClearVoltageArrays();
56 int Reset();
57 int GetStatus();
58 int SetHV(int, unsigned int, int);
59 int GetBoardNumber() {return BoardNumber;}
60 int Communicate(unsigned char*, int);
61 void SetTimeOut(double);
62};
63
64#endif
Note: See TracBrowser for help on using the repository browser.