Skip to main content

属性:monitoring_encoding

属性 pragma 允许用于数据类型的变量 STRING 对于别名数据类型 type 的变量 STRING。该属性的作用是用它标记变量的值,以便在监视期间以 UTF-8 格式解码。

句法

{attribute 'monitoring_encoding' := 'UTF8'}

插入位置:变量声明上方

280. 例子
PROGRAM PLC_PRG
VAR
    {attribute 'monitoring.encoding' := 'UTF8'}
    strDat : STRING := 'abc'; 
    attribute 'monitoring_encoding' := 'UTF-8'}	
    strVarUtf8: STRING := UTF8#'你好,世界!ÜüÄäÖö';
    {attribute 'monitoring_encoding' := 'UTF-8'}
    str1: STRING := UTF8#'AÄyyy';		
    {attribute 'monitoring_encoding' := 'UTF-8'}		
    str2: STRING := UTF8#'AÄxxxÜÜÜ';	
		
    strVarUtf8_1: STRING := '你好,世界!ÜüÄäÖö';
    str1_1: STRING := 'AÄyyy';				
    str2_1: STRING := 'AÄxxxÜÜÜ';			
END_VAR
_cds_monitoring_utf8.png