ConOpSys V2970  P004.07
ANVILEX control operating system
CRC_16_DNP.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file CRC_16_DNP.h
3 //! @brief Cyclic reduncancy check (CRC-16-DNP) class header file.
4 //! @par Algorithm name
5 //! CRC-16-DNP
6 //! @par Polynom
7 //! 0xA6BC or 0x3D65 ???
8 //! x16 + x13 + x12 + x11 + x10 + x8 + x6 + x5 + x2 + 1
9 //! @par Initial value
10 //! 0x0000
11 //! @par Application
12 //! DNP
13 //! IEC 870
14 //! ModBus
15 //! @attention No special attention requered.
16 //! @copyright (C) 2015-2020 ANVILEX LLC
17 //! $HeadURL: https://192.168.3.4:8443/svn/P004_07/ConOpSys/Common/CRC_16_DNP.h $
18 //! $Revision: 2796 $
19 //! $Date: 2021-07-12 02:57:34 +0500 (Mo, 12 Jul 2021) $
20 //! $Author: minch $
21 //------------------------------------------------------------------------------
22 //
23 // Redistribution and use in source and binary forms, with or without
24 // modification, are permitted provided that the following conditions are met:
25 //
26 // 1. Redistributions of source code must retain the above copyright notice,
27 // this list of conditions and the following disclaimer.
28 //
29 // 2. Redistributions in binary form must reproduce the above copyright notice,
30 // this list of conditions and the following disclaimer in the documentation
31 // and/or other materials provided with the distribution.
32 //
33 // 3. Neither the name of ANVILEX nor the names of its contributors may be
34 // used to endorse or promote products derived from this software without
35 // specific prior written permission.
36 //
37 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
38 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
39 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
40 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
41 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
43 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
44 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
45 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
47 // POSSIBILITY OF SUCH DAMAGE.
48 //
49 //------------------------------------------------------------------------------
50 
51 //------------------------------------------------------------------------------
52 // Protecting header files from mutual, recursive inclusion.
53 //------------------------------------------------------------------------------
54 
55 #pragma once
56 
57 //------------------------------------------------------------------------------
58 // Include standard libraries header files
59 //------------------------------------------------------------------------------
60 
61 //------------------------------------------------------------------------------
62 // Include thrid party header files
63 //------------------------------------------------------------------------------
64 
65 //------------------------------------------------------------------------------
66 // Include ConOpSys header files
67 //------------------------------------------------------------------------------
68 
69 #include "CRC_16_Base.h"
70 
71 //------------------------------------------------------------------------------
72 // Include ConOpSys application header files
73 //------------------------------------------------------------------------------
74 
75 //------------------------------------------------------------------------------
76 // Global defines
77 //------------------------------------------------------------------------------
78 
79 //------------------------------------------------------------------------------
80 // Global macros
81 //------------------------------------------------------------------------------
82 
83 //------------------------------------------------------------------------------
84 // Class definitions
85 //------------------------------------------------------------------------------
86 
87 //! @brief Cyclic redundancy check (CRC-16-DNP) class
88 class TCRC_16_DNP : public TCRC_16_Base
89 {
90 
91  //----------------------------------------------------------------------------
92  // Public defines, methods and variables
93  //----------------------------------------------------------------------------
94 
95  public:
96 
97  //!-------------------------------------------------------------------------
98  //! @brief Get initial value of CRC
99  //! @note None
100  //! @return U16 - CRC initial value
101  //! @attention None
102  //! @dotfile TCRC_16_DNP__Init.dt
103  //--------------------------------------------------------------------------
104 
105  virtual U16 Init();
106 
107  //!-------------------------------------------------------------------------
108  //! @brief Update CRC with new data value
109  //! @note None
110  //! @param [in, out] &u16_CRC - Actual CRC value
111  //! @param [in] u8_Data - Data value
112  //! @return None
113  //! @attention None
114  //! @dotfile TCRC_16_DNP__Update.dt
115  //--------------------------------------------------------------------------
116 
117  virtual VOID Update( U16 &u16_CRC, U8 u8_Data );
118 
119  //----------------------------------------------------------------------------
120  // Protected defines, methods and variables
121  //----------------------------------------------------------------------------
122 
123  protected:
124 
125  //----------------------------------------------------------------------------
126  // Private defines, methods and variables
127  //----------------------------------------------------------------------------
128 
129  private:
130 
131 };
132 
133 //------------------------------------------------------------------------------
134 // End of file
135 //------------------------------------------------------------------------------
Cyclic reduncancy check (CRC-16) base class header file.
unsigned char U8
Binary 8-Bit unsigned integer datatype defenition.
Definition: Defines.h:183
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
unsigned short U16
Binary 16-Bit unsigned integer datatype defenition.
Definition: Defines.h:193
Cyclic redundancy check (CRC-16) base class.
Definition: CRC_16_Base.h:78
Cyclic redundancy check (CRC-16-DNP) class.
Definition: CRC_16_DNP.h:89
virtual VOID Update(U16 &u16_CRC, U8 u8_Data)
Update CRC with new data value.
Definition: CRC_16_DNP.cpp:113
virtual U16 Init()
Get initial value of CRC.
Definition: CRC_16_DNP.cpp:101