Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 291 → Rev 292

/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,6 → 24,15
#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;
457,17 → 466,29
#ifdef MIKRO
MIKRO_MoveTo(2,ix[1]);
MIKRO_GetPosition(2,&n[1]);
SetCtrlVal (xyscan, SCAN_YP, n[1]);
#endif
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
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");
486,7 → 507,7
}
}
#endif
 
int newfile=0;
daq(&newfile);
if (!daq_on) break;
499,7 → 520,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)
515,11 → 536,19
#ifdef MIKRO
GetCtrlVal(xyscan, SCAN_PORT, &port);
short 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 ();
526,7 → 555,11
#ifdef MIKRO
MIKRO_Close ();
#endif
#endif
#ifdef uSMC_USB
for (int i=0; i<3; i++) uSMC_PowerOff(node[i]);
uSMC_Close();
#endif /* uSMC_USB */
DiscardPanel (ait);
DiscardPanel (xyscan);
return 0;
717,7 → 750,17
if (axis == 1) SetCtrlVal (panel, SCAN_XP, n);
if (axis == 2) SetCtrlVal (panel, SCAN_YP, n);
}
#endif // MIKRO
#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
}
 
break;
738,8 → 781,12
#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;
}
757,6 → 804,10
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;
}
766,16 → 817,21
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;
}
}
791,6 → 847,12
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;