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