forked from optics/eib700
IO
This commit is contained in:
@@ -3,5 +3,8 @@
|
||||
\BOOKMARK [1][-]{section.2}{Startup}{}% 3
|
||||
\BOOKMARK [2][-]{subsection.2.1}{Startup procedure}{section.2}% 4
|
||||
\BOOKMARK [2][-]{subsection.2.2}{Configuration file EIB.CFG}{section.2}% 5
|
||||
\BOOKMARK [1][-]{section.3}{Heydeman correction}{}% 6
|
||||
\BOOKMARK [2][-]{subsection.3.1}{Take data}{section.3}% 7
|
||||
\BOOKMARK [1][-]{section.3}{Monitoring}{}% 6
|
||||
\BOOKMARK [2][-]{subsection.3.1}{Connectivity}{section.3}% 7
|
||||
\BOOKMARK [2][-]{subsection.3.2}{Signal loss}{section.3}% 8
|
||||
\BOOKMARK [1][-]{section.4}{Heydeman correction}{}% 9
|
||||
\BOOKMARK [2][-]{subsection.4.1}{Take data}{section.4}% 10
|
||||
|
||||
Binary file not shown.
@@ -276,6 +276,47 @@ If not it starts the softioc which performs several initialization steps:
|
||||
\end{center}
|
||||
x denotes the channel number 0,1,2,3.
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\section{Monitoring}
|
||||
|
||||
\subsection{Connectivity}
|
||||
\begin{itemize}
|
||||
\item The task {\tt EIB$\_$Start$\_$PingTask} monitors the connection to the EIB74x hardware
|
||||
and writes the status into the PV \PV{EIB:CONNECTED}. If the connection is interrupted it peridically tries to reconnect.
|
||||
|
||||
\item After reestablishing the connection, the status of the index marks is read and the HOMED flags of the encoders are set accordingly.
|
||||
\item If the EIB was powercycled, the HOMED flags are set to FALSE.
|
||||
|
||||
\end{itemize}
|
||||
|
||||
The same procedure applies after a restart of the softioc.
|
||||
By this, the necessity of an new index search is avoided.
|
||||
|
||||
|
||||
\subsection{Signal loss}
|
||||
\begin{itemize}
|
||||
\item When an encoder is disconnected while the softioc tries to read it, the EIB sets the flag "signal amplitude error" in the encoder status.
|
||||
The softioc indicates this in the \PV {EIB:CH$\_$x$\_$SIGNALERROR}.
|
||||
|
||||
\item Unfortunately, this works only when the encoder readout happens during the time when the encoder is disconnected.
|
||||
If the encoder is removed and reconnected between two readouts, the encoder status does not reflect this in the "signal amplitude error" flag.
|
||||
|
||||
\item What can be seen is that the status reports an "Frequency exceeded" in that case.
|
||||
This could be reported to the user with a recommendation to start an index search.
|
||||
|
||||
\end{itemize}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\section{Heydeman correction}
|
||||
|
||||
|
||||
+111
-33
@@ -162,6 +162,7 @@ int EIB_Connect (char *hostname);
|
||||
int EIB_Init_Enc(int enc_nr); /* initialize selected encoder */
|
||||
void EIB_StopRef( int enc_nr);
|
||||
void EIB_Clear_RingBuffer(int enc_nr);
|
||||
void EIB_ShowIO(void);
|
||||
|
||||
/****************************************************************************/
|
||||
void ReadHeyFile(char *filename, HEYARRAY *h)
|
||||
@@ -636,6 +637,9 @@ int i,j;
|
||||
eib.handle = 0;
|
||||
eib.connected= 0;
|
||||
eib.num = 0; /* how many axis? -> initialized in EIB_connect */
|
||||
|
||||
eib.input.num_ports =0;
|
||||
eib.output.num_ports=0;
|
||||
|
||||
strncpy(eib.fw_version, "\0", 20);
|
||||
sprintf(eib.hostname ,"EIB741-639546320.psi.ch");
|
||||
@@ -660,6 +664,7 @@ int i,j;
|
||||
|
||||
for (j=0;j<NUMHEY;j++) eib.enc [i].Correction[j]=0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2114,7 +2119,10 @@ void EIB_ShowEib()
|
||||
printf(" cdbg : %i\n", cdbg );
|
||||
printf(" rdbg : %i\n", rdbg );
|
||||
printf(" verbose : %i\n", verbose );
|
||||
|
||||
printf(" #input ports : %li\n", eib.input.num_ports);
|
||||
printf(" #output ports : %li\n", eib.output.num_ports);
|
||||
EIB_ShowIO();
|
||||
|
||||
for (i=0;i<NUM_OF_AXIS;i++)
|
||||
{
|
||||
printf("\n Index %i, axehandle = %i\n",i,eib.axishandles[i]);
|
||||
@@ -2337,8 +2345,8 @@ void EIB_InitIO_old(void)
|
||||
printf(" level = %li\n",level);
|
||||
|
||||
}
|
||||
/************************************************************************************/
|
||||
|
||||
/************************************************************************************/
|
||||
void EIB_InitIO(void)
|
||||
{
|
||||
EIB7_HANDLE eibh; /* EIB handle */
|
||||
@@ -2348,63 +2356,132 @@ void EIB_InitIO(void)
|
||||
|
||||
eibh = eib.handle;
|
||||
|
||||
err = EIB7GetIO(eibh, &(eib.input.set[0]) ,NUM_IO_PORTS, &(eib.input.num_io_ports),
|
||||
&(eib.output.set[0]),NUM_IO_PORTS, &(eib.output.num_io_ports) );
|
||||
err = EIB7GetIO(eibh, &(eib.input.set[0]) ,NUM_IO_PORTS, &(eib.input.num_ports),
|
||||
&(eib.output.set[0]),NUM_IO_PORTS, &(eib.output.num_ports) );
|
||||
|
||||
printf(" EIB_InitIo : err = %i\n",err);
|
||||
CheckError(err);
|
||||
printf(" ilen = %li\n",eib.input.num_io_ports);
|
||||
printf(" olen = %li\n",eib.output.num_io_ports);
|
||||
printf(" num input ports = %li\n",eib.input.num_ports);
|
||||
printf(" num output ports = %li\n",eib.output.num_ports);
|
||||
|
||||
for (port=0;port<eib.input.num_io_ports;port++)
|
||||
for (port=0;port<eib.output.num_ports;port++)
|
||||
{
|
||||
err = EIB7InitOutput(eib.output.set[port], 1, EIB7_MD_Enable);
|
||||
printf(" EIB7InitOutput[%1i] : err = %i\n",port,err);
|
||||
if (verbose) printf(" EIB7InitOutput[%1i] : err = %i\n",port,err);
|
||||
CheckError(err);
|
||||
}
|
||||
|
||||
for (port=0;port<eib.input.num_ports;port++)
|
||||
{
|
||||
err = EIB7InitInput(eib.input.set[port], 1, EIB7_MD_Enable);
|
||||
if (verbose) printf(" EIB7InitInput[%1i] : err = %i\n",port,err);
|
||||
CheckError(err);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************************/
|
||||
void EIB_SetIO(int port, unsigned long level)
|
||||
/* z.B. num_io_ports = 4 , port =[0,1,2,3] */
|
||||
/* initialize num_ports = 0 */
|
||||
int EIB_ValidOutPort(int port)
|
||||
{
|
||||
if (port >= eib.output.num_ports) return(MON_ERROR);
|
||||
if (port < 0 ) return(MON_ERROR);
|
||||
|
||||
return(MON_NO_ERROR);
|
||||
}
|
||||
|
||||
/************************************************************************************/
|
||||
void EIB_SetOutput(int port, unsigned long level)
|
||||
{
|
||||
int err;
|
||||
|
||||
printf(" EIB7WriteIO[%i] to level = %li\n",port, level);
|
||||
if ( EIB_ValidOutPort(port))
|
||||
{
|
||||
if (verbose)
|
||||
{
|
||||
printf(" EIB7WriteIO: invalid port %i, maxport = %li\n",port, eib.output.num_ports);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
printf(" EIB7WriteIO[%i] to level = %li\n",port, level);
|
||||
|
||||
err = EIB7WriteIO(eib.output.set[port], level);
|
||||
|
||||
CheckError(err);
|
||||
|
||||
err = EIB7WriteIO(eib.output.set[port], level);
|
||||
|
||||
CheckError(err);
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************************/
|
||||
void EIB_ReadIO(int port, unsigned long *level)
|
||||
void EIB_ReadOutput(int port, unsigned long *level)
|
||||
{
|
||||
EIB7_IOMODE mode;
|
||||
int err;
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
if ( EIB_ValidOutPort(port))
|
||||
{
|
||||
printf(" EIB_ReadOutput[%i]: invalid port , maxport = %li\n",port, eib.output.num_ports);
|
||||
return;
|
||||
}
|
||||
else
|
||||
printf("EIB_ReadOutput[%i]: level = %li\n",port, *level);
|
||||
}
|
||||
|
||||
|
||||
err = EIB7ReadIO(eib.output.set[port], &mode, level);
|
||||
CheckError(err);
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************************/
|
||||
void EIB_ReadInput(int port, unsigned long *level)
|
||||
{
|
||||
EIB7_IOMODE mode;
|
||||
int err;
|
||||
|
||||
err = EIB7ReadIO(eib.output.set[port], &mode, level);
|
||||
|
||||
/* printf(" EIB7ReadIO[%i] \n",port );
|
||||
printf(" mode = %x\n" ,mode);
|
||||
printf(" level = %li\n",*level);
|
||||
*/
|
||||
err = EIB7ReadIO(eib.input.set[port], &mode, level);
|
||||
CheckError(err);
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************************/
|
||||
void EIB_ShowIO(void)
|
||||
{
|
||||
int port;
|
||||
unsigned long level;
|
||||
|
||||
printf(" EIB_ShowIO: levels = ");
|
||||
for (port=0;port<eib.input.num_io_ports;port++)
|
||||
if (eib.output.num_ports)
|
||||
{
|
||||
EIB_ReadIO (port ,&level);
|
||||
printf(" %li ",level);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
printf(" EIB_ShowIO: Output levels (%li) = ",eib.output.num_ports);
|
||||
for (port=0;port < eib.output.num_ports;port++)
|
||||
{
|
||||
EIB_ReadOutput (port ,&level);
|
||||
printf(" %li ",level);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
else
|
||||
printf(" EIB_ShowIO: No output ports configured\n");
|
||||
|
||||
|
||||
|
||||
if (eib.input.num_ports)
|
||||
{
|
||||
printf(" EIB_ShowIO: Input levels (%li) = ", eib.input.num_ports);
|
||||
for (port=0;port < eib.input.num_ports;port++)
|
||||
{
|
||||
EIB_ReadInput (port ,&level);
|
||||
printf(" %li ",level);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
else
|
||||
printf(" EIB_ShowIO: No input ports configured\n");
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************************/
|
||||
@@ -2461,8 +2538,8 @@ enc_nr = 0;
|
||||
printf(" (W) Start Ping Tak ....... (W)\n");
|
||||
printf(" (Z) EXIT Menu ............. (Z)\n");
|
||||
printf(" (1) InitIO ................ (1)\n");
|
||||
printf(" (2) WriteIO ............... (2)\n");
|
||||
printf(" (3) ReadIO ................ (3)\n");
|
||||
printf(" (2) WriteOutput............ (2)\n");
|
||||
printf(" (3) ReadOutput ............ (3)\n");
|
||||
printf(" (4) ShowIO ................ (4)\n");
|
||||
printf(" Input : ");
|
||||
choice = selection();
|
||||
@@ -2567,16 +2644,17 @@ enc_nr = 0;
|
||||
printf("value ");
|
||||
scanf("%li",&level);CR();
|
||||
|
||||
EIB_SetIO(port, level);
|
||||
EIB_SetOutput(port, level);
|
||||
break;
|
||||
|
||||
case '3' : printf("Read from port ");
|
||||
scanf("%i",&port);CR();
|
||||
scanf("%i",&port);
|
||||
|
||||
EIB_ReadIO(port, &level);
|
||||
EIB_ReadOutput(port, &level);
|
||||
printf("value = %li\n",level);
|
||||
break;
|
||||
case '4' : EIB_ShowIO( );
|
||||
|
||||
case '4' : EIB_ShowIO();
|
||||
break;
|
||||
|
||||
case 'V' : EIB_ClearEncoderError(enc_nr);
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ typedef struct T_Data DataArr[NUMPOINTS];
|
||||
struct T_IO
|
||||
{
|
||||
EIB7_IO set[NUM_IO_PORTS];
|
||||
unsigned long num_io_ports; /* num of valid io-handles 0,1,2,3 */
|
||||
unsigned long num_ports; /* num of valid io-handles 0,1,2,3 */
|
||||
};
|
||||
typedef struct T_IO IO;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user