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

📄 cmx_mvolts.c

📁 cypress cy3721做的外部无线结点。感知温度后将温度值反给中心结点。
💻 C
字号:
//*****************************************************************************
//*****************************************************************************
//  FILENAME:  CMX_mVolts.c
//  Version: 1.0, Updated on 2008/6/23 at 14:8:50
//  
//
//  DESCRIPTION:  This Driver calls the low level driver and returns the
//                voltage that corresponds to a given channel.
//
//-----------------------------------------------------------------------------
//      Copyright (c) Cypress MicroSystems 2004. All Rights Reserved.
//*****************************************************************************
//*****************************************************************************

#include "m8c.h"
#include "CMX_mVolts.h"
#include "cmx.h"
#include "calibration.h"

// Channel type header file
#include "CMX_MVOLTS_IN_CHAN.h"

// The format of the function should always be the same,
// no matter what low level driver is use.
extern int     iGetChanMVolts(BYTE bChan);


//-----------------------------------------------------------------------------
//  FUNCTION NAME: mVolts_Instantiate(const CMX_mVolts_ParameterBlock * thisBLK)
//
//  DESCRIPTION:  
//    This function doesn't do anything at this time, but is placed here
//    for forward compatibility.
//
//-----------------------------------------------------------------------------
//
//  ARGUMENTS: 
//    thisBLK  => Pointer to ParameterBlock for this instance.
//
//  RETURNS: None
//
//  SIDE EFFECTS: 
//
//  THEORY of OPERATION or PROCEDURE: 
//
//-----------------------------------------------------------------------------
void CMX_mVolts_Instantiate(const CMX_mVolts_ParameterBlock * thisBLK)
{
   // Blank function
   
}

//-----------------------------------------------------------------------------
//  FUNCTION NAME: mVolts_GetValue(const CMX_mVolts_ParameterBlock * thisBLK)
//
//  DESCRIPTION:  
//    Blah Blah Blah       
//
//-----------------------------------------------------------------------------
//
//  ARGUMENTS: 
//    thisBLK  => Pointer to ParameterBlock for this instance.
//
//  RETURNS: None
//
//  SIDE EFFECTS: 
//
//  THEORY of OPERATION or PROCEDURE: 
//
//  The voltage output is scaled by using the ScaleNumerator and ScaleDenominator
//  in the parameter block.
//
//                                ScaleNumerator
//  OutputReading = inputVolts * ----------------
//                               ScaleDenominator
//
//
//-----------------------------------------------------------------------------
int  CMX_mVolts_GetValue(const CMX_mVolts_ParameterBlock * thisBLK)
{
   BYTE bChan;
   long  lmVolts;

   bChan = thisBLK->InPort;                  // Get channel from PB
   lmVolts = (long)iGetChanMVolts(bChan);

   // Scale the voltage to the proper range
   lmVolts = lmVolts * thisBLK->ScaleNumerator;
   lmVolts = lmVolts / thisBLK->ScaleDenominator;

   lmVolts += imVolts_Chan_Offset[bChan];   // Add user calibration offset
   return((int)lmVolts);                    // Convert to mVolts and return
}

⌨️ 快捷键说明

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