source: hvcontrol/src/HV.h@ 91

Last change on this file since 91 was 90, checked in by ogrimm, 15 years ago
Removed ftdi libraries, streamlined program, slightly expanded command interface
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
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
30#define BIT_RESET (1<<7)
31
32
33class HVBoard {
34
35 int BoardNumber;
36 int fTestModeWrap;
37 bool fTestMode;
38
39 public:
40
41 HVBoard(int, char *, bool, float, bool);
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(FILE*, bool);
57 int GetStatus(FILE*, bool);
58 int SetHV(FILE*, int, unsigned int, unsigned int, bool);
59 int GetBoardNumber() {return BoardNumber;}
60 int Communicate(FILE*, unsigned char*, int, bool);
61 void SetTimeOut(double);
62};
63
64#endif
Note: See TracBrowser for help on using the repository browser.