-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetPumpLaser.c
More file actions
65 lines (46 loc) · 1.28 KB
/
setPumpLaser.c
File metadata and controls
65 lines (46 loc) · 1.28 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
program to set analog output
RasPi connected to USB 1208LS.
Sets analog voltage for probe laser. Uses Analog out port 0. Final output to probe laser is through
op-amp circuit. see page 98. Page 99 shows calibration data.
Usage '$ sudo ./setProbeLaser xxx' where xxx is an integer value between 0 and 1024
*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <ctype.h>
#include <sys/types.h>
#include <asm/types.h>
#include "interfacing/topticaLaser.h"
#include "interfacing/USB1208.h"
#include "interfacing/kenBoard.h"
int main (int argc, char *argv[])
{
float value;
int laserSock;
initializeBoard();
initializeUSB1208();
laserSock=initializeLaser();
if (argc==2) {
value=atof(argv[1]);
}else{
printf("Usage '$ sudo ./setPumpLaser xxx' where xxx is the desired scan offset.\n");
printf(" GETTING OFFSET \n");
value=getScanOffset(laserSock);
printf("Pump Offset is: %f\n",value);
printf(" GETTING CURRENT \n");
value=getMasterCurrent(laserSock);
printf("Pump Current is: %f\n",value);
return 0;
}
if (value<0) value=0;
if (value>1023) value=1023;
setScanOffset(laserSock, value);
closeUSB1208();
close(laserSock);
printf("Scan Offset %3.1f \n",value);
return 0;
}