SA0148: Unusual bit access – strict
Detects bit access which is not made to bit field data types (BYTE
, WORD
, DWORD
, and LWORD
). The IEC 61131-3 standard permits only bit access to bit field data types. However, the CODESYS compiler also permits bit access to unsigned data types.
Importance: Low
Example 109. Example
PROGRAM PLC_PRG VAR iTemp1 : INT; diTemp3 : DINT; uliTemp4 : ULINT; siTemp5 : SINT; usiTemp6 : USINT; byTemp2 : BYTE; END_VAR
iTemp1.3 := TRUE; // SA0148 diTemp3.4 := TRUE; // SA0148 uliTemp4.18 := FALSE; // SA0148 siTemp5.2 := FALSE; // SA0148 usiTemp6.3 := TRUE; // SA0148 byTemp2.5 := FALSE; // no error because BYTE is a bitfield
Output in the Messages view:
SA0148: Unusual bit access – strict