ConOpSys V2970  P004.07
ANVILEX control operating system
Function_Block_Digital_Output.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file Function_Block_Digital_Output.h
3 //! @author ANVILEX LLC
4 //! @version V1.0
5 //! @date 26.09.2017
6 //! @brief Digital output class header file.
7 //! @attention
8 //!
9 //! COPYRIGHT(C) 2017-2021 ANVILEX GmbH
10 //!
11 //! Redistribution and use in source and binary forms, with or without
12 //! modification, are permitted provided that the following conditions are met:
13 //!
14 //! 1. Redistributions of source code must retain the above copyright notice,
15 //! this list of conditions and the following disclaimer.
16 //!
17 //! 2. Redistributions in binary form must reproduce the above copyright notice,
18 //! this list of conditions and the following disclaimer in the documentation
19 //! and/or other materials provided with the distribution.
20 //!
21 //! 3. Neither the name of ANVILEX nor the names of its contributors may be
22 //! used to endorse or promote products derived from this software without
23 //! specific prior written permission.
24 //!
25 //! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 //! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 //! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 //! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
29 //! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 //! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 //! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 //! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 //! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 //! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 //! POSSIBILITY OF SUCH DAMAGE.
36 //------------------------------------------------------------------------------
37 //
38 // TFunction_Block_Digital_Output_1_T2
39 //
40 //------------------------------------------------------------------------------
41 
42 //------------------------------------------------------------------------------
43 // Protecting header files from mutual, recursive inclusion.
44 //------------------------------------------------------------------------------
45 
46 #pragma once
47 
48 //------------------------------------------------------------------------------
49 // Include standard libraries header files
50 //------------------------------------------------------------------------------
51 
52 //------------------------------------------------------------------------------
53 // Include thrid party header files
54 //------------------------------------------------------------------------------
55 
56 //------------------------------------------------------------------------------
57 // Include ConOpSys header files
58 //------------------------------------------------------------------------------
59 
60 #include "Function_Block_Base.h"
61 
62 //------------------------------------------------------------------------------
63 // Include ConOpSys application header files
64 //------------------------------------------------------------------------------
65 
66 //------------------------------------------------------------------------------
67 // Macros
68 //------------------------------------------------------------------------------
69 
70 //------------------------------------------------------------------------------
71 // Class declarations
72 //------------------------------------------------------------------------------
73 
74 //! @brief Digital output, type 2 class description
76 {
77 
78  //----------------------------------------------------------------------------
79  // Public defines, methods and variables
80  //----------------------------------------------------------------------------
81 
82  public:
83 
84  //!-------------------------------------------------------------------------
85  //! @brief Class constructor method.
86  //! @note None
87  //! \par Override
88  //! Not allowed
89  //! @attention Don't call this method directly.
90  //--------------------------------------------------------------------------
91 
93 
94  //!-------------------------------------------------------------------------
95  //! @brief Class destructor method.
96  //! @note None
97  //! \par Override
98  //! Not allowed
99  //! @attention Don't call this method directly.
100  //--------------------------------------------------------------------------
101 
103 
104  //!-------------------------------------------------------------------------
105  //! @brief Function block initialisation method
106  //! @note None
107  //! @return None
108  //! \par Override
109  //! Not allowed
110  //! @attention None
111  //--------------------------------------------------------------------------
112 
113  virtual VOID Init();
114 
115  //!-------------------------------------------------------------------------
116  //! @brief Function block execution method
117  //! @note None
118  //! @return None
119  //! \par Override
120  //! Not allowed
121  //! @attention None
122  //--------------------------------------------------------------------------
123 
124  virtual VOID Execute();
125 
126  //--------------------------------------------------------------------------
127  // Function block parameters
128  //--------------------------------------------------------------------------
129 
130  //--------------------------------------------------------------------------
131  // Function block inputs
132  //--------------------------------------------------------------------------
133 
134  //! @brief Digital input channel connector
136 
137  //! @brief Digital output inversion
139 
140  //! @brief Digital output inversion
142 
143  //! @brief Output signal on delay time
145 
146  //! @brief Output signal off delay time
148 
149  //! @brief Output signal pulse count
151 
152  //! @brief Output PWM signal period count
154 
155  //! @brief Output PWM signal on time
157 
158  //--------------------------------------------------------------------------
159  // Function block outputs
160  //--------------------------------------------------------------------------
161 
162  //----------------------------------------------------------------------------
163  // Protected methods and variables
164  //----------------------------------------------------------------------------
165 
166  protected:
167 
168  //----------------------------------------------------------------------------
169  // Private methods and variables
170  //----------------------------------------------------------------------------
171 
172  private:
173 
174  //--------------------------------------------------------------------------
175  // Private defines
176  //--------------------------------------------------------------------------
177 
178  //! @brief Delay FSM state definition
179  enum class TDelay_FSM_State
180  {
181 
182  //! @brief Off state
183  enum_Off = 0,
184 
185  //! @brief On state
186  enum_On = 1,
187 
188  //! @brief Off delay state
189  enum_Off_Delay = 2,
190 
191  //! @brief On delay state
192  enum_On_Delay = 3
193 
194  };
195 
196  //! @brief Internal FSM state definition
197  enum class TPWM_FSM_State
198  {
199 
200  //! @brief Initialisation state
201  enum_Init,
202 
203  //! @brief Idle state
204  enum_Idle,
205 
206  //! @brief On state
207  enum_On,
208 
209  //! @brief PWM on state
210  enum_PWM_On,
211 
212  //! @brief PWM off state
213  enum_PWM_Off,
214 
215  //! @brief Stop state
216  enum_Stop
217 
218  };
219 
220  //--------------------------------------------------------------------------
221  // Private variables
222  //--------------------------------------------------------------------------
223 
224  //! @brief Delay FSM state variable
226 
227  //! @brief PWM FSM state variable
229 
230  //! @brief Delayed input signal
232 
233  //! @brief PWM output signal
235 
236  //! @brief Delay counter
238 
239  //! @brief PWM counter
240  U32 u32_PWM_Counter = (U32)0x00000000;
241 
242  //! @brief PWM pulse counter
243  U32 u32_Pulse_Counter = (U32)0x00000000;
244 
245 };
246 
247 //------------------------------------------------------------------------------
248 // End of file
249 //------------------------------------------------------------------------------
int BOOL
Boolean datatype definition.
Definition: Defines.h:124
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
unsigned long U32
Binary 32-Bit unsigned integer datatype defenition.
Definition: Defines.h:203
unsigned short U16
Binary 16-Bit unsigned integer datatype defenition.
Definition: Defines.h:193
Function block base class header file.
Function block input connector class.
Definition: Block_Input_Connector.h:83
Function block base class for device.
Definition: Function_Block_Base.h:96
Digital output, type 2 class description.
Definition: Function_Block_Digital_Output.h:76
U32 u32_PWM_Counter
PWM counter.
Definition: Function_Block_Digital_Output.h:240
TDelay_FSM_State
Delay FSM state definition.
Definition: Function_Block_Digital_Output.h:180
TBlock_Input_Connector object_u16_On_Delay_Time
Output signal on delay time.
Definition: Function_Block_Digital_Output.h:144
TBlock_Input_Connector object_u32_Period
Output PWM signal period count.
Definition: Function_Block_Digital_Output.h:153
virtual VOID Execute()
Function block execution method.
Definition: Function_Block_Digital_Output.cpp:115
TBlock_Input_Connector object_bool_Inversion
Digital output inversion.
Definition: Function_Block_Digital_Output.h:141
U32 u32_Pulse_Counter
PWM pulse counter.
Definition: Function_Block_Digital_Output.h:243
TBlock_Input_Connector object_u32_Pulse_Count
Output signal pulse count.
Definition: Function_Block_Digital_Output.h:150
TBlock_Input_Connector object_u32_On_Time
Output PWM signal on time.
Definition: Function_Block_Digital_Output.h:156
TPWM_FSM_State enum_PWM_FSM_State
PWM FSM state variable.
Definition: Function_Block_Digital_Output.h:228
U16 u16_Delay_Counter
Delay counter.
Definition: Function_Block_Digital_Output.h:237
BOOL bool_Delayed_Input_Signal
Delayed input signal.
Definition: Function_Block_Digital_Output.h:231
TDelay_FSM_State enum_Delay_State
Delay FSM state variable.
Definition: Function_Block_Digital_Output.h:225
virtual ~TFunction_Block_Digital_Output_T2()
Class destructor method.
Definition: Function_Block_Digital_Output.cpp:99
TBlock_Input_Connector object_u8_Channel
Digital input channel connector.
Definition: Function_Block_Digital_Output.h:135
TFunction_Block_Digital_Output_T2()
Class constructor method.
Definition: Function_Block_Digital_Output.cpp:69
virtual VOID Init()
Function block initialisation method.
Definition: Function_Block_Digital_Output.cpp:107
TBlock_Input_Connector object_bool_Data
Digital output inversion.
Definition: Function_Block_Digital_Output.h:138
TPWM_FSM_State
Internal FSM state definition.
Definition: Function_Block_Digital_Output.h:198
BOOL bool_PWM_Output_Signal
PWM output signal.
Definition: Function_Block_Digital_Output.h:234
TBlock_Input_Connector object_u16_Off_Delay_Time
Output signal off delay time
Definition: Function_Block_Digital_Output.h:147