📄 main.c
字号:
//***************************************************************************//
//****start 2005-11-19 *******//
//****distance measure *******//
//****end 2005- *******//
//****write by linyanhai and qinghai tel:13567775595 qq:94226889 *******//
//***************************************************************************//
#include <at89x55.h>
#include <intrins.h>
#include <absacc.h>
#include <chinese_character.h>
#include <distance_measure.h>
#include <ca320240b.h>
#include <24c02.h>
#include <key.h> // Write By QiHai;
void delay(unsigned long y)
{
while(y){y--;}
}
void Set_Style_Frame()
{
unsigned char i;
O_YL=O_YL_STYLE_1_UP;
add_calculate_layer1(0,O_YL);
CWR=csrdir_down;
CWR=mwrite;
for(i=0;i<219;i++){DWR=0xe0;}
O_YL=O_YL_STYLE_1_UP;
add_calculate_layer1(39,O_YL);
CWR=csrdir_down;
CWR=mwrite;
for(i=0;i<219;i++){DWR=0x07;}
O_YL=O_YL_STYLE_1_UP;
add_calculate_layer1(0,O_YL);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<144;i++){DWR=0xff;}
add_calculate_layer1(0,237);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<144;i++){DWR=0xff;}
O_YL=O_YL_STYLE_2_UP;
add_calculate_layer1(0,O_YL);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<40;i++){DWR=0xff;}
O_YL=O_YL_STYLE_3_UP;
add_calculate_layer1(0,O_YL);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<40;i++){DWR=0xff;}
O_YL=O_YL_STYLE_4_UP;
add_calculate_layer1(0,O_YL);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<40;i++){DWR=0xff;}
O_YL=O_YL_STYLE_5_UP;
add_calculate_layer1(0,O_YL);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<40;i++){DWR=0xff;}
O_YL=O_YL_STYLE_6_UP;
add_calculate_layer1(0,O_YL);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<40;i++){DWR=0xff;}
}
void Set_Style_Fixed_Character()
{
CWR=csrdir_down;
O_XL=O_XL_STYLE_1;
O_YL=O_YL_STYLE_1;
mwrite_1330_12bytes(STYLE_1,26,12);
O_XL=O_XL_STYLE_2;
O_YL=O_YL_STYLE_2;
mwrite_1330_12bytes(STYLE_2,26,12);
O_XL=O_XL_STYLE_3;
O_YL=O_YL_STYLE_3;
mwrite_1330_12bytes(STYLE_3,26,12);
O_XL=O_XL_STYLE_4;
O_YL=O_YL_STYLE_4;
mwrite_1330_12bytes(STYLE_4,26,12);
}
void frame_setting()
{
unsigned char i;
//****************************write row***************************
O_YL=O_YL_S_UP;
add_calculate_layer1(0,O_YL);
CWR=csrdir_down;
CWR=mwrite;
for(i=0;i<219;i++){DWR=0xe0;}
O_YL=O_YL_S_UP;
add_calculate_layer1(39,O_YL);
WR=csrdir_down;
CWR=mwrite;
for(i=0;i<219;i++){DWR=0x07;}
O_XL=O_XL_S_ZHI;
O_YL=O_YL_S_UP;
add_calculate_layer1(O_XL,O_YL);
CWR=csrdir_down;
CWR=mwrite;
for(i=0;i<219;i++){DWR=0x01;}
O_XL=O_XL_S_ZHI_1;
O_YL=O_YL_S_UP;
add_calculate_layer1(O_XL,O_YL);
CWR=csrdir_down;
CWR=mwrite;
for(i=0;i<219;i++){DWR=0x01;}
O_XL=O_XL_S_ZHI_2;
O_YL=O_YL_S_UP;
add_calculate_layer1(O_XL,O_YL);
CWR=csrdir_down;
CWR=mwrite;
for(i=0;i<219;i++){DWR=0x01;}
O_XL=O_XL_S_ZHI_3;
O_YL=O_YL_S_UP;
add_calculate_layer1(O_XL,O_YL);
CWR=csrdir_down;
CWR=mwrite;
for(i=0;i<219;i++){DWR=0x01;}
//***************************write line **************************************
O_YL=O_YL_S_UP;
add_calculate_layer1(0,O_YL);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<144;i++){DWR=0xff;}
add_calculate_layer1(0,237);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<144;i++){DWR=0xff;}
O_YL=O_YL_S_ZHU;
add_calculate_layer1(0,O_YL);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<40;i++){DWR=0xff;}
O_YL=O_YL_S_ZHU_C;
add_calculate_layer1(0,O_YL);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<40;i++){DWR=0xff;}
O_YL=O_YL_S_ZHU_K;
add_calculate_layer1(0,O_YL);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<40;i++){DWR=0xff;}
O_YL=O_YL_S_FU;
add_calculate_layer1(0,O_YL);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<40;i++){DWR=0xff;}
O_YL=O_YL_S_FU_C;
add_calculate_layer1(0,O_YL);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<40;i++){DWR=0xff;}
O_YL=O_YL_S_FU_K;
add_calculate_layer1(0,O_YL);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<40;i++){DWR=0xff;}
}
void frame_work()
{
unsigned char i;
//****************************write row ***************************//
O_YL=O_YL_UP;
add_calculate_layer1(0,O_YL);
CWR=csrdir_down;
CWR=mwrite;
for(i=0;i<219;i++){DWR=0xe0;}
O_YL=O_YL_UP;
add_calculate_layer1(39,O_YL);
WR=csrdir_down;
CWR=mwrite;
for(i=0;i<219;i++){DWR=0x07;}
O_XL=O_XL_ZHI;
O_YL=O_YL_UP;
add_calculate_layer1(O_XL,O_YL);
CWR=csrdir_down;
CWR=mwrite;
for(i=0;i<177;i++){DWR=0x01;}
O_XL=O_XL_ZHI_1;
O_YL=O_YL_UP;
add_calculate_layer1(O_XL,O_YL);
CWR=csrdir_down;
CWR=mwrite;
for(i=0;i<177;i++){DWR=0x01;}
O_XL=O_XL_ZHI_2;
O_YL=O_YL_UP;
add_calculate_layer1(O_XL,O_YL);
CWR=csrdir_down;
CWR=mwrite;
for(i=0;i<177;i++){DWR=0x01;}
O_XL=O_XL_ZHI_3;
O_YL=O_YL_UP;
add_calculate_layer1(O_XL,O_YL);
CWR=csrdir_down;
CWR=mwrite;
for(i=0;i<177;i++){DWR=0x01;}
//************************************xincheng lin*****************
O_XL=14;
O_YL=202;
add_calculate_layer1(O_XL,O_YL);
CWR=csrdir_down;
CWR=mwrite;
for(i=0;i<38;i++){DWR=0x01;}
O_XL=21;
O_YL=202;
add_calculate_layer1(O_XL,O_YL);
CWR=csrdir_down;
CWR=mwrite;
for(i=0;i<38;i++){DWR=0x01;}
O_XL=31;
O_YL=202;
add_calculate_layer1(O_XL,O_YL);
CWR=csrdir_down;
CWR=mwrite;
for(i=0;i<38;i++){DWR=0x01;}
//***************************write line ******************************//
O_YL=O_YL_UP;
add_calculate_layer1(0,O_YL);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<144;i++){DWR=0xff;}
add_calculate_layer1(0,237);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<144;i++){DWR=0xff;}
O_YL=O_YL_ZHU;
add_calculate_layer1(0,O_YL);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<40;i++){DWR=0xff;}
O_YL=O_YL_ZHU_CHAO;
add_calculate_layer1(0,O_YL);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<40;i++){DWR=0xff;}
O_YL=O_YL_ZHU_KAI;
add_calculate_layer1(0,O_YL);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<40;i++){DWR=0xff;}
O_YL=O_YL_FU;
add_calculate_layer1(0,O_YL);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<40;i++){DWR=0xff;}
O_YL=O_YL_FU_CHAO;
add_calculate_layer1(0,O_YL);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<40;i++){DWR=0xff;}
O_YL=O_YL_FU_KAI;
add_calculate_layer1(0,O_YL);
CWR=csrdir_right;
CWR=mwrite;
for(i=0;i<40;i++){DWR=0xff;}
}
void write_setting_fixedcharacter()
{
CWR=csrdir_down;
O_XL=1;
O_YL=0;
if(setting_style_addr==1){mwrite_1330_12bytes(STYLE_1,26,12);}
else if(setting_style_addr==2){mwrite_1330_12bytes(STYLE_2,26,12);}
else if(setting_style_addr==3){mwrite_1330_12bytes(STYLE_3,26,12);}
else if(setting_style_addr==4){mwrite_1330_12bytes(STYLE_4,26,12);}
mwrite_1330_6bytes(character_chaocheng,25,6);
mwrite_1330_6bytes(character_kaiju,25,6);
mwrite_1330_6bytes(characters_chanshu,25,6);
mwrite_1330_6bytes(characters_sheding,25,6);
//**************************write character chaocheng for main touch **********************
O_XL=O_XL_S_CHAOCHENG;
O_YL=O_YL_S_ZHU_CHAOCHENG_CHAR;
mwrite_1330_6bytes(character_chaocheng,25,6);
mwrite_1330_5bytes(character_mm,25,5);
//*************************write character kaiju for main touch ************************
O_XL=O_XL_S_CHAOCHENG;
O_YL=O_YL_S_ZHU_KAIJU_CHAR;
mwrite_1330_6bytes(character_kaiju,25,6);
mwrite_1330_5bytes(character_mm,25,5);
//************************write character chaocheng for assistant touch******************
O_XL=O_XL_S_CHAOCHENG;
O_YL=O_YL_S_FU_CHAOCHENG_CHAR;
mwrite_1330_6bytes(character_chaocheng,25,6);
mwrite_1330_5bytes(character_mm,25,5);
//***********************write character kaiju for assistant touch ***********************
O_XL=O_XL_S_CHAOCHENG;
O_YL=O_YL_S_FU_KAIJU_CHAR;
mwrite_1330_6bytes(character_kaiju,25,6);
mwrite_1330_5bytes(character_mm,25,5);
//********************** write character zhuchutou for main **********************
O_XL=O_XL_S_CHAOCHENG;
O_YL=O_YL_S_ZHU_CHAR;
mwrite_1330_9bytes(character_zhuchutou,25,9);
//********************** write character fuchutou for main *********************
O_XL=O_XL_S_CHAOCHENG;
O_YL=O_YL_S_FU_CHAR;
mwrite_1330_9bytes(character_fuchutou,25,9);
//*********************write I II III IV to windows **************************
O_XL=O_XL_S_I;
O_YL=O_YL_S_ZHU_CHAR;
mwrite_1330_3bytes(character_I,25,3);
O_XL=O_XL_S_II;
O_YL=O_YL_S_ZHU_CHAR;
mwrite_1330_3bytes(character_II,25,3);
O_XL=O_XL_S_III;
O_YL=O_YL_S_ZHU_CHAR;
mwrite_1330_3bytes(character_III,25,3);
O_XL=O_XL_S_IV;
O_YL=O_YL_S_ZHU_CHAR;
mwrite_1330_3bytes(character_IV,25,3);
O_XL=O_XL_S_I;
O_YL=O_YL_S_FU_CHAR;
mwrite_1330_3bytes(character_I,25,3);
O_XL=O_XL_S_II;
O_YL=O_YL_S_FU_CHAR;
mwrite_1330_3bytes(character_II,25,3);
O_XL=O_XL_S_III;
O_YL=O_YL_S_FU_CHAR;
mwrite_1330_3bytes(character_III,25,3);
O_XL=O_XL_S_IV;
O_YL=O_YL_S_FU_CHAR;
mwrite_1330_3bytes(character_IV,25,3);
}
void write_fixedcharacter()
{
CWR=csrdir_down;
O_XL=1;
O_YL=0;
if(setting_style_addr==1){mwrite_1330_12bytes(STYLE_1,26,12);}
else if(setting_style_addr==2){mwrite_1330_12bytes(STYLE_2,26,12);}
else if(setting_style_addr==3){mwrite_1330_12bytes(STYLE_3,26,12);}
else if(setting_style_addr==4){mwrite_1330_12bytes(STYLE_4,26,12);}
mwrite_1330_6bytes(character_chaocheng,25,6);
mwrite_1330_6bytes(character_kaiju,25,6);
mwrite_1330_6bytes(characters_chanshu,25,6);
mwrite_1330_6bytes(characters_ceshi,25,6);
//**************************write character chaocheng for main touch ***********************
O_XL=O_XL_CHAOCHENG;
O_YL=O_YL_ZHU_CHAOCHENG_CHAR;
mwrite_1330_6bytes(character_chaocheng,25,6);
mwrite_1330_5bytes(character_mm,25,5);
//*************************write character kaiju for main touch ***********************
O_XL=O_XL_CHAOCHENG;
O_YL=O_YL_ZHU_KAIJU_CHAR;
mwrite_1330_6bytes(character_kaiju,25,6);
mwrite_1330_5bytes(character_mm,25,5);
//************************write character chaocheng for assistant touch************************
O_XL=O_XL_CHAOCHENG;
O_YL=O_YL_FU_CHAOCHENG_CHAR;
mwrite_1330_6bytes(character_chaocheng,25,6);
mwrite_1330_5bytes(character_mm,25,5);
//***********************write character kaiju for assistant touch ****************************
O_XL=O_XL_CHAOCHENG;
O_YL=O_YL_FU_KAIJU_CHAR;
mwrite_1330_6bytes(character_kaiju,25,6);
mwrite_1330_5bytes(character_mm,25,5);
//********************** write character zhuchutou for main *************************
O_XL=O_XL_CHAOCHENG;
O_YL=O_YL_ZHU_CHAR;
mwrite_1330_9bytes(character_zhuchutou,25,9);
//********************** write character fuchutou for main ********************
O_XL=O_XL_CHAOCHENG;
O_YL=O_YL_FU_CHAR;
mwrite_1330_9bytes(character_fuchutou,25,9);
O_XL=O_XL_CHAOCHENG;
O_YL=210;
//O_YL=O_YL_XINCHENG;
mwrite_1330_9bytes(character_zongxincheng,25,9);
mwrite_1330_5bytes(character_mm,25,5);
O_XL=O_XL_DIANYA;
O_YL=210;
//O_YL=O_YL_XINCHENG;
mwrite_1330_6bytes(character_dianya,25,6);
mwrite_1330_4bytes(character_v,25,4);
//*********************write I II III IV to windows ****************************
O_XL=O_XL_I;
O_YL=O_YL_ZHU_CHAR;
mwrite_1330_3bytes(character_I,25,3);
O_XL=O_XL_II;
O_YL=O_YL_ZHU_CHAR;
mwrite_1330_3bytes(character_II,25,3);
O_XL=O_XL_III;
O_YL=O_YL_ZHU_CHAR;
mwrite_1330_3bytes(character_III,25,3);
O_XL=O_XL_IV;
O_YL=O_YL_ZHU_CHAR;
mwrite_1330_3bytes(character_IV,25,3);
O_XL=O_XL_I;
O_YL=O_YL_FU_CHAR;
mwrite_1330_3bytes(character_I,25,3);
O_XL=O_XL_II;
O_YL=O_YL_FU_CHAR;
mwrite_1330_3bytes(character_II,25,3);
O_XL=O_XL_III;
O_YL=O_YL_FU_CHAR;
mwrite_1330_3bytes(character_III,25,3);
O_XL=O_XL_IV;
O_YL=O_YL_FU_CHAR;
mwrite_1330_3bytes(character_IV,25,3);
}
void send_setting_number(unsigned char *send_buf)
{
unsigned char i;
unsigned char code *pt_number;
bit F_Clr_Over=0;
for(i=0;i<5;i++)
{
if(send_buf[i]||F_Clr_Over)
{
pt_number=*(pt_1byte_number+send_buf[i]);
mwrite_1330_1bytes(pt_number,16,1);
F_Clr_Over=1;
}
else
{
if((send_buf[i+1]==10)||i==4)
{
pt_number=*(pt_1byte_number+send_buf[i]);
mwrite_1330_1bytes(pt_number,16,1);
F_Clr_Over=1;
}
else{mwrite_1330_1bytes(character_clr,16,1);}
}
}
}
void send_main_number(unsigned char *send_buf)
{
unsigned char i,j;
unsigned int unror_number_pre;
unsigned int unror_number_cur;
unsigned int code *pt_pre_num;
unsigned int code *pt_cur_num;
unsigned char temp;
unsigned char save;
temp=O_YL;
CWR=csrdir_down;
for(i=0;i<5;i++)
{
//add_number=pt[send_buf[i-1]]
if(i==0){mwrite_1330_2bytes(pt[send_buf[i]],22,2);}
else if(i==1)
{
CWR=csrdir_right;
O_XL--;
add_calculate_layer2(O_XL,O_YL);
pt_pre_num=pt[send_buf[i-1]]; // the last number'address
pt_cur_num=pt[send_buf[i]]; // the current number'address
for(j=0;j<22;j++)
{
unror_number_cur=pt_cur_num[j];
unror_number_pre=pt_pre_num[j];
unror_number_cur=_iror_(unror_number_cur,2);
unror_number_cur&=0x3fff;
unror_number_pre=_irol_(unror_number_pre,8);
unror_number_pre&=0xb000;
unror_number_cur=unror_number_pre|unror_number_cur;
CWR=mwrite;
_nop_();
save=unror_number_cur/256;
DWR=save;
save=unror_number_cur%256;
DWR=save;
O_YL++;
add_calculate_layer2(O_XL,O_YL);
}
O_XL++;
O_YL=temp;
}
else if(i==2)
{
if(F_Refurbish_Volt){}
else
{
//O_XL--;
add_calculate_layer2(O_XL,O_YL);
pt_pre_num=pt[send_buf[i-1]];
pt_cur_num=pt[send_buf[i]];
for(j=0;j<22;j++)
{
unror_number_cur=pt_cur_num[j];
unror_number_pre=pt_pre_num[j];
unror_number_cur=_iror_(unror_number_cur,4);
unror_number_cur&=0x0fff;
unror_number_pre=_irol_(unror_number_pre,6);
unror_number_pre&=0xf000;
unror_number_cur=unror_number_pre|unror_number_cur;
CWR=mwrite;
_nop_();
save=unror_number_cur/256;
DWR=save;
save=unror_number_cur%256;
DWR=save;
O_YL++;
add_calculate_layer2(O_XL,O_YL);
}
O_YL=temp;
O_XL++;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -