|
楼主 |
发表于 2024-9-23 14:59:55
|
显示全部楼层
我这边设置代码这么写得,但是不生效,字体颜色变化也不生效。
//写DGUS中的VP变量数据
//addr:就是直接传入DGUS中的地址
//buf:缓冲区
//len:被发送数据的字数,一个字等于2个字节
void sys_write_vp(uint16_t addr,uint8_t* buf,uint16_t len)
{
uint8_t i;
i = (uint8_t)(addr&0x01);
addr >>= 1;
ADR_H = 0x00;
ADR_M = (uint8_t)(addr>>8);
ADR_L = (uint8_t)addr;
ADR_INC = 0x01;
RAMMODE = 0x8F;
while(APP_ACK==0);
if(i && len>0)
{
RAMMODE = 0x83;
DATA1 = *buf++;
DATA0 = *buf++;
APP_EN = 1;
while(APP_EN);
len--;
}
RAMMODE = 0x8F;
while(len>=2)
{
DATA3 = *buf++;
DATA2 = *buf++;
DATA1 = *buf++;
DATA0 = *buf++;
APP_EN = 1;
while(APP_EN);
len -= 2;
}
if(len)
{
RAMMODE = 0x8C;
DATA3 = *buf++;
DATA2 = *buf++;
APP_EN = 1;
while(APP_EN);
}
RAMMODE = 0x00;
}
void sys_set_value_color(uint16_t addr,uint16_t color)
{
//sp地址+3,为数据显示变量的颜色描述
sys_write_vp(addr+3,(uint8_t *)&color,1);
}
void sys_set_Font23(uint16_t addr)
{
//GBK_高位-低位
uint8_t codeMode[2] = {0x20,0x00};
//字库_23
uint8_t fontID[2] = {0x00,0x17};
//点阵大小
uint8_t fontDot[2] = {0x18,0x18};
sys_write_vp(addr+11,codeMode,1);
sys_write_vp(addr+9,fontID,1);
sys_write_vp(addr+10,fontDot,1);
sys_set_value_color(addr,0xFFFF);
}
|
|