-
Notifications
You must be signed in to change notification settings - Fork 5
/
change_hv_settings.cpp
45 lines (36 loc) · 1.06 KB
/
change_hv_settings.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "VMEReader.h"
#include "FileConstants.h"
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include <ctime>
#include <signal.h>
using namespace std;
VMEReader* vme;
int gEnd = 0;
void CtrlC(int aSig) {
if (gEnd==0) { cerr << endl << "[C-c] Trying a clean exit!" << endl; vme->Abort(); }
else if (gEnd>=5) { cerr << endl << "[C-c > 5 times] ... Forcing exit!" << endl; exit(0); }
gEnd++;
}
int main(int argc, char *argv[]) {
signal(SIGINT, CtrlC);
try {
bool with_socket = false;
vme = new VMEReader("/dev/usb/v2718_0", VME::CAEN_V2718, with_socket);
try { vme->AddHVModule(0x500000, 0xc); } catch (Exception& e) { e.Dump(); }
NIM::HVModuleN470* hv = vme->GetHVModule();
cout << "module id=" << hv->GetModuleId() << endl;
//hv->ReadMonitoringValues().Dump();
hv->EnableChannel(3);
//hv->SetChannelV0(0, 2400);
//hv->SetChannelI0(0, 500);
//hv->ReadChannelValues(0).Dump();
//hv->ReadChannelValues(3).Dump();
} catch (Exception& e) {
e.Dump();
return -1;
}
return 0;
}