⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hp662xa.c

📁 CVI教程,用于信号采集系统的多任务开发软件.学习简单,功能实用.
💻 C
📖 第 1 页 / 共 5 页
字号:
        if (!simulating)            {            checkErr( Ivi_GetAttrRangeTable (vi, channel,                                             HP662XA_ATTR_MEASURE_FUNCTION,                                             &measureFunctionRangeTable));            viCheckErr (Ivi_GetViInt32EntryFromValue (measureFunction, measureFunctionRangeTable,                                                      VI_NULL, VI_NULL, VI_NULL, VI_NULL, &cmd, VI_NULL));            viCheckErr( viPrintf (io, "%s? %s", cmd, channel));            viCheckErr( viScanf (io, "%lf", &measurement));            }        else if (useSpecificSimulation)            {            checkErr( HP662XA_SimulateMeasurement (vi, channel, &measurement));            }        else            measurement = 0.0;                checkErr( Ivi_SetAttributeViReal64 (vi, channel,                                            HP662XA_ATTR_MEASUREMENT,                                            0, measurement));        }Error:    Ivi_UnlockSession (vi, VI_NULL);    return error;}/***************************************************************************** *  Function: HP662XA_FetchMeasurement *  Purpose:  This function fetches a previously initiated measurement from *            the power supply. *****************************************************************************/ViStatus _VI_FUNC HP662XA_FetchMeasurement (ViSession vi,                                            ViConstString channel,                                            ViInt32 maxTime,                                            ViReal64 *measurement){    ViStatus error = VI_SUCCESS;    checkErr( Ivi_LockSession (vi, VI_NULL));    checkErr( Ivi_GetAttributeViReal64 (vi, channel,                                        HP662XA_ATTR_MEASUREMENT,                                        0, measurement));Error:    Ivi_UnlockSession (vi, VI_NULL);    return error;}/***************************************************************************** *  Function: HP662XA_ReadMeasurement *  Purpose:  This function initiates and reads the currently configured *            measurement from the power supply. *****************************************************************************/ViStatus _VI_FUNC HP662XA_ReadMeasurement (ViSession vi,                                           ViConstString channel,                                           ViInt32 maxTime,                                           ViReal64 *measurement){    ViStatus error = VI_SUCCESS;    checkErr( Ivi_LockSession (vi, VI_NULL));        checkErr( HP662XA_InitiateMeasurement (vi));    checkErr( HP662XA_FetchMeasurement (vi, channel, maxTime, measurement));    checkErr( HP662XA_CheckStatus (vi));Error:    Ivi_UnlockSession (vi, VI_NULL);    return error;}/***************************************************************************** *  Function: HP662XA_MeasureOutput *  Purpose:  This function measures the output of a channel. *****************************************************************************/ViStatus _VI_FUNC HP662XA_MeasureOutput (ViSession vi,                                         ViConstString channel,                                         ViInt32 measureFunction,                                         ViInt32 maxTime,                                         ViReal64 *measurement){    ViStatus error = VI_SUCCESS;    checkErr( Ivi_LockSession (vi, VI_NULL));    if (measurement == VI_NULL)        viCheckParm( IVI_ERROR_INVALID_PARAMETER, 5, "Null address for Measurement");            viCheckParm( Ivi_SetAttributeViInt32 (vi, channel,                                          HP662XA_ATTR_MEASURE_FUNCTION,                                          0, measureFunction),                                          3, "Measure Function");    checkErr( HP662XA_ReadMeasurement (vi, channel, maxTime, measurement));Error:    Ivi_UnlockSession (vi, VI_NULL);    return error;}/***************************************************************************** *  Function: HP662XA_SaveState *  Purpose:  This function saves the state of all outputs in instrument *            memory. *****************************************************************************/ViStatus _VI_FUNC HP662XA_SaveState (ViSession vi, ViInt32 location){    ViStatus  error = VI_SUCCESS;    ViInt32   model;    ViInt32   firstLocation;    checkErr( Ivi_LockSession (vi, VI_NULL));    checkErr( HP662XA_GetModel (vi, &model));    firstLocation = ((model < HP6625A) || (model == HP6627A)) ? 1 : 0;    if ((location < firstLocation) || (location > 10))        viCheckParm( IVI_ERROR_INVALID_VALUE, 2, "Location");        if (!Ivi_Simulating(vi))              /* call only when locked */        {        ViSession io = Ivi_IOSession(vi); /* call only when locked */        checkErr( Ivi_SetNeedToCheckStatus (vi, VI_TRUE));        viCheckErr( viPrintf (io, "STO %ld", location));        checkErr( HP662XA_CheckStatus (vi));        }        Error:    Ivi_UnlockSession (vi, VI_NULL);    return error;}/***************************************************************************** *  Function: HP662XA_RecallState *  Purpose:  This function recalls the state of all outputs from instrument *            memory. *****************************************************************************/ViStatus _VI_FUNC HP662XA_RecallState (ViSession vi, ViInt32 location){    ViStatus  error = VI_SUCCESS;    ViInt32   model;    ViInt32   firstLocation;    checkErr( Ivi_LockSession (vi, VI_NULL));    checkErr( HP662XA_GetModel (vi, &model));    firstLocation = ((model < HP6625A) || (model == HP6627A)) ? 1 : 0;    if ((location < firstLocation) || (location > 10))        viCheckParm( IVI_ERROR_INVALID_VALUE, 2, "Location");        checkErr( Ivi_InvalidateAllAttributes (vi));            if (!Ivi_Simulating(vi))              /* call only when locked */        {        ViSession io = Ivi_IOSession(vi); /* call only when locked */        checkErr( Ivi_SetNeedToCheckStatus (vi, VI_TRUE));        viCheckErr( viPrintf (io, "RCL %ld", location));        checkErr( HP662XA_CheckStatus (vi));        }        Error:    Ivi_UnlockSession (vi, VI_NULL);    return error;}/***************************************************************************** * Function: HP662XA_GetAttribute<type> Functions                                     * Purpose:  These functions enable the instrument driver user to get  *           attribute values directly.  There are typesafe versions for  *           ViInt32, ViReal64, ViString, ViBoolean, and ViSession attributes.                                          *****************************************************************************/ViStatus _VI_FUNC HP662XA_GetAttributeViInt32 (ViSession vi, ViConstString channelName,                                                ViAttr attributeId, ViInt32 *value){                                                                                                               return Ivi_GetAttributeViInt32 (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL,                                     value);}                                                                                                           ViStatus _VI_FUNC HP662XA_GetAttributeViReal64 (ViSession vi, ViConstString channelName,                                                 ViAttr attributeId, ViReal64 *value){                                                                                                               return Ivi_GetAttributeViReal64 (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL,                                      value);}                                                                                                           ViStatus _VI_FUNC HP662XA_GetAttributeViString (ViSession vi, ViConstString channelName,                                                 ViAttr attributeId, ViInt32 bufSize,                                                 ViChar value[]) {       return Ivi_GetAttributeViString (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL,                                      bufSize, value);}   ViStatus _VI_FUNC HP662XA_GetAttributeViBoolean (ViSession vi, ViConstString channelName,                                                  ViAttr attributeId, ViBoolean *value){                                                                                                               return Ivi_GetAttributeViBoolean (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL,                                       value);}                                                                                                           ViStatus _VI_FUNC HP662XA_GetAttributeViSession (ViSession vi, ViConstString channelName,                                                  ViAttr attributeId, ViSession *value){                                                                                                               return Ivi_GetAttributeViSession (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL,                                       value);}                                                                                                           /***************************************************************************** * Function: HP662XA_SetAttribute<type> Functions                                     * Purpose:  These functions enable the instrument driver user to set  *           attribute values directly.  There are typesafe versions for  *           ViInt32, ViReal64, ViString, ViBoolean, and ViSession datatypes.                                          *****************************************************************************/ViStatus _VI_FUNC HP662XA_SetAttributeViInt32 (ViSession vi, ViConstString channelName,                                                ViAttr attributeId, ViInt32 value){                                                                                                               return Ivi_SetAttributeViInt32 (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL,                                     value);}                                                                                                           ViStatus _VI_FUNC HP662XA_SetAttributeViReal64 (ViSession vi, ViConstString channelName,                                                 ViAttr attributeId, ViReal64 value){                                                                                                               return Ivi_SetAttributeViReal64 (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL,                                      value);}                                                                                                           ViStatus _VI_FUNC HP662XA_SetAttributeViString (ViSession vi, ViConstString channelName,                                                 ViAttr attributeId, ViConstString value) {       return Ivi_SetAttributeViString (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL,                                      value);}   ViStatus _VI_FUNC HP662XA_SetAttributeViBoolean (ViSession vi, ViConstString channelName,                                                  ViAttr attributeId, ViBoolean value){                                                                                                               return Ivi_SetAttributeViBoolean (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL,                                       value);}                                                                                                           ViStatus _VI_FUNC HP662XA_SetAttributeViSession (ViSession vi, ViConstString channelName,                                                  ViAttr attributeId, ViSession value){                                                                                                               return Ivi_SetAttributeViSession (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL,                                       value);}                                                                                                           /***************************************************************************** * Function: HP662XA_CheckAttribute<type> Functions                                   * Purpose:  These functions enable the instrument driver user to check   *           attribute values directly.  These functions check the value you *           specify even if you set the HP662XA_ATTR_RANGE_CHECK  *           attribute to VI_FALSE.  There are typesafe versions for ViInt32,  *           ViReal64, ViString, ViBoolean, and ViSession datatypes.                          *****************************************************************************/ViStatus _VI_FUNC HP662XA_CheckAttributeViInt32 (ViSession vi, ViConstString channelName,                                                  ViAttr attributeId, ViInt32 value){                                                                                                               return Ivi_CheckAttributeViInt32 (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL,                                       value);}ViStatus _VI_FUNC HP662XA_CheckAttributeViReal64 (ViSession vi, ViConstString channelName,                                                   ViAttr attributeId, ViReal64 value){                                                                                                               return Ivi_CheckAttributeViReal64 (vi, channelName, attributeId, IVI_VAL_DIRECT_USER_CALL,                                        value);}                                                                                                           ViStatus _VI_FUNC HP662XA_CheckAttributeViString (ViSession vi, ViConstString channelName,                                                   ViAttr attributeId, ViConstString value)  {       return Ivi_CheckAttribu

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -