53 |
53 |
54 %(fieldbus_interface_declaration)s |
54 %(fieldbus_interface_declaration)s |
55 |
55 |
56 int __init_%(location)s() |
56 int __init_%(location)s() |
57 { |
57 { |
|
58 __FirstTick = 1; |
58 %(init_entry_variables)s |
59 %(init_entry_variables)s |
59 *__IW%(location)s_0 = __MK_Alloc_AXIS_REF(); |
|
60 __CIA402Node_%(location)s.axis = __MK_GetPublic_AXIS_REF(*__IW%(location)s_0); |
|
61 __CIA402Node_%(location)s.axis->NetworkPosition = %(slave_pos)d; |
|
62 *(__CIA402Node_%(location)s.ModesOfOperation) = 0x08; |
60 *(__CIA402Node_%(location)s.ModesOfOperation) = 0x08; |
63 return 0; |
61 return 0; |
64 } |
62 } |
65 |
63 |
66 void __cleanup_%(location)s() |
64 void __cleanup_%(location)s() |
67 { |
65 { |
68 } |
66 } |
69 |
67 |
70 void __retrieve_%(location)s() |
68 void __retrieve_%(location)s() |
71 { |
69 { |
72 %(fieldbus_interface_definition)s |
|
73 |
|
74 IEC_UINT statusword_inactive = *(__CIA402Node_%(location)s.StatusWord) & __InactiveMask; |
70 IEC_UINT statusword_inactive = *(__CIA402Node_%(location)s.StatusWord) & __InactiveMask; |
75 IEC_UINT statusword_active = *(__CIA402Node_%(location)s.StatusWord) & __ActiveMask; |
71 IEC_UINT statusword_active = *(__CIA402Node_%(location)s.StatusWord) & __ActiveMask; |
76 |
72 |
77 if (__FirstTick) { |
73 if (__FirstTick) { |
|
74 *__IW%(location)s_0 = __MK_Alloc_AXIS_REF(); |
|
75 __CIA402Node_%(location)s.axis = __MK_GetPublic_AXIS_REF(*__IW%(location)s_0); |
|
76 __CIA402Node_%(location)s.axis->NetworkPosition = %(slave_pos)d; |
78 %(init_axis_params)s |
77 %(init_axis_params)s |
|
78 %(fieldbus_interface_definition)s |
79 __FirstTick = 0; |
79 __FirstTick = 0; |
80 } |
80 } |
81 |
81 |
82 // CIA402 node state computation |
82 // CIA402 node state computation |
83 __CIA402Node_%(location)s.state = __Unknown; |
83 __CIA402Node_%(location)s.state = __Unknown; |