forked from optics/eib700
Probe connection to EIB periodically
This commit is contained in:
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
-1
@@ -452,7 +452,7 @@ text {
|
||||
clr=14
|
||||
bclr=5
|
||||
}
|
||||
label="ClearErrors"
|
||||
label="ClearMsg"
|
||||
press_msg="1"
|
||||
}
|
||||
text {
|
||||
|
||||
@@ -1679,8 +1679,8 @@ text {
|
||||
bclr=4
|
||||
}
|
||||
trace[0] {
|
||||
xdata="EIB:CH_1_ADC00"
|
||||
ydata="EIB:CH_1_ADC90"
|
||||
xdata="EIB:CH_3_ADC00"
|
||||
ydata="EIB:CH_3_ADC90"
|
||||
data_clr=30
|
||||
yaxis=0
|
||||
yside=0
|
||||
@@ -2344,7 +2344,7 @@ menu {
|
||||
height=25
|
||||
}
|
||||
control {
|
||||
chan="EIB:CH_0_ADC00.SCAN"
|
||||
chan="EIB:CH_3_ADC00.SCAN"
|
||||
clr=14
|
||||
bclr=4
|
||||
}
|
||||
|
||||
@@ -1,14 +1,5 @@
|
||||
#define MONINT_EVNT_UPDATE 81 /* Parameter update */
|
||||
#define MONINT_EVNT_STATUS 82 /* Status update */
|
||||
#define MONINT_EVNT_MC 83 /* DT.h */
|
||||
#define MONINT_EVNT_ID_SET 84 /* Machine.h*/
|
||||
#define MONINT_EVNT_PMOS_UPDATE 85 /* PMOS.h */
|
||||
#define MONINT_EVNT_ANGLE_UPDATE 86 /* Mono.c */
|
||||
#define MONINT_EVNT_TRANS_GRATING 87 /* Mono.c */
|
||||
#define MONINT_EVNT_TRANS_MIRROR 88 /* Mono.c */
|
||||
#define MONINT_EVNT_TIMER 89 /* Onfly.c */
|
||||
#define MONINT_EVNT_MPAR 90 /* Onfly.c set speed of Motors */
|
||||
#define MONINT_EVNT_STARTSTOP 91 /* Onfly.c */
|
||||
|
||||
|
||||
#define HC 1.23986E-6 /* Produkt aus Lichtgeschwindigkeit und Plank-Wirkungsquant [eV*m] Juni 1999 */
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+267
-42
@@ -42,6 +42,24 @@ Oct. 2024:
|
||||
|
||||
In any case the status HOMED is always correct and reliable.
|
||||
|
||||
Mar 2025: The connection status shall be displayed in the EPICS-panel.
|
||||
When no communication with the EIB700 is initiated by the softIOC and
|
||||
the EIB700 is switched off or lost its network connection
|
||||
the connection status still says "connected"
|
||||
|
||||
How to update the connection status:
|
||||
-> EIB7GetConnectionStatus does not help, as it displays the status after the last command.
|
||||
-> Periodically initiate a communication with the EIB700
|
||||
a) start a task on the softioc
|
||||
b) use a PV that is periodically scanned and e.g. use EIB7GetHostIPP to asks for Host-IP
|
||||
Aber: EIB7GetHostIPP macht keine Verbindung zur EIB700 auf.
|
||||
=> Mache EIB_PingTask die alle 60 s nach der Anzahl der Achsen fragt.
|
||||
CheckError st"osst dann gegebenenfalls die Wiederaufnahme der Verbindung an, 1 mal pro sekunde.
|
||||
|
||||
=> eventuell k"onnte man es auch so machen wie der ATHOS-Mono mit dem SoftIOC von Sven.
|
||||
|
||||
|
||||
|
||||
2 mal dieselbe Referenzmarke "uberfahren:
|
||||
|
||||
0xb01 = 1011 0000 0001
|
||||
@@ -116,8 +134,8 @@ int ReferenceActive[NUM_OF_AXIS]; /* das entsprechende Feld wird auf 1 ges
|
||||
char CfgFileName[100];
|
||||
EINTRAG *Mcfg;
|
||||
int EIB_connected = 0;
|
||||
int rdbg = 0; /*debug reference search */
|
||||
int cdbg = 0; /*debug connecting task search */
|
||||
int rdbg = 1; /*debug reference search */
|
||||
int cdbg = 1; /*debug connecting task search */
|
||||
int verbose = 1;
|
||||
int NextHist;
|
||||
double History[NUMPOINTS],adc0[NUMPOINTS], adc90[NUMPOINTS];
|
||||
@@ -126,7 +144,9 @@ epicsMessageQueueId RefQueue = 0;
|
||||
epicsThreadId RefTid = 0;
|
||||
|
||||
epicsMessageQueueId ConQueue = 0;
|
||||
epicsThreadId ConTid = 0;;
|
||||
epicsThreadId ConTid = 0;
|
||||
|
||||
epicsThreadId PingTid = 0;
|
||||
|
||||
static int stop = 0; /* global variable for console handler to stop on user request */
|
||||
|
||||
@@ -141,6 +161,43 @@ int EIB_Init_Enc(int enc_nr); /* initialize selected encoder */
|
||||
void EIB_StopRef( int enc_nr);
|
||||
void EIB_Clear_RingBuffer(int enc_nr);
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
double arctan(double x, double y)
|
||||
{
|
||||
double Result, h;
|
||||
|
||||
if (y == 0) {
|
||||
if (x > 0)
|
||||
return 0.0;
|
||||
else
|
||||
return M_PI;
|
||||
return Result;
|
||||
}
|
||||
|
||||
if (x == 0) {
|
||||
if (y > 0)
|
||||
return (0.5 * M_PI);
|
||||
else
|
||||
return (1.5 * M_PI);
|
||||
return Result;
|
||||
}
|
||||
|
||||
h = atan(y / x);
|
||||
|
||||
if (x > 0) {
|
||||
if (y > 0)
|
||||
return h;
|
||||
else
|
||||
return (h + 2 * M_PI);
|
||||
} else {
|
||||
if (y > 0)
|
||||
return (M_PI + h);
|
||||
else
|
||||
return (M_PI + h);
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************************************/
|
||||
int EIB_SpaL(char *s, int val)
|
||||
{
|
||||
@@ -450,6 +507,7 @@ int i;
|
||||
eib.enc [i].LastRef = 99;
|
||||
eib.enc [i].RefPos = 0;
|
||||
eib.enc [i].RefActive = 0;
|
||||
eib.enc [i].Interpolation = 4096;
|
||||
EIB_Clear_RingBuffer(i);
|
||||
}
|
||||
|
||||
@@ -477,9 +535,18 @@ int EIB_GetEncoderData(int enc_nr, DATA *data)
|
||||
|
||||
EIB_SetStatus(enc_nr ,data->status) ;
|
||||
|
||||
data->increments = data->pos / eib.enc [enc_nr].Interpolation;
|
||||
data->interpolate = data->pos % eib.enc [enc_nr].Interpolation;
|
||||
|
||||
if (data->interpolate <0)
|
||||
{
|
||||
data->increments = data->increments -1 ;
|
||||
data->interpolate = data->interpolate + eib.enc [enc_nr].Interpolation;
|
||||
}
|
||||
|
||||
if (verbose==1)
|
||||
{
|
||||
printf(" ----%2i ---------\n",enc_nr);
|
||||
printf(" ---- EIB_GetEncoderData --- %2i -------------------\n",enc_nr);
|
||||
printf(" status = 0x%x\n",data->status);
|
||||
printf(" pos = %lli\n",data->pos);
|
||||
printf(" ref1 = %lli\n",data->ref1);
|
||||
@@ -489,8 +556,10 @@ int EIB_GetEncoderData(int enc_nr, DATA *data)
|
||||
printf(" counter= %i\n" ,data->counter);
|
||||
printf(" adc00 = %i\n" ,data->adc00);
|
||||
printf(" adc90 = %i\n" ,data->adc90);
|
||||
printf(" increments = %lli\n",data->increments);
|
||||
printf(" interpolate= %i\n",data->interpolate);
|
||||
EIB_Show_Status(data->status);
|
||||
printf(" -------------\n");
|
||||
// printf(" -------------\n");
|
||||
}
|
||||
|
||||
if (err)
|
||||
@@ -583,6 +652,8 @@ int EIB_Already_Homed(int enc_nr)
|
||||
DATA data;
|
||||
int Ref;
|
||||
|
||||
printf("EIB_Already_Homed (%i):\n", enc_nr);
|
||||
|
||||
EIB_GetEncoderData(enc_nr,&data);
|
||||
|
||||
printf("EIB_Already_Homed (%i): Enc status = 0x%i\n", enc_nr, data.status );
|
||||
@@ -613,6 +684,47 @@ int EIB_Already_Homed(int enc_nr)
|
||||
printf("EIB_Already_Homed (%i): Yet no Reference %i\n",enc_nr,Ref);
|
||||
return(0);
|
||||
}
|
||||
/***********************************************************************************************/
|
||||
/* periodically asks for the IP-address of the EIB to see if the EIB700 is still connected */
|
||||
void EIB_PingTask(void)
|
||||
{
|
||||
unsigned long IP;
|
||||
|
||||
printf("EIB_PingTask : \n");
|
||||
|
||||
do
|
||||
{
|
||||
CheckError(EIB7GetNumOfAxes(eib.handle,&IP,&IP,&IP,&IP)); /* falls die EIB nicht erreichbar ist, st"osst Checkerror die Verbindungsaufnahme an. */
|
||||
Sleep(60.0);
|
||||
} while (1);
|
||||
|
||||
}
|
||||
/***********************************************************************************************/
|
||||
/* Startet eine Task, die periodisch die Verbindung zur EIB pr"uft */
|
||||
int EIB_Start_PingTask(void)
|
||||
{
|
||||
printf("EIB_Start_PingTask: Start Task to periodically check the connection to EIB700\n");
|
||||
|
||||
if (PingTid)
|
||||
{
|
||||
printf("EIB_Start_PingTask: Task has already been started => exit.\n");
|
||||
return(MON_NO_ERROR);
|
||||
}
|
||||
|
||||
PingTid = epicsThreadCreate("EIB_ConnectTask", 30, epicsThreadGetStackSize(epicsThreadStackMedium), (EPICSTHREADFUNC) EIB_PingTask, 0);
|
||||
|
||||
if (PingTid)
|
||||
{
|
||||
return(MON_NO_ERROR);
|
||||
printf("EIB_Start_PingTask: Started.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
return(MON_ERROR);
|
||||
printf("EIB_Start_PingTask: NOT Started.\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***********************************************************************************************/
|
||||
/* This task runs always, but is only triggered if a connection error occurs */
|
||||
@@ -668,14 +780,15 @@ void EIB_ConnectTask(void)
|
||||
|
||||
if (eib.enc[enc_nr].iface )
|
||||
{
|
||||
if (!EIB_Already_Homed(enc_nr)) /* after a reconnection, check if device was power cylced and lost reference */
|
||||
if (EIB_Already_Homed(enc_nr)) /* after a reconnection, check if device was power cylced and lost reference */
|
||||
{
|
||||
if (cdbg) printf("Encoder %i not homed -> Initialize encoder \n",enc_nr);
|
||||
EIB_Init_Enc(enc_nr);
|
||||
printf("\n\n EIB_ConnectTask: Encoder %i is homed -> Do NOT initialize encoder\n",enc_nr);
|
||||
printf(" The Encoder can be initialized via Menu-command\n\n\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cdbg) printf("Encoder %i is still homed -> Do NOT initialize encoder \n",enc_nr);
|
||||
if (cdbg) printf("Encoder %i not homed -> Initialize encoder \n",enc_nr);
|
||||
EIB_Init_Enc(enc_nr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -757,6 +870,8 @@ int EIB_GetReferenceActive(int enc_nr)
|
||||
|
||||
}
|
||||
/***********************************************************************************************/
|
||||
/* Set HOMED-field in the encoder-structure to the value of HOMED */
|
||||
/* eventually update LastRef */
|
||||
void EIB_UpdateHOMED(int enc_nr, int HOMED, long ref)
|
||||
{
|
||||
|
||||
@@ -1031,6 +1146,9 @@ int EIB_Init_Enc(int enc_nr) /* initialize selected encoder */
|
||||
char Msg[200];
|
||||
int Comp;
|
||||
|
||||
printf("EIB_Init_Enc(%i):\n",enc_nr);
|
||||
|
||||
|
||||
if ((enc_nr<0) || (enc_nr>=NUM_OF_AXIS)) // falls nicht connected belege ich die Axen trotzdem
|
||||
{
|
||||
printf("EIB_Init_Enc: wrong axis number %i, valid values are 1 ..%i\n",enc_nr,NUM_OF_AXIS);
|
||||
@@ -1078,9 +1196,13 @@ int EIB_Init_Enc(int enc_nr) /* initialize selected encoder */
|
||||
case 2049:
|
||||
case 1:
|
||||
/*----------------- Versuche heauszufinden ob die EIB noch eine g"ultige Referenz hat ------------------------*/
|
||||
|
||||
/* da hier auf jeden fall die Funktion EIB7InitAxis aufgerufen wird ist die Achse anschliesend nicht gehomet */
|
||||
|
||||
err= EIB_GetEncoderData(enc_nr,&Data); /* Get Value of Ref1-Mark */
|
||||
printf("EIB_GetEncoderData returns error code %li\n",err);
|
||||
|
||||
|
||||
err= EIB_GetEncoderData(enc_nr,&Data);
|
||||
if (err!=0) printf("EIB_GetEncoderData returns error code %li\n",err);
|
||||
RefMarks = eib.enc[enc_nr].RefMarks;
|
||||
|
||||
switch (RefMarks)
|
||||
@@ -1112,6 +1234,8 @@ int EIB_Init_Enc(int enc_nr) /* initialize selected encoder */
|
||||
eib.enc[enc_nr].HOMED = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ------------------ Initialisieren der Achse falls noch keine Referenz gefunden wurde -------------*/
|
||||
|
||||
fprintf(stderr, "EIB_Init_Enc (%i): Initializing encoder for 1 Vpp\n",enc_nr);/* 1 Vpp */
|
||||
@@ -1132,7 +1256,6 @@ int EIB_Init_Enc(int enc_nr) /* initialize selected encoder */
|
||||
Lines = eib.enc[enc_nr].Lines ;
|
||||
RefSep = eib.enc[enc_nr].RefSep;
|
||||
Comp = eib.enc[enc_nr].Comp;
|
||||
printf("\n\n\nEIB_Init_Enc (%i): Comp= %i\n\n\n\n",enc_nr,Comp );
|
||||
|
||||
err=EIB7InitAxis(eib.axishandles[enc_nr],
|
||||
iface, /* incremental, Endat ... */
|
||||
@@ -1162,20 +1285,22 @@ int EIB_Init_Enc(int enc_nr) /* initialize selected encoder */
|
||||
printf(" EIB7_RT_Long = %i\n",EIB7_RT_Long );
|
||||
printf(" EIB7_CT_Long = %i\n",EIB7_CT_Long );
|
||||
|
||||
printf("EIB_Init_Enc (%i): EIB7InitAxis return code %li = 0%lx\n",enc_nr,err,err);
|
||||
printf("EIB_Init_Enc (%i): EIB7InitAxis return code %li(0x0%lx)\n",enc_nr,err,err);
|
||||
switch (err)
|
||||
{
|
||||
case EIB7_NoError : printf("EIB_Init_Enc (%i): EIB_GetEncoderData no error\n",enc_nr);
|
||||
case EIB7_NoError : printf("EIB_Init_Enc (%i): EIB_GetEncoderData all fine.\n",enc_nr);
|
||||
break;
|
||||
|
||||
case EIB7_ConfOptIncons : sprintf(Msg,"initAxis (%i): EIB7_ConfOptIncons",enc_nr);
|
||||
case EIB7_ConfOptIncons : sprintf(Msg,"EIB_Init_Enc (%i): EIB7_ConfOptIncons.",enc_nr);
|
||||
MonError(Msg);
|
||||
break;
|
||||
|
||||
default : sprintf(Msg,"Error: EIB7_ConfOptIncons");
|
||||
default : sprintf(Msg,"EIB_Init_Enc (%i): error %li not handled.",enc_nr,err);
|
||||
|
||||
|
||||
}
|
||||
|
||||
EIB_UpdateHOMED(enc_nr,0 , 0);
|
||||
break;
|
||||
|
||||
case 2: fprintf(stderr, "EIB_Init_Enc: Initializing encoder %d for EnDat 2.1\n", enc_nr+1); /* EnDat 2.1 */
|
||||
@@ -1273,7 +1398,7 @@ int EIB_Connect(char *hostname)
|
||||
{
|
||||
CheckError(err);
|
||||
MonError("EIB_Connect : cannot open");
|
||||
if (cdbg) printf ("EIB_Connect : cannot open\n");
|
||||
if (cdbg) printf ("EIB_Connect : cannot open, -> return.\n\n");
|
||||
return(MON_ERROR);
|
||||
}
|
||||
if (cdbg) printf("EIB_Connect : firmware version: %s\n",fw_version);
|
||||
@@ -1306,14 +1431,18 @@ int EIB_Connect(char *hostname)
|
||||
{
|
||||
CheckError(err);
|
||||
MonError("EIB_Connect : error getting axis info");
|
||||
if (cdbg) printf ("EIB_Connect : error getting axis info\n");
|
||||
if (cdbg) printf ("EIB_Connect : error getting axis info, -> return\n");
|
||||
return(MON_ERROR);
|
||||
}
|
||||
|
||||
if (cdbg) printf("EIB_Connect : generate update event %i \n",MONINT_EVNT_UPDATE);
|
||||
|
||||
eib.connected=1; monintGenerator(MONINT_EVNT_UPDATE);
|
||||
|
||||
printf("EIB : %li axes\n", eib.num);
|
||||
|
||||
for (i=0;i< eib.num;i++ ) eib.enc[i].axishandle = &eib.axishandles[i];
|
||||
|
||||
eib.connected=1; monintGenerator(MONINT_EVNT_UPDATE);
|
||||
|
||||
if (cdbg) printf("EIB_Connect : connect %li axes. Done.\n",eib.num);
|
||||
|
||||
@@ -1424,6 +1553,13 @@ int EIB_Start()
|
||||
}
|
||||
printf("EIB_Start : MonitorRefTask successfully started\n");
|
||||
|
||||
if (EIB_Start_PingTask())
|
||||
{
|
||||
printf("EIB_Start : Could not start PingTask\n");
|
||||
exit(1);
|
||||
}
|
||||
printf("EIB_Start : PingTask successfully started\n");
|
||||
|
||||
|
||||
epicsMessageQueueSendWithTimeout(ConQueue, 0, 0, 1); /* Starte den Verbindungsaufbau und die Initialisierung */
|
||||
|
||||
@@ -1452,10 +1588,29 @@ void EIB_Show_RingBuffer(int enc_nr)
|
||||
for (i=0; i<NUMPOINTS;i++)
|
||||
{
|
||||
db=&(enc->History[i]);
|
||||
if (db!=NULL ) printf("%4i val = %lli , adc0 = %i , adc90 = %i\n",i,db->pos, db->adc00,db->adc90 );
|
||||
if (db!=NULL ) printf("%4i val = %lli, inter = %i, adc0 = %i, adc90 = %i, myInter=%i \n",i,db->pos, db->interpolate,db->adc00,db->adc90,db->myInterpolate );
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************************************/
|
||||
void EIB_CalcDevelop(DATA *db)
|
||||
{
|
||||
int x,y, inter;
|
||||
double phi,frac;
|
||||
|
||||
x = db->adc90 - 2048;
|
||||
y = db->adc00 - 2048;
|
||||
phi = arctan(x,y);
|
||||
frac = phi/2.0/M_PI + 0.125;
|
||||
printf("adc90= %i adc00= %i phi= %f frac=%f ",x,y,phi,frac);
|
||||
if (frac>1) frac = frac-1.0;
|
||||
|
||||
inter = (int) (4095.0 * frac);
|
||||
db->myInterpolate = 4095-inter;
|
||||
|
||||
|
||||
printf(" frac=%f, myInter= %i\n",frac, db->myInterpolate);
|
||||
}
|
||||
/***********************************************************************************************/
|
||||
/* adds every data to ring-buffer */
|
||||
void EIB_AddPoint(int enc_nr, DATA *db)
|
||||
@@ -1472,6 +1627,7 @@ void EIB_AddPoint(int enc_nr, DATA *db)
|
||||
|
||||
index = eib.enc[enc_nr].NextHist;
|
||||
|
||||
EIB_CalcDevelop (db);
|
||||
|
||||
if (verbose) printf("Add point(%i) %i, position = %lli\n",enc_nr,index, db->pos );
|
||||
|
||||
@@ -1480,30 +1636,41 @@ void EIB_AddPoint(int enc_nr, DATA *db)
|
||||
enc->History[index] = *db;
|
||||
|
||||
|
||||
|
||||
if (index==NUMPOINTS-1) eib.enc[enc_nr].NextHist=0; else eib.enc[enc_nr].NextHist++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/***********************************************************************************************/
|
||||
/* write data to file */
|
||||
void EIB_WritePoints(int enc_nr, char *filename)
|
||||
/* write data to file */
|
||||
/* what = 0: only adc00 and adc90 */
|
||||
/* what = 1: all data */
|
||||
void EIB_WritePoints(int enc_nr, char *filename,int what)
|
||||
{
|
||||
ENC *enc;
|
||||
int i;
|
||||
FILE *out;
|
||||
ENC *enc;
|
||||
int i;
|
||||
FILE *out;
|
||||
DataArr *History;
|
||||
|
||||
enc = &(eib.enc[enc_nr]);
|
||||
History= &(eib.enc[enc_nr].History);
|
||||
if ( EIB_ValidEncoder(enc_nr) )
|
||||
{
|
||||
printf("Invalid encoder num = %i \n",enc_nr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (verbose) printf("EIB_WritePoints(%i): write to %s \n",enc_nr, filename);
|
||||
|
||||
|
||||
enc = &(eib.enc[enc_nr]);
|
||||
History = &(eib.enc[enc_nr].History);
|
||||
|
||||
out = fopen(filename, "w");
|
||||
|
||||
for (i=0;i<NUMPOINTS;i++)
|
||||
fprintf(out," %i, %i \n", (int) enc->adc00[i], (int) enc->adc90[i] );
|
||||
// fprintf(out," %i, %i \n", (int) History[i]->adc00 , (int) History[i]->adc90 );
|
||||
if (what ==0)
|
||||
fprintf(out," %i %i \n", (int) enc->adc00[i], (int) enc->adc90[i] );
|
||||
else
|
||||
fprintf(out," %12lli %i %6i %6i 0x%04X %i \n", (*History)[i].pos, (*History)[i].interpolate , (*History)[i].adc00, (*History)[i].adc90, (*History)[i].status, (*History)[i].myInterpolate );
|
||||
|
||||
fclose(out);
|
||||
|
||||
@@ -1617,6 +1784,7 @@ void EIB_ShowEncoder(ENC enc)
|
||||
printf(" Comp = %i\n", enc.Comp);
|
||||
printf(" NextHist = %i\n", enc.NextHist);
|
||||
printf(" AddPoints = %i\n", enc.AddPoints);
|
||||
printf(" Interpolation= %i\n", enc.Interpolation);
|
||||
switch ( enc.EncType)
|
||||
{
|
||||
case 0 : printf(" EncType = %1i (Linear)\n",enc.EncType);
|
||||
@@ -1748,8 +1916,9 @@ void EIB_SetIPF(int enc_nr, int ipf)
|
||||
|
||||
switch(ipf)
|
||||
{
|
||||
case 111206630 : IPF = EIB7_ICF_10x;
|
||||
EDGE= EIB7_ICE_1x;
|
||||
case 40 : IPF = EIB7_ICF_10x;
|
||||
EDGE= EIB7_ICE_1x;
|
||||
|
||||
break;
|
||||
|
||||
case 100 : IPF = EIB7_ICF_100x;
|
||||
@@ -1769,16 +1938,64 @@ void EIB_SetIPF(int enc_nr, int ipf)
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
printf("EIB_SetIPF ipf = %i edge = %i\n",IPF, EDGE);
|
||||
|
||||
error =EIB7SetIntervalCounterInterpolation(eib.handle, IPF , EDGE);
|
||||
// CheckError(EIB7SetIntervalCounterInterpolation(eib.eib, IPF , EDGE));
|
||||
CheckError(error);
|
||||
error =EIB7SetIntervalCounterInterpolation(eib.handle, IPF , EDGE);
|
||||
CheckError(error);
|
||||
printf("EIB_SetIPF error = %i \n",error);
|
||||
|
||||
if (!error) eib.enc[enc_nr].Interpolation= ipf;
|
||||
|
||||
}
|
||||
/************************************************************************************/
|
||||
int EIB_CheckConnection(int *status)
|
||||
{
|
||||
EIB7_HANDLE eibh; /* EIB handle */
|
||||
int err;
|
||||
EIB7_CONN_STATUS conn_stat;
|
||||
|
||||
eibh = eib.handle;
|
||||
err = EIB7GetConnectionStatus(eibh,&conn_stat);
|
||||
|
||||
printf("EIB_CheckConnection: err = %i status = %i\n",err,conn_stat );
|
||||
|
||||
if (err)
|
||||
{
|
||||
CheckError(err);
|
||||
*status = 1;
|
||||
return(1);
|
||||
}
|
||||
|
||||
*status = conn_stat;
|
||||
|
||||
switch(conn_stat)
|
||||
{
|
||||
case EIB7_CS_Connected : printf("EIB_CheckConnection: Connected to EIB74x\n");
|
||||
return(MON_NO_ERROR);
|
||||
break;
|
||||
case EIB7_CS_Closed : printf("EIB_CheckConnection: No connection to EIB74x\n");
|
||||
return(MON_NO_ERROR);
|
||||
break;
|
||||
case EIB7_CS_Timeout : printf("EIB_CheckConnection: Timeout to EIB74x\n");
|
||||
return(MON_ERROR);
|
||||
break;
|
||||
|
||||
case EIB7_CS_ConnectionReset: printf("EIB_CheckConnection:Connection to EIB74x closed\n");
|
||||
return(MON_ERROR);
|
||||
break;
|
||||
|
||||
case EIB7_CS_TransmissionError: printf("EIB_CheckConnection:Transmission Error to EIB74x\n");
|
||||
return(MON_ERROR);
|
||||
break;
|
||||
|
||||
default : printf("EIB_CheckConnection: err = %i \n",err);
|
||||
return(MON_ERROR);
|
||||
|
||||
}
|
||||
|
||||
return(MON_NO_ERROR);
|
||||
}
|
||||
/************************************************************************************/
|
||||
void EIB_Menu(void)
|
||||
{
|
||||
@@ -1792,6 +2009,8 @@ void EIB_Menu(void)
|
||||
long lval;
|
||||
char ParamName[80];
|
||||
int ipf;
|
||||
int status=0;
|
||||
int what;
|
||||
|
||||
enc_nr = 0;
|
||||
|
||||
@@ -1810,10 +2029,12 @@ enc_nr = 0;
|
||||
printf(" (F) Calc Reference ........ (F)\n");
|
||||
printf(" (G) Check Ref_status ...... (G)\n");
|
||||
printf(" (H) Reference axis ........ (I)\n");
|
||||
printf(" (J) Check Connection ...... (J)\n");
|
||||
printf(" (I) Initialize axis ....... (I)\n");
|
||||
printf(" (N) Set long parameter .... (N)\n");
|
||||
printf(" (O) Generate Event ....... (O)\n");
|
||||
printf(" (P) Show Ringbuffer ...... (P)\n");
|
||||
printf(" (Q) Write Ringbuffer ...... (Q)\n");
|
||||
printf(" (R) Read ................. (R)\n");
|
||||
printf(" (S) Show ................. (S)\n");
|
||||
printf(" (T) Show_Encoder ......... (T)\n");
|
||||
@@ -1821,7 +2042,7 @@ enc_nr = 0;
|
||||
printf(" (V) Clear Encoder Error ... (V)\n");
|
||||
// printf1120663(" (U) Monitor Ref-status on. (U)\n");
|
||||
// printf(" (V) Monitor Ref-status off. (V)\n");
|
||||
printf(" (W) Wait for Ref ......... (W)\n");
|
||||
printf(" (W) Start Ping Tak ....... (W)\n");
|
||||
printf(" (Z) EXIT Menu ............. (Z)\n");
|
||||
printf(" Input : ");
|
||||
choice = selection();
|
||||
@@ -1865,12 +2086,10 @@ enc_nr = 0;
|
||||
eib.enc[enc_nr].iface=1;
|
||||
EIB_Init_Enc(enc_nr);
|
||||
break;
|
||||
/*
|
||||
case 'J' : EIB_ReadRef(1,&lval);
|
||||
printf("Ref at %li\n",lval);
|
||||
case 'J' : EIB_CheckConnection(&status);
|
||||
printf("Status = %i 0x%x\n",status,(unsigned int) status);
|
||||
break;
|
||||
*/
|
||||
case 'N' : printf("Parametername (long)) : ");
|
||||
case 'N' : printf("Parametername (long)) : ");
|
||||
scanf("%s",(char *)ParamName);CR();
|
||||
if (!strcmp(ParamName," ")) break;
|
||||
printf("Value to set : ");
|
||||
@@ -1887,7 +2106,10 @@ enc_nr = 0;
|
||||
|
||||
case 'Q' : printf("Filename : \n");
|
||||
scanf("%s",(char *)filename);CR();
|
||||
EIB_WritePoints( enc_nr, filename);
|
||||
printf(" only analog values (0) \n");
|
||||
printf(" all data (1) : ");
|
||||
scanf("%i",&what);CR();
|
||||
EIB_WritePoints( enc_nr, filename,what);
|
||||
break;
|
||||
|
||||
case 'R' : done = EIB_Read(enc_nr,&value);
|
||||
@@ -1912,6 +2134,9 @@ enc_nr = 0;
|
||||
//case 'V' : EIB_SetRefCheck(enc_nr, EIB7_MD_Disable);
|
||||
break;
|
||||
|
||||
case 'W' : EIB_Start_PingTask();
|
||||
break;
|
||||
|
||||
case 'Y' : break; /* Refresh*/
|
||||
|
||||
case 'X' : return;
|
||||
|
||||
+7
-2
@@ -19,9 +19,12 @@ struct T_Data
|
||||
unsigned short counter;
|
||||
unsigned short adc00;
|
||||
unsigned short adc90;
|
||||
ENCODER_POSITION increments; /* from EIB: integer number of increments */
|
||||
int interpolate; /* from EIB: fractional number of increment */
|
||||
int myInterpolate; /* das berechne ich aus adc00 und adc90 */
|
||||
};
|
||||
|
||||
typedef struct T_Data DataArr[NUMPOINTS];
|
||||
|
||||
|
||||
typedef struct T_enc ENC;
|
||||
struct T_enc
|
||||
@@ -46,7 +49,9 @@ struct T_enc
|
||||
unsigned long Status; /* Data.status from EIB_read */
|
||||
double adc00[NUMPOINTS]; /* for waveform-record */
|
||||
double adc90[NUMPOINTS]; /* for waveform-record */
|
||||
DATA History[NUMPOINTS]; /* not used */
|
||||
// DATA History[NUMPOINTS]; /* not used */
|
||||
DataArr History; /* not used */
|
||||
unsigned int Interpolation; /* 4096 default */
|
||||
};
|
||||
|
||||
typedef struct T_eib EIB;
|
||||
|
||||
@@ -4,12 +4,13 @@
|
||||
# 2049 incremental 11 uA
|
||||
|
||||
Hostname EIB741-639546320.psi.ch
|
||||
# RON
|
||||
# Hostname 129.129.179.244
|
||||
# RON
|
||||
|
||||
E0_Name "RON"
|
||||
E0_iface 2049
|
||||
E0_RefMarks 1 # How meany reference marks (1 standard,2 = distance coded)
|
||||
E0_EncType 1 # 0 linear, 1 Rotary
|
||||
E0_EncType 1 # 0 linear, 1 rotary
|
||||
E0_Lines 36000 # per mm for AxeType = 0, per revolution for AxeType = 1:
|
||||
E0_Comp 0 # Compenation off (0) On(1)
|
||||
|
||||
@@ -18,15 +19,17 @@
|
||||
E1_Name "X05DA"
|
||||
E1_iface 1
|
||||
E1_RefMarks 2 # How meany reference marks (1 standard,2 = distance coded)
|
||||
E1_EncType 1 # 0 linear, 1 Rotary
|
||||
E1_Lines 3600 # per mm for AxeType = 0, per revolution for AxeType = 1:
|
||||
E1_RefSep 1000 # numbe of periods between two reference marks
|
||||
E1_EncType 1 # 0 linear, 1 rotary
|
||||
E1_Lines 36000 # per mm for AxeType = 0, per revolution for AxeType = 1:
|
||||
E1_RefSep 1000 # number of periods between two reference marks
|
||||
E1_SigV +1 # for distance coded refmarks, +1 standard, -1 else
|
||||
E1_Comp 0 # Compenation off (0) On(1)
|
||||
|
||||
# ROD
|
||||
E2_Name "ROD"
|
||||
E2_iface 1
|
||||
E2_RefMarks 1 # How meany reference marks (1 standard,2 = distance coded)
|
||||
E2_EncType 1 # 0 linear, 1 Rotary
|
||||
E2_EncType 1 # 0 linear, 1 rotary
|
||||
E2_Lines 3600 # per mm for AxeType = 0, per revolution for AxeType = 1:
|
||||
E2_Comp 0 # Compenation off (0) On(1)
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
epicsEnvSet("ARCH","linux-x86_64")
|
||||
epicsEnvSet("IOC","ioceib")
|
||||
epicsEnvSet("TOP","/afs/psi.ch/user/f/follath_r/progs/eib")
|
||||
epicsEnvSet("EPICS_BASE","/afs/psi.ch/user/f/follath_r/EPICS/base")
|
||||
@@ -1 +0,0 @@
|
||||
1 0
|
||||
Reference in New Issue
Block a user