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

📄 teds.h

📁 a/d公司8位微控制器aduc812(10路10位adc)应用笔记
💻 H
字号:

// Necessary overall definitions:
// -----------------------------
//
// CHANNEL_ZERO represents 'global' (i.e. all channel) addressing.
//
#define CHANNEL_ZERO       0
//
// Define the 'number of channels' for this STIM (excluding CH ZERO)
//
#define NUM_CHANNELS       2
#define INVALID_CHANNEL    NUM_CHANNELS+1

// Define the "Channel Data Model Length"s (i.e. number of bytes of 
//  transducer data per channel)
//
#define  CH1_DATA_MODEL_LENGTH   2
#define  CH2_DATA_MODEL_LENGTH   1

// General TEDS related definitions:
// --------------------------------
//
// Enumeration values for the 'Calibration Key' field within the channel TEDS
// Their values are defined in 5.2.3.2, Table 31.
//
#define CAL_NONE              0
#define CAL_FIXED             1
#define CAL_MODIFIABLE        2
#define CAL_SELF              3
#define CAL_CUSTOM            4
#define STIM_CAL_FIXED        5
#define STIM_CAL_MODIFIABLE   6
#define STIM_CAL_SELF         7

// Transducer Types (Note: only 'Sensor' and 'Actuator' will be implemented)
// These types are used in the 'Channel Type Key' field of the channel TEDS
// Their values are defined in 5.2.3.8, Table 36.
//
#define SENSOR                         0
#define ACTUATOR                       1
#define EVENT_SEQUENCE_SENSOR          2
#define DATA_SEQUENCE_SENSOR           3
#define GENERAL_TRANSDUCER             4
#define BUFFERED_SENSOR                5
#define BUFFERED_DATA_SEQUENCE_SENSOR  6
#define GLOBAL                         7

// Definitions required to destinguish between the types of TEDS that may
// be read or written. NOTE: these definitions are different to the 'address'
// TEDS definition types (see function.h).
//
#define TEDS_META          10
#define TEDS_META_ID       20
#define TEDS_CHANNEL       30
#define TEDS_CHANNEL_ID    40
#define TEDS_CALIBRATION   50
#define TEDS_CALIB_ID      60
#define TEDS_END_USER      70

// TEDS Data Structures:
// --------------------
//
// Meta-TEDS structure Data Type:
//
typedef struct {
      U32L  Length;                    // field 1
      U8E   WorkGroupNum;              // field 2
      U8E   VersionNum;                // field 3
      UUID  UniqueId;                  // field 4
      U8E   CalibKey;                  // field 5
      U8E   DataKey;                   // field 6
      U8E   TedsKey;                   // field 7
      U8E   UserAppKey;                // field 8
      U8C   NoOfChans;                 // field 9
      U8C   DataModelLength;           // field 10
      U16C  DataRepetitions;           // field 11
      U32C  WriteableTedsLength;       // field 12
      F32   ChanUpdateTime;            // field 13
      F32   WriteSetupTime;            // field 14
      F32   ReadSetupTime;             // field 15
      F32   SamplingPeriod;            // field 16
      F32   WarmupTime;                // field 17
      F32   ResponseTime;              // field 18
      F32   HandshakeTime;             // field 19
      F32   EOFLatency;                // field 20
      F32   TedsHoldOffTime;           // field 21
      F32   OpHoldOffTime;             // field 22
      U32C  MaxDataRate;               // field 23
      U16L  GroupingSubBlockLength;    // field 24

         // In this implementation there are no "Channel Groupings 
         //  Sub-Blocks" => no iterations for fields 25-28 exist

      U16C  Checksum;                  // field 29 
   } stMetaTeds;

//
// Channel TEDS structure Data Type:
//
typedef struct {
      U32L  Length;                    // field 1
      U8E   CalibKey;                  // field 2
      U8E   CalibTedsKey;              // field 3
      U8E   NVDFieldsKey;              // field 4
      U8E   TedsExtKey;                // field 5
      U8E   UserAppKey;                // field 6
      U32C  WriteableTedsLength;       // field 7
      U8E   ChannelType;               // field 8
      UNITS PhysicalUnits;             // field 9
      F32   LowRangeLimit;             // field 10
      F32   HiRangeLimit;              // field 11
      F32   Uncertainty;               // field 12
      U8E   SelfTestKey;               // field 13
      U8E   DataModel;                 // field 14
      U8C   DataModelLength;           // field 15
      U16C  ModelSignificantBits;      // field 16
      U16C  DataRepetitions;           // field 17
      F32   SeriesOrg;                 // field 18
      F32   SeriesInc;                 // field 19
      UNITS SeriesUnits;               // field 20
      F32   UpdateTime;                // field 21
      F32   WriteSetupTime;            // field 22
      F32   ReadSetupTime;             // field 23
      F32   SamplingPeriod;            // field 24
      F32   WarmupPeriod;              // field 25
      F32   AggHoldOffTime;            // field 26
      F32   TimingCorrection;          // field 27
      F32   TriggerAccuracy;           // field 28
      U8E   EventSequenceOpts;         // field 29
      U16C  Checksum;                  // field 30
   } stChannelTeds;


// TEDS Function prototypes:
// ------------------------

boolean TEDS_SetupMetaTEDS(void);
boolean TEDS_SetupCh1TEDS(void);
boolean TEDS_SetupCh2TEDS(void);

boolean TEDS_WriteTEDSToFlash( unsigned char  ucStartAddress, 
                               unsigned char* pTEDSArray, 
                               U32L BytesToWrite);
boolean TEDS_ReadTEDSfromFlash(unsigned char  ucStartAddress, 
                               unsigned char* pTEDSArray );
boolean TEDS_InitTEDSFlash(void);

boolean TEDS_GetTEDSHandle( unsigned char ucTEDS, unsigned char ucChan,
                            unsigned char *pTEDSBuffer );

⌨️ 快捷键说明

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