DCU Functions


Functions

bool fwSpecs_DCUCreateRegister (string pRegister, string pSPECS, int pMasterID, int pSlaveAddress, int pAddress, int pChannelNum, int pRegisterNum, int pRefreshRate, bool pDataChange)
int fwSpecs_DCUResetByChannel (string pReg)
int fwSpecs_DCUReset (string pSPECS, int pMasterID, int pSlaveAddress, int pAddress)
int fwSpecs_DCUInitialize (string pSPECS, int pMasterID, int pSlaveAddress, int pAddress)
int fwSpecs_DCUSetMode (string pSPECS, int pMasterID, int pSlaveAddress, int pAddress, int pMode)
int fwSpecs_DCUGetMode (string pSPECS, int pMasterID, int pSlaveAddress, int pAddress, int &pMode)
int fwSpecs_DCUAcquire (string pSPECS, int pMasterID, int pSlaveAddress, int pAddress, int pChannelNum, int &pData, float &pConvertedData)
int fwSpecs_DCURegisterWrite (string pSPECS, int pMasterID, int pSlaveAddress, int pAddress, int pRegisterNum, char pData, bool pWaitFlag=true, char pMask="")
int fwSpecs_DCURegisterRead (string pSPECS, int pMasterID, int pSlaveAddress, int pAddress, int pRegisterNum, char &pData)
int fwSpecs_DCURegisterWriteRead (string pSPECS, int pMasterID, int pSlaveAddress, int pAddress, int pRegisterNum, char pDataWrite, char &pDataRead, char pMask="")

Detailed Description

List of functions to operate with DCU (Detector Control Unit).

Function Documentation

int fwSpecs_DCUAcquire ( string  pSPECS,
int  pMasterID,
int  pSlaveAddress,
int  pAddress,
int  pChannelNum,
int &  pData,
float &  pConvertedData 
)

Acquire data from the specified DCU channel.

Parameters:
[in] pSPECS name of the SPECS.
[in] pMasterID master ID.
[in] pSlaveAddress slave address.
[in] pAddress DCU address.
[in] pChannelNum channel number where to acquire data from (FWSPECS_DCU_IA0, FWSPECS_DCU_IA1, ..., FWSPECS_DCU_IA7).
[out] pData data read from the specified DCU channel.
[out] pConvertedData converted data read from the specified DCU channel.
Returns:
= 0 no error found.

> 0 error found (related with SpecsUser; see error codes).

= -1 error found (related with PVSS).

Example:

  (...)
  int   myData;
  float myConvertedData;

  if (fwSpecs_DCUAcquire("pclbcecs03", 1, 1, 64, FWSPECS_DCU_IA7, myData, myConvertedData) == 0)   // acquire data from input analog channel 7
  {
     DebugTN("Data: " + (string) myData);
     DebugTN("Converted data: " + (string) myConvertedData);
  }
  else
     DebugTN("Error found!");
  (...)



bool fwSpecs_DCUCreateRegister ( string  pRegister,
string  pSPECS,
int  pMasterID,
int  pSlaveAddress,
int  pAddress,
int  pChannelNum,
int  pRegisterNum,
int  pRefreshRate,
bool  pDataChange 
)

Create a new DCU register for read/write/monitoring use.

Parameters:
[in] pRegister name of the DCU register to be created.
[in] pSPECS name of the SPECS.
[in] pMasterID master ID.
[in] pSlaveAddress slave address.
[in] pAddress DCU address.
[in] pChannelNum channel number (FWSPECS_DCU_IA0, FWSPECS_DCU_IA1, ..., FWSPECS_DCU_IA7).
[in] pRegisterNum register number (FWSPECS_DCU_CREG, FWSPECS_DCU_SHREG, FWSPECS_DCU_AREG, FWSPECS_DCU_LREG or FWSPECS_DCU_TREG).
[in] pRefreshRate refresh rate of the monitoring (in seconds).
[in] pDataChange data change enable/disable option. If true, the server will send data when it change, otherwise (false) the server will not send data (even if it change).
Returns:
true no error found.

false error found.

Example:

  (...)
  if (fwSpecs_DCUCreateRegister("myDCUReg", "pclbcecs03", 1, 1, 0, FWSPECS_DCU_IA0, FWSPECS_DCU_CREG, 5, true))   // create a new DCU register called 'myDCUReg'
     (...)
  else
     DebugTN("Error found!");
  (...)



int fwSpecs_DCUGetMode ( string  pSPECS,
int  pMasterID,
int  pSlaveAddress,
int  pAddress,
int &  pMode 
)

Get (read) polarity mode for the specified DCU.

Parameters:
[in] pSPECS name of the SPECS.
[in] pMasterID master ID.
[in] pSlaveAddress slave address.
[in] pAddress DCU address.
[out] pMode returned polarity mode (FWSPECS_DCU_HIR for HIR mode or FWSPECS_DCU_LIR for LIR mode).
Returns:
= 0 no error found.

> 0 error found (related with SpecsUser; see error codes).

= -1 error found (related with PVSS).

Example:

  (...)
  int myMode;

  if (fwSpecs_DCUGetMode("pclbcecs03", 1, 1, 64, myMode) == 0)   // return (read) DCU polarity mode
     if (myMode == FWSPECS_DCU_HIR)
        DebugTN("DCU in HIR mode");
     else
        DebugTN("DCU in LIR mode");
  else
     DebugTN("Error found!");
  (...)



int fwSpecs_DCUInitialize ( string  pSPECS,
int  pMasterID,
int  pSlaveAddress,
int  pAddress 
)

Perform a INITIALIZE operation in the DCU.

Parameters:
[in] pSPECS name of the SPECS.
[in] pMasterID master ID.
[in] pSlaveAddress slave address.
[in] pAddress DCU address.
Returns:
= 0 no error found.

> 0 error found (related with SpecsUser; see error codes).

= -1 error found (related with PVSS).

Example:

  (...)
  if (fwSpecs_DCUInitialize("pclbcecs03", 1, 1, 64) == 0)   // perform a INITIALIZE operation
     (...)
  else
     DebugTN("Error found!");
  (...)



int fwSpecs_DCURegisterRead ( string  pSPECS,
int  pMasterID,
int  pSlaveAddress,
int  pAddress,
int  pRegisterNum,
char &  pData 
)

Read data from the specified DCU register.

Parameters:
[in] pSPECS name of the SPECS.
[in] pMasterID master ID.
[in] pSlaveAddress slave address.
[in] pAddress DCU address.
[in] pRegisterNum register number (FWSPECS_DCU_CREG, FWSPECS_DCU_SHREG, FWSPECS_DCU_AREG, FWSPECS_DCU_LREG or FWSPECS_DCU_TREG).
[out] pData data read.
Returns:
= 0 no error found.

> 0 error found (related with SpecsUser; see error codes).

= -1 error found (related with PVSS).

Example:

  (...)
  char myData;

  if (fwSpecs_DCURegisterRead("pclbcecs03", 1, 1, 64, FWSPECS_DCU_CREG, myData) == 0)   // read a char from FWSPECS_DCU_CREG register
     DebugTN(myData);
  else
     DebugTN("Error found!");
  (...)



int fwSpecs_DCURegisterWrite ( string  pSPECS,
int  pMasterID,
int  pSlaveAddress,
int  pAddress,
int  pRegisterNum,
char  pData,
bool  pWaitFlag = true,
char  pMask = "" 
)

Write data into the specified DCU register.

Parameters:
[in] pSPECS name of the SPECS.
[in] pMasterID master ID.
[in] pSlaveAddress slave address.
[in] pAddress DCU address.
[in] pRegisterNum register number (FWSPECS_DCU_CREG, FWSPECS_DCU_AREG or FWSPECS_DCU_TREG).
[in] pData data to be written.
[in] pWaitFlag if true, the function will wait for the return value, otherwise (false) the function will not wait for the return value (in this case, the return value will be always equal to 0 or -1).
[in] pMask (optional) mask to be applied to the data.
Returns:
= 0 no error found.

> 0 error found (related with SpecsUser; see error codes).

= -1 error found (related with PVSS).

Example:

  (...)
  if (fwSpecs_DCURegisterWrite("pclbcecs03", 1, 1, 64, FWSPECS_DCU_CREG, (char) 199, true) == 0)   // write a char (199) into FWSPECS_DCU_CREG register
     (...)
  else
     DebugTN("Error found!");
  (...)



int fwSpecs_DCURegisterWriteRead ( string  pSPECS,
int  pMasterID,
int  pSlaveAddress,
int  pAddress,
int  pRegisterNum,
char  pDataWrite,
char &  pDataRead,
char  pMask = "" 
)

Write and, then, read data from the specified DCU register. This function should be used whenever possible, since it will optimize speed. Note: if the write operation fails, then the read operation will not be performed.

Parameters:
[in] pSPECS name of the SPECS.
[in] pMasterID master ID.
[in] pSlaveAddress slave address.
[in] pAddress DCU address.
[in] pRegisterNum register number (FWSPECS_DCU_CREG, FWSPECS_DCU_AREG or FWSPECS_DCU_TREG).
[in] pDataWrite data to be written.
[out] pDataRead data read.
[in] pMask (optional) mask to be applied to the data when writing.
Returns:
= 0 no error found.

> 0 error found (related with SpecsUser; see error codes).

= -1 error found (related with PVSS).

Example:

  (...)
  char myData;

  if (fwSpecs_DCURegisterWriteRead("pclbcecs03", 1, 1, 64, FWSPECS_DCU_CREG, (char) 199, myData) == 0)   // write a char (199) and, then, read
     DebugTN(myData);                                                                            // a char from FWSPECS_DCU_CREG register
  else
     DebugTN("Error found!");
  (...)



int fwSpecs_DCUReset ( string  pSPECS,
int  pMasterID,
int  pSlaveAddress,
int  pAddress 
)

Perform a RESET operation in the DCU.

Parameters:
[in] pSPECS name of the SPECS.
[in] pMasterID master ID.
[in] pSlaveAddress slave address.
[in] pAddress DCU address.
Returns:
= 0 no error found.

> 0 error found (related with SpecsUser; see error codes).

= -1 error found (related with PVSS).

Example:

  (...)
  if (fwSpecs_DCUReset("pclbcecs03", 1, 1, 64) == 0)   // perform a RESET operation
     (...)
  else
     DebugTN("Error found!");
  (...)



int fwSpecs_DCUResetByChannel ( string  pReg  ) 

Perform a Reset & Initialize operation in the DCU by giving a DCU Channel name (declared using the HW tool).

Parameters:
[in] pReg the DCU Channel name.
Returns:
= 0 no error found.

> 0 error found (related with SpecsUser; see error codes).

= -1 error found (related with PVSS).

Example:

  (...)
  if (fwSpecs_DCUResetByChannel("myBoard1.dcu.channel1") == 0)
     (...)
  else
     DebugTN("Error found!");
  (...)



int fwSpecs_DCUSetMode ( string  pSPECS,
int  pMasterID,
int  pSlaveAddress,
int  pAddress,
int  pMode 
)

Set the polarity mode (HIR or LIR) for the specified DCU.

Parameters:
[in] pSPECS name of the SPECS.
[in] pMasterID master ID.
[in] pSlaveAddress slave address.
[in] pAddress DCU address.
[in] pMode New mode (FWSPECS_DCU_HIR for HIR mode or FWSPECS_DCU_LIR for LIR mode).
Returns:
= 0 no error found.

> 0 error found (related with SpecsUser; see error codes).

= -1 error found (related with PVSS).

Example:

  (...)
  if (fwSpecs_DCUSetMode("pclbcecs03", 1, 1, 64, FWSPECS_DCU_LIR) == 0)   // set DCU in LIR mode
     (...)
  else
     DebugTN("Error found!");
  (...)




Generated on Fri Mar 28 13:36:50 2008 for FwSpecs by  doxygen 1.4.7