|
Last change
on this file since 111 was 100, checked in by ogrimm, 16 years ago |
|
Number of HV boards (almost) unlimited.
|
|
File size:
1.3 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 |
|
|---|
| 30 | class ProcessIO;
|
|---|
| 31 |
|
|---|
| 32 | class HVBoard {
|
|---|
| 33 |
|
|---|
| 34 | int BoardNumber;
|
|---|
| 35 | class ProcessIO *m;
|
|---|
| 36 |
|
|---|
| 37 | public:
|
|---|
| 38 |
|
|---|
| 39 | HVBoard(int, char *, class ProcessIO *);
|
|---|
| 40 | ~HVBoard();
|
|---|
| 41 |
|
|---|
| 42 | int fDescriptor;
|
|---|
| 43 | bool Overcurrent[NUM_CHAINS];
|
|---|
| 44 | bool ResetButton;
|
|---|
| 45 | bool WrapOK;
|
|---|
| 46 | int LastWrapCount;
|
|---|
| 47 | double fTimeOut; // [s] timeout to return from read
|
|---|
| 48 |
|
|---|
| 49 | char *BoardName;
|
|---|
| 50 | int HV[NUM_CHAINS][NUM_CHANNELS]; // HV value in DAC units
|
|---|
| 51 | double HVV[NUM_CHAINS][NUM_CHANNELS]; // HV value in volts
|
|---|
| 52 |
|
|---|
| 53 | void ClearVoltageArrays();
|
|---|
| 54 | int Reset();
|
|---|
| 55 | int GetStatus();
|
|---|
| 56 | int SetHV(int, unsigned int, int);
|
|---|
| 57 | int GetBoardNumber() {return BoardNumber;}
|
|---|
| 58 | int Communicate(unsigned char*, int);
|
|---|
| 59 | void SetTimeOut(double);
|
|---|
| 60 | };
|
|---|
| 61 |
|
|---|
| 62 | #endif
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.