|
我现在想用富士通的视频叠加MB90092芯片子屏显示功能,主屏可以正常显示。
子屏显示的字符为一段乱码,代码如下:
void MB90092_DisChar (UCHAR x,UCHAR y,int addr,UCHAR mul,UCHAR bc,UCHAR cc,UCHAR ff)
{
UCHAR temp1,temp2,color;
if (x>0x17||y>0x0B) return; //invalid col number or row number
temp1=((y>>2)&0x3)+0x80;
temp2=((y<<5)&0x60)+x;
MB90092_WriteByte(temp1); //command 0,设置写入地址,行和列
MB90092_WriteByte(temp2);
MB90092_WriteByte(0xB0|mul); //command 6,mul->字符尺寸控制(datasheel82),设置一整行
MB90092_WriteByte(0x20|y);
if (synchronization==SYN_EXTERNAL){ //外控制显示
cc=7;
bc=0;
}
color=((cc<<4)&0x70)|bc;
MB90092_WriteByte(0x88|ff); //ff控制是否特显
MB90092_WriteByte(color); //command1-1,设置字符颜色,背景颜色
MB90092_WriteByte(0x90+addr/128); //command2-1,设置字符点阵在外rom的地址
MB90092_WriteByte(addr%128);
}
//主屏字符
void MB90092_DisSub(UCHAR y,int addr, UCHAR bc, UCHAR cc,UCHAR ff)
{ UCHAR temp3,temp4,color;
if(y>0x0b) return;
temp3=((y>>2)&0x3)+0x84;
temp4=((y<<5)&0x60);
MB90092_WriteByte(temp3);
MB90092_WriteByte(temp4);
// MB90092_WriteByte(0xB0|mul); //command 6,mul->字符尺寸控制(datasheel82),设置一整行
// MB90092_WriteByte(0x20|y);
if (synchronization==SYN_EXTERNAL){
cc=7;
bc=0;
}
color=0x02;
MB90092_WriteByte(0xDf); //command 11子屏控制
MB90092_WriteByte(0x00);
MB90092_WriteByte(0xE1);
MB90092_WriteByte(0x10) ; //command 12子屏起始位
MB90092_WriteByte(0xE9);
MB90092_WriteByte(0x50); //command 13子屏起始位
MB90092_WriteByte(0x88|ff); //ff控制是否特显
MB90092_WriteByte(color); //command1-1,设置字符颜色,背景颜色
MB90092_WriteByte(0x90+addr/128); //command2-1,设置字符点阵在外rom的地址
MB90092_WriteByte(addr%128);
}//子屏字符
void Screen_Init (UCHAR bc)
{
UCHAR i;
CS=0;
Delay_ms(10); //程序开始时,要输入CS四次去清除上电复位,然后所作的设置才是有效的。
CS=1;
Delay_ms(10);
CS=0;
Delay_ms(10);
CS=1;
Delay_ms(10);
CS=0;
Delay_ms(10);
CS=1;
Delay_ms(10);
CS=0;
Delay_ms(10);
CS=1;
Delay_ms(10);
MB90092_WriteByte(0xA0); //command 4,首先选择内同步
MB90092_WriteByte(0x00);
MB90092_WriteByte(0xAD); //command 5
MB90092_WriteByte(0x10);
//KID=0;APC与颜色有关;GYZ=0;W3--W0为行间距;10101 KID APC GYZ0 BH2 BH1 BH0 W3 W2 W1 W0
MB90092_WriteByte(0xBC); //command 7
MB90092_WriteByte(0x2A); //垂直开始位置设定
MB90092_WriteByte(0xC0); //command 8
MB90092_WriteByte(0x18); //水平开始位置设定
MB90092_WriteByte(0xC8); //command 9,GRM位设置普通模式或者扩展图形模式
MB90092_WriteByte(0x20);
MB90092_WriteByte(0xD1); //command 10,设置普通模式/扩展图形模式,闪烁,字符背景,字符单色/彩色,背景单色/彩色
MB90092_WriteByte(0x38|bc);
MB90092_WriteByte(0xDF); //command 11
MB90092_WriteByte(0x00);
MB90092_WriteByte(0xE1);
MB90092_WriteByte(0x10) ; //command 12
MB90092_WriteByte(0xE9);
MB90092_WriteByte(0x50); //command 13
MB90092_WriteByte(0xA2|synchronization);//command 4,内/外同步选择
MB90092_WriteByte(0x2B);
for (i=0;i<0x0B;i++)
MB90092_DisColor (i);
MB90092_ClearScreen ();
} //屏初始化
请大侠指点下,现在主屏正常显示,子屏是一段乱码,无论输出什么字符代码都一样
|
|