📄 main.c
字号:
//===================================================================
// CSTN
// LCD: Varitronix
// DUTY: 1/128 BIAS: 1/12 VOP: 15.3 (V)
// IC: Ultrachip UC1697a or Stronix ST7637
// Parallel 8080 8bit 128*128
//===================================================================
//===================================================================
// Writer: Jim
// Date: 07/25/2008
// Version: V1.0
//===================================================================
//===================================================================
// History:
//===================================================================
#include "Main.H"
#include "Port.H"
#include "Time_Mode.H"
#include "Pattern_Show.H"
extern tByte ael_main;
void main()
{
tByte i;
Reset_LCD();
Initial_IO();
Initial_Main();
while(1)
{
Pitcure_Pattern_Main_Show();
Press();
RGB_Pattern_Show();
Press();
Lcd_DspAscII8X16(2,0,0x07e0,"MXMY OTP SUCESS!");
Lcd_DspAscII8X16(8,54,0xf800," Ultrachip ");
Lcd_DspAscII8X16(10,80,0x001f," UC1697a ");
Press();
Number_Pattern_Main_Show();
Press();
ColorBAR_Pattern_Main_Show();
Press();
Gray_Pattern_Main_Show();
Press();
Other_Pattern_Show();
Press();
/*
for(i=1;i<16;i++)
{
display_eprom(i);
Press();
} */
}
}
void Window_Main()
{
#if 1
WriteCOM_Main(0x00); // Column Address Set
WriteCOM_Main(0x10);
WriteCOM_Main(0x60); // Row Address Set
WriteCOM_Main(0x70);
WriteCOM_Main(0xf4);
WriteCOM_Main(0); //y
WriteCOM_Main(0xf5); //Row start x
WriteCOM_Main(0); //col start
WriteCOM_Main(0xf6);
WriteCOM_Main(0x7f);
WriteCOM_Main(0xf7); //Row End
WriteCOM_Main(0x7f);
#endif
#if 0
WriteCOM_Main(0x2a); // Column Address Set
WriteDAT_Main(0x01);
WriteDAT_Main(0x82);
WriteCOM_Main(0x2b); // Row Address Set
WriteDAT_Main(0x01);
WriteDAT_Main(0x82);
WriteCOM_Main(0x2c);
#endif
#if 0
WriteCOM_Main(0x2a); // Column Address Set
WriteDAT_Main(0x02);
WriteDAT_Main(0x81);
WriteCOM_Main(0x2b); // Row Address Set
WriteDAT_Main(0x00);
WriteDAT_Main(0x7f);
WriteCOM_Main(0x2c);
#endif
}
void Initial_IO()
{
P0=0xff;
P1=0xff;
P2=0xff;
P3=0xff;
}
void Reset_LCD()
{
_CS_MAIN=0;
_RES=1;
Delay(20);
_RES=0;
Delay(20);
_RES=1;
Delay(200);
_CS_MAIN=1;
}
void Delay(tByte count) /* Delay 1ms */
{
tByte i,j;
for(i=0;i<count;i++)
for(j=0;j<120;j++)
;
}
void Press()
{
tByte key;
tByte com,databus;
// tByte i==0,j==0;
while(STEPB==1)
{
key=0;
Delay(10);
if(add==0)
{
if(add==0)
{
while(!add)
{}
// i++;
ael_main++;
key=1;
com=0x81; //command code //
databus=ael_main;
}
}
else if(sub==0)
{
if(sub==0)
{
while(!sub)
{}
// j--;
ael_main--;
key=1;
com=0x81;
databus=ael_main;
}
}
if (key==1)
{
/*
if((i>=32)||(j<=-33))
{
i = 0;
Contrast_Register = Setting;
Delay(200);
Gray_scale();
}
else
{
Contrast_Register = Setting + i;
write_command(0x2a); //Contrast Control 1
write_command(Contrast_Register); //
}
*/
WriteCOM_Main(com);
WriteCOM_Main(databus);
key=0;
}
}
if(STEPB==0)
{
while(STEPB==0)
{
Delay(4);
}
Delay(5);
}
Delay(5);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -