威纶通官方论坛

请教如何把汉字赋值到LW

[复制链接]
发表于 2021-8-4 10:02:21 | 显示全部楼层 |阅读模式
//开屏初始化

macro_command main()

char opera1[8]={'操作员1'}
char opera2[8]={'操作员2'}
char opera3[8]={'操作员3'}
char opera4[8]={'工程师'}
char opera5[8]={'管理员'}

SetData(opera1[0], "Local HMI", LW, 910, 8)
SetData(opera2[0], "Local HMI", LW, 920, 8)
SetData(opera3[0], "Local HMI", LW, 930, 8)
SetData(opera4[0], "Local HMI", LW, 940, 8)
SetData(opera5[0], "Local HMI", LW, 950, 8)


end macro_command
//然后在屏上显示字符型LW910,920,930,940,950,还是空白

发表于 2022-10-8 21:28:10 | 显示全部楼层
字符串声明错了吧

 楼主| 发表于 2021-8-4 17:05:29 | 显示全部楼层
//只能这样了
macro_command main()
char opera1[8]={0xcd,0x64,0x5c,0x4f,0x05,0x80,0x41,0x00}
char opera2[8]={0xcd,0x64,0x5c,0x4f,0x05,0x80,0x42,0x00}
char opera3[8]={0xcd,0x64,0x5c,0x4f,0x05,0x80,0x43,0x00}
char opera4[8]={0xe5,0x5d,0x0b,0x7a,0x08,0x5e,0x00,0x00}
char opera5[8]={0xa1,0x7b,0x06,0x74,0x58,0x54,0x00,0x00}

SetData(opera1[0], "Local HMI", LW, 910, 8)
SetData(opera2[0], "Local HMI", LW, 920, 8)
SetData(opera3[0], "Local HMI", LW, 930, 8)
SetData(opera4[0], "Local HMI", LW, 940, 8)
SetData(opera5[0], "Local HMI", LW, 950, 8)

end macro_command
发表于 2021-8-10 13:46:25 | 显示全部楼层
你的赋值没超出范围吗?
发表于 2022-1-26 10:21:11 | 显示全部楼层
//开屏初始化

macro_command main()

char opera1[8]='操作员1'
char opera2[8]='操作员2'
char opera3[8]='操作员3'
char opera4[8]='工程师'
char opera5[8]='管理员'

SetData(opera1[0], "Local HMI", LW, 910, 8)
SetData(opera2[0], "Local HMI", LW, 920, 8)
SetData(opera3[0], "Local HMI", LW, 930, 8)
SetData(opera4[0], "Local HMI", LW, 940, 8)
SetData(opera5[0], "Local HMI", LW, 950, 8)


end macro_command
删除就行{}
发表于 2022-10-14 14:28:39 | 显示全部楼层
如果是显示不全,就是位数不对。
如果显示乱码,就是声明不对。
char operaa[8]='操作员1'//指的是operaa[0]--operaa[7]
char operab[8]='操作员2'//指的是operab[0]--operab[7]
char operac[8]='操作员3'
char operad[8]='工程师'
char operae[8]='管理员'//指的是operae[0]--operae[7]

你原来的
char opera1[8]='操作员1'//理论上应该是 opera1[0]--opera1[7]
char opera5[8]='管理员'//理论上应该死是opera5[0]--opera5[7]
但是实际上有可能
发表于 2023-12-13 11:30:50 | 显示全部楼层
字符串声明错了,要用双引号
发表于 2024-9-3 11:46:02 | 显示全部楼层
//开屏初始化

macro_command main()


char opera1[] = "操作员1";
char opera2[] = "操作员2";
char opera3[] = "操作员3";
char opera4[] = "工程师";
char opera5[] = "管理员";

// 设置数据到指定地址
SetData("操作员1", "Local HMI", LW, 910, 8);
SetData("操作员2", "Local HMI", LW, 920, 8);
SetData("操作员3", "Local HMI", LW, 930, 8);
SetData("工程师", "Local HMI", LW, 940, 8);
SetData("管理员", "Local HMI", LW, 950, 8);

end macro_command

这样试试?
发表于 2024-9-19 14:03:54 | 显示全部楼层
你这样赋值不对呀,用,UnicodeCopy 这个指令。
发表于 2024-9-19 14:06:15 | 显示全部楼层
char a[100]
UnicodeCopy("中国你好",a[0])
SetData(a[0],"Local HMI", LW, 100, 8);

然后面板上做 显示元件,用Unicode格式,就可以了。
您需要登录后才可以发帖 登录 | 注册

本版积分规则

回复帖子

Archiver|小黑屋|威纶通官网 ( 粤ICP备06054553号 )

GMT+8, 2024-12-4 00:50

Powered by Discuz! X3.4

© 2001-2023 Comsenz Inc.

快速回复 返回顶部 返回列表