?? m35055.c.bak
字號:
#include "target.h"
//if define M35055 means driver for M35055
//else for M35054
#define M35055
#define BLINKMASK 0x0800
#define SetM3505Cs() Set_P0_0()
#define ClrM3505Cs() Clr_P0_0()
#define SetM3505Clk() Set_P0_1()
#define ClrM3505Clk() Clr_P0_1()
#define SetM3505Sin() Set_P0_2()
#define ClrM3505Sin() Clr_P0_2()
extern bit bCurrentLock;
void M35055Delay()
{
unsigned char i;
for(i=0;i<10;i++);
}
void SendWord(unsigned int uiData)
{
unsigned char i;
for(i=0;i<16;i++){
ClrM3505Clk();
if(uiData&0x01)
SetM3505Sin();
else
ClrM3505Sin();
M35055Delay();
SetM3505Clk();
uiData >>= 1;
}
}
void SendCommand(unsigned int addr,unsigned int command)
{
ClrM3505Cs();
SendWord(addr);
SendWord(command);
SetM3505Cs();
}
unsigned char GetCharData(unsigned char ucChar)
{
#ifndef M35055
ucChar &= 0x7F;
#endif
if(ucChar>='!'&&ucChar<='Z')
return ucChar-0x10;
else if(ucChar>='a'&&ucChar<='z')
return ucChar-0x10;
switch(ucChar){
case ']':
return 0x4B;
case '[':
return 0x4D;
case 1:
return 112;
case 2:
return 113;
case 3:
return 114;
case 4:
return 115;
case ' ':
return 0xFF;
default:
return ucChar;
}
}
void TVShowChar(unsigned char addr,unsigned char ucchar,unsigned char color,bit bBlink)
{
unsigned int uitemp;
ClrM3505Cs();
SendWord((int)addr);
uitemp = color&0x07;
uitemp <<= 8;
#ifdef M35055
uitemp |= GetCharData(ucchar);
#else
uitemp |= GetCharData(ucchar&0x7F);
#endif
if(bBlink)
uitemp |= BLINKMASK;
SendWord(uitemp);
SetM3505Cs();
}
void TVShowString(unsigned char addr,unsigned char *str,unsigned char color,bit bBlink)
{
unsigned int uitemp;
ClrM3505Cs();
SendWord(addr);
while(*str){
uitemp = color&0x07;
uitemp <<= 8;
#ifdef M35055
uitemp |= GetCharData(*str);
#else
uitemp |= GetCharData(*str&0x7F);
#endif
if(bBlink)
uitemp |= BLINKMASK;
SendWord(uitemp);
str++;
}
SetM3505Cs();
}
/*
void SetOutPort(unsigned char portdata)
{
unsigned short uitemp = 0x0480|((portdata&3)<<2);
SendCommand(0xf0,uitemp);
}
*/
#if 0
void SetPosition(unsigned char startx,unsigned char starty)
{
SendCommand(0xf1,0x1f00|startx);
SendCommand(0xf2,0x1f00|starty);
}
void SetCharactorSize(unsigned char ucsize)
{
SendCommand(0xf3,ucsize);
}
void SetLineMode(unsigned int linemode)
{
// SendCommand(0xf4,linemode|0x700);
SendCommand(0xf4,linemode);
}
void SetCursor(unsigned char addr,unsigned char attr)
{
SendCommand(0xf7,addr|(((int)attr)<<8));
}
#endif
void CLearOsdScreen(unsigned char uclock)
{
if(uclock){
SendCommand(0xf8,0x3fc2);
SendCommand(0xf8,0x3f42);
}
else{
SendCommand(0xf8,0x1fc4);
SendCommand(0xf8,0x1f44);
}
}
void SetCrystal(unsigned char uclock)
{
if(uclock)
{
SendCommand(0xf8,0x3f42);
SendCommand(0xf6,0x203c);
}
else{
SendCommand(0xf8,0x1f44);
SendCommand(0xf6,0x204c);
}
}
void Init35055()
{
#if 1
SendCommand(0xf0,0x0483);
SendCommand(0xf1,0x1f70);
SendCommand(0xf2,0x1f30);
SendCommand(0xf3,0x0000);
SendCommand(0xf4,0x0000);
SendCommand(0xf5,0x0002);
SendCommand(0xf6,0x204c);
SendCommand(0xf7,0x08ff);
SendCommand(0xf8,0x3f40);
CLearOsdScreen(bCurrentLock);
#else
//set the start position
SetPosition(0x70,0x10);
//
SetCharactorSize(0);
SendCommand(0xf0,0x0483);
SendCommand(0xf4,0x0000);
SendCommand(0xf5,0x0002);
SendCommand(0xf6,0x204c);
SendCommand(0xf8,0x3f40);
SetCursor(0xff,1);
CLearOsdScreen(bCurrentLock);
// SetCharactorSize(0x00);
// SetLineMode(2);
// TVShowString(48,"0123456789+dB",1,0);
// TVShowString(24,"c51 keil7.0",3,0);
// TVShowString(48,"I love this work",6,0);
#endif
SetCrystal(bCurrentLock);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -