INOS
cinosadcchannels.h
Go to the documentation of this file.
1//******************************************************************************
27//******************************************************************************
28
29#ifndef INC_CINOSADCCHANNELS_H
30#define INC_CINOSADCCHANNELS_H
31
32//------------------------------------------------------------------------------
33// defines
34//------------------------------------------------------------------------------
35//
36#define DF_INOS_IMAGE_ANALOG_INPUTS_NUMBER DF_INOS_PROCESSIMAGE_ANALOG_INPUTS_NUMBER // def. number of ana inputs
37//
38#define DF_INOS_ADC_RANGE_BIP_10000mV 0 // adc range number +-10000 mV
39#define DF_INOS_ADC_RANGE_BIP_1000mV 1 // adc range number +-1000 mV
40#define DF_INOS_ADC_RANGE_BIP_100mV 2 // adc range number +-100 mV
41#define DF_INOS_ADC_RANGE_BIP_10mV 3 // adc range number +-10 mV
42#define DF_INOS_ADC_RANGE_UNI_10000mV 4 // adc range number 0..+10000 mV
43#define DF_INOS_ADC_RANGE_UNI_1000mV 5 // adc range number 0..+1000 mV
44#define DF_INOS_ADC_RANGE_UNI_100mV 6 // adc range number 0..+100 mV
45#define DF_INOS_ADC_RANGE_UNI_10mV 7 // adc range number 0..+10 mV
46//
47#define DF_INOS_ADC_RANGE_BIP_5000mV 8 // adc range number +-5000 mV
48#define DF_INOS_ADC_RANGE_BIP_500mV 9 // adc range number +-500 mV
49#define DF_INOS_ADC_RANGE_BIP_50mV 10 // adc range number +-50 mV
50#define DF_INOS_ADC_RANGE_BIP_5mV 11 // adc range number +-5 mV
51#define DF_INOS_ADC_RANGE_UNI_5000mV 12 // adc range number 0..+5000 mV
52#define DF_INOS_ADC_RANGE_UNI_500mV 13 // adc range number 0..+500 mV
53#define DF_INOS_ADC_RANGE_UNI_50mV 14 // adc range number 0..+50 mV
54#define DF_INOS_ADC_RANGE_UNI_5mV 15 // adc range number 0..+5 mV
55//
56#define DF_INOS_ADC_RANGE_UNI_20mA 32 // adc range number 0..+20mA
57#define DF_INOS_ADC_RANGE_BIP_5000mA 40 // adc range number +-5000 mA
58
59#define DF_INOS_ADC_RANGE_BIP_48000mV 128 // adc range number +-48000 mV
60
61#define DF_INOS_ADC_RANGE_DISABLED 255 // adc disabled
62//
63//------------------------------------------------------------------------------
64// includes
65//------------------------------------------------------------------------------
66//
67// system
68//
69// C++
70//
71// project
72//
73//------------------------------------------------------------------------------
74// class definition
75//------------------------------------------------------------------------------
76//
78{
79 //--- user interface ---------------------------------------------------
80
81 // public member functions
82 public :
83 ICACHE virtual void Set(uint16 auNumber, real64 arValue) override;
84 //; set channel 'auNumber' to arValue
85 ICACHE virtual real64 Get(uint16 auNumber) override;
86 //; get value of channel 'auNumber'
87 ICACHE real32 GetValue(uint16 auNumber);
88 //; return value of channel auNumber (mV, °C, ...) [real32]
89 #if defined(INOS_PROCESSIMAGE_OVERWRITE)
90 ICACHE void SetValue(uint16 auNumber, real32 afValue, bool abOverwrite = true);
91 //; set value of channel auNumber to afValue
92 //; (abOverwrite=true -> value always set, abOverwrite=false -> value
93 //; set if channel is NOT in overwrite mode)
94 #else
95 ICACHE void SetValue(uint16 auNumber, real32 afValue);
96 //; set value of channel auNumber to afValue
97 #endif
98 real32 GetRawValue(uint16 auNumber, uint32 auStage=0);
99 //; return raw value of channel auNumber before hook number 'auStage'
100 CINOSAdcChannel* Find(const char* apName,
101 uint32 auSimulate = DF_INOS_IMAGE_CHN_SIM_DEF);
102 //; return pointer to channel with apName or NULL if not found
103 CINOSAdcChannel* Find(uint16 auNumber,
104 uint32 auSimulate = DF_INOS_IMAGE_CHN_SIM_DEF);
105 //; return pointer to channel with auNumber or NULL if not found
106 void SetRange(uint16 auNumber, uint8 auRange);
107 //; set channel range
108 uint8 GetRange(uint16 auNumber);
109 //; get channel range
110
111 CINOSAdcChannel* CreateVirtual(const char* apName,
112 uint16 auType = defType_double,
113 real64 arLower = REAL64MIN,
114 real64 arUpper = REAL64MAX,
115 char* apUnit = nullptr,
116 uint16 auCharacteristics = defCharShowFix + SHOW_DIGIT(4)
117 );
118 //; creates a new ADC channel that does not directly translate to hardware
119 //; useful to add custom channels to the process image
120
121 //--- internals --------------------------------------------------------
122
123 // constructor / destructor
124 public :
125 CINOSAdcChannels (char* apName, uint32 auNumber, void* apImage);
126 //; object constructor
127
128 // public member functions but just for internal use
129 public:
130 static void Create();
131 //; check if process image already exists, if no create one
132};
133
134//
135//------------------------------------------------------------------------------
136// global variables
137//------------------------------------------------------------------------------
138//
139#define g_pAdcChannels ((CINOSAdcChannels *) g_pImage[DF_PROCESS_IMAGE_ANALOG_INPUTS])
140//
141//------------------------------------------------------------------------------
142// end of file
143//------------------------------------------------------------------------------
144
145#endif // INC_CINOSADCCHANNELS_H
Definition cinosadcchannel.h:53
Definition cinosadcchannels.h:78
Definition cinosprocessimagevalues.h:78