Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 292 → Rev 291

/cvi/instr/AitSipmDAQ/AitGui.c
12,7 → 12,7
#include "H2D.h"
#include "H3D.h"
 
static int node[3];
 
typedef unsigned short ushort;
typedef unsigned int uint;
 
24,15 → 24,6
#include "MIKRO.h"
#endif
 
#define uSMC_USB
#ifdef uSMC_USB
# include "uSMC.h"
# define uSMC_SERIAL_X "0000000000004925"
# define uSMC_SERIAL_Y "0000000000006030"
# define uSMC_SERIAL_Z "0000000000002894"
const char serials[3][16]= {uSMC_SERIAL_X,uSMC_SERIAL_Y,uSMC_SERIAL_Z};
#endif /* uSMC_USB */
 
static int daq_on;
static int plothandle[4]= {0,0,0, 0};
static int tfID;
466,29 → 457,17
#ifdef MIKRO
MIKRO_MoveTo(2,ix[1]);
MIKRO_GetPosition(2,&n[1]);
SetCtrlVal (xyscan, SCAN_YP, n[1]);
#endif
#ifdef uSMC_USB
uSMC_MoveTo(node[1],ix[1]);
uSMC_GetPosition(node[1],&n[1]);
SetCtrlVal (xyscan, SCAN_YP, n[1]);
#endif
SetCtrlVal (xyscan, SCAN_YP, n[1]);
#endif
for (int i=0; i<nx[0]; i++) {
SetCtrlVal (xyscan, SCAN_IX, i);
ix[0]= x0[0]+i*dx[0];
#ifdef MIKRO
MIKRO_MoveTo(1,ix[0]);
MIKRO_MoveTo(1,ix[0]);
MIKRO_GetPosition(1,&n[0]);
SetCtrlVal (xyscan, SCAN_XP, n[0]);
#endif
#ifdef uSMC_USB
uSMC_MoveTo(node[0],ix[0]);
uSMC_GetPosition(node[0],&n[0]);
SetCtrlVal (xyscan, SCAN_XP, n[0]);
#endif
if (enabledoutput) {
fp = fopen(filename,"ab");
507,7 → 486,7
}
}
 
#endif
int newfile=0;
daq(&newfile);
if (!daq_on) break;
520,7 → 499,7
 
 
int main (int argc, char *argv[]) {
 
short port;
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
if ((ait = LoadPanel (0, "AitGui.uir", AIT)) < 0)
536,19 → 515,11
#ifdef MIKRO
short port;
GetCtrlVal(xyscan, SCAN_PORT, &port);
GetCtrlVal(xyscan, SCAN_PORT, &port);
if (MIKRO_Open (port)) MessagePopup ("Error", "Mikro Port Not found !\n Change in the GUI") ;
MIKRO_Init(1,0);
MIKRO_Init(2,0);
#endif
#ifdef uSMC_USB
uSMC_Open();
for (int i=0; i<3; i++) {
node[i]=uSMC_FindSerial(serials[i])+1;
uSMC_Init(node[i],1);
}
#endif /* uSMC_USB */
RunUserInterface ();
555,11 → 526,7
#ifdef MIKRO
MIKRO_Close ();
#endif
#ifdef uSMC_USB
for (int i=0; i<3; i++) uSMC_PowerOff(node[i]);
uSMC_Close();
#endif /* uSMC_USB */
#endif
DiscardPanel (ait);
DiscardPanel (xyscan);
return 0;
750,17 → 717,7
if (axis == 1) SetCtrlVal (panel, SCAN_XP, n);
if (axis == 2) SetCtrlVal (panel, SCAN_YP, n);
}
#endif // MIKRO
#ifdef uSMC_USB
{
int n=0;
uSMC_MoveFor(node[axis-1], direction*step );
uSMC_GetPosition(node[axis-1],&n);
if (axis == 1) SetCtrlVal (panel, SCAN_XP, n);
if (axis == 2) SetCtrlVal (panel, SCAN_YP, n);
}
#endif // MIKRO
#endif // MIKRO
}
 
break;
781,12 → 738,8
#ifdef MIKRO
MIKRO_MoveTo(1,n2);
MIKRO_GetPosition(1,&n2);
 
#endif
#ifdef uSMC_USB
uSMC_MoveTo(node[0],n2);
uSMC_GetPosition(node[0],&n2);
#endif
SetCtrlVal (panel, SCAN_XP, n2);
break;
}
804,10 → 757,6
MIKRO_GetPosition(2,&n2);
 
#endif
#ifdef uSMC_USB
uSMC_MoveTo(node[1],n2);
uSMC_GetPosition(node[1],&n2);
#endif
SetCtrlVal (panel, SCAN_YP, n2);
break;
}
817,21 → 766,16
int CVICALLBACK GetCurrentPositionCB (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2) {
 
int n[2];
 
switch (event) {
case EVENT_COMMIT: {
#ifdef MIKRO
int n[2];
MIKRO_GetPosition(1,&n[0]);
SetCtrlVal (panel, SCAN_XP, n[0]);
MIKRO_GetPosition(2,&n[1]);
SetCtrlVal (panel, SCAN_YP, n[1]);
#endif
#ifdef uSMC_USB
uSMC_GetPosition(node[0],&n[0]);
SetCtrlVal (panel, SCAN_XP, n[0]);
uSMC_GetPosition(node[1],&n[1]);
SetCtrlVal (panel, SCAN_YP, n[1]);
#endif
break;
}
}
847,12 → 791,6
MIKRO_ReferenceMove(2);
GetCurrentPositionCB(panel, control, event, NULL, 0, 0);
#endif
#ifdef uSMC_USB
//SetCtrlVal(panel,P1_STAGELED,1);
for (int i=0; i<3; i++) uSMC_ReferenceMove(node[i]);
GetCurrentPositionCB(panel, control, event, NULL, 0, 0);
//SetCtrlVal(panel,P1_STAGELED,0);
#endif /* uSMC_USB */
break;
}
return 0;