📄 646545.c
字号:
/*main function: control qam、lcd、keyboard and speaker*/
#include <iom128v.h>
#include <control.h>
#include <lcd.h>
#define chg1(a) (((a&0xf0)>>4)*10+(a&0x0f))
#define chg2(a) (((a/10)<<4)+(a%10))
//The password save address
#define PASSWORD_ADD 0X0054 //0X0054-0X0059
#define power_flg_add 0x000f
extern unsigned char to_power_off;
extern unsigned char sys_init;
extern unsigned int iSmbRat;
extern unsigned char net_show;
extern unsigned char temperature_h[2],temperature_l[2];
extern unsigned char qam_set;
extern unsigned char ucMenuLayer; //菜单级别
extern unsigned char ucMenuPosition; //主菜单纵向位置
extern unsigned char ucCurserPosition; //光标当前位置
extern unsigned char ucMenuCurrentPosition; //二级子菜单横向位置
extern unsigned char ucsubMenuCurrentPosition; //子菜单当前位置
extern unsigned char soundMenuPosition;
extern unsigned char qam_ch_position;
extern unsigned char sens_ch_position;
extern unsigned char vol_ch_position;
extern unsigned int com_set;
extern unsigned char baud_saved;
extern unsigned char memu_operation;
extern unsigned char time[7];
extern unsigned char qam_ch,center_frequency,qammode;
extern unsigned int iSmbRatSaved[8];
extern unsigned char ucMenuQModSubPosition[8],ucMenuIFSubPosition[8];
extern unsigned char tem_ch,vol_ch,spk_on;
extern unsigned char sound_type_saved;
extern unsigned char sound_swtich[4],sound_swtich_saved[4];
extern unsigned char net_gatway[4],net_sub[4],net_lip[4],net_dip[4];
extern unsigned char hour_saved,mint_saved;
extern unsigned char power_on,power_off;
extern unsigned char restart;
extern unsigned char menu_password[6];
extern unsigned char power_password[6];
extern unsigned int VOL_H_valsaved[4],VOL_L_valsaved[4];
extern unsigned char password_ok,bCurserOn;
extern unsigned char key_in;
extern unsigned char serv_trl,temperature_alarm;
extern unsigned char powre_off_flg;
extern unsigned char server_start,reset;
extern unsigned char time_15s,T_1s;
extern unsigned char have_check;
unsigned char temp_bk1,temp_bk2;
unsigned char password_number;
unsigned char password2[6];//用户修改密码
//---------------------------------------------------------
// NAME: check_password()
// ENTRY: void
// RETURN: void
// FUNCTION:check password
// MODIFY DATE : 2004.1.28
//--------------------------------------------------------
unsigned char check_password(void)
{
unsigned char i, x, y;
for(i = 0;i <= 5;i++)
{
x = (password2[i] & 0x0f) * 16;
y = password2[i] & 0xf0;
if(x != y)
return (0);
}
return (1);
}
//---------------------------------------------------------
// NAME: password_set_check()
// ENTRY: void
// RETURN: void
// FUNCTION:password set check
// MODIFY DATE : 2004.1.28
//--------------------------------------------------------
void password_set_check(void)
{
unsigned char i,a;
if((ucCurserPosition==1)&&(password_number==6))
{
password_number=0;
ucCurserPosition=2;
show_key_set(ucCurserPosition);
inputkey(6,1);
ucMenuLayer=2;
}
else if((ucCurserPosition==2)&&(password_number==6))
{
if(check_password()==1)
{
for(i=0;i<6;i++)
{
a=password2[i]&0x0f;
//WriterClock(CHIP_EEP_ADDR,0x0045+i,a);
menu_password[i]=a;
write_eeprom(PASSWORD_ADD+i,a);
}
ucMenuLayer=1;
ucCurserPosition=1;
SHOW_LOGO(13);
}
else
{
show_key_set(1);
password_number=0;
ucCurserPosition=1;
ucMenuLayer=2;
}
}
}
//---------------------------------------------------------
// NAME: password_set_think()
// ENTRY: void
// RETURN: void
// FUNCTION:在密码设置下对键值分析
// MODIFY DATE : 2004.1.28
//--------------------------------------------------------
void password_set_think(unsigned char n)
{
if(ucCurserPosition==1)
{
if(password_number<6)
{
password2[password_number] = n;
if(password_number<6)
{
password_number+=1;
inputkey(password_number,1);/*密码输入 a星号数*/
}
}
}
else if(ucCurserPosition==2)
{
if(password_number<6)
{
password2[password_number] = password2[password_number]|16*n;
if(password_number<6)
{
password_number+=1;
inputkey(password_number,2);/*密码输入 a星号数*/
}
}
}
}
//---------------------------------------------------------
// NAME: disp_volt_set()
// ENTRY: void
// RETURN: void
// FUNCTION:显示电压设置数值
// MODIFY DATE : 2004.1.28
//--------------------------------------------------------
void disp_volt_set(unsigned char volt)
{
switch(volt)
{
case 1:
Disp_char_16_8(2,0x05,0x48,0 );
Disp_char_16_8(2,0x0d,0x3a,0 );
Disp_char_16_8(2,0x15,VOL_H_valsaved[vol_ch_position]/100+0x30,0);
Disp_char_16_8(2,0x1d,0x2e,0 );
Disp_char_16_8(2,0x22,(VOL_H_valsaved[vol_ch_position]%100)/10+0x30,0 );
Disp_char_16_8(2,0x2a,VOL_H_valsaved[vol_ch_position]%10+0x30,0 );
Disp_char_16_8(2,0x42,0x4c,0 );
Disp_char_16_8(2,0x4a,0x3a,0 );
Disp_char_16_8(2,0x52,VOL_L_valsaved[vol_ch_position]/100+0x30,0);
Disp_char_16_8(2,0x5a,0x2e,0 );
Disp_char_16_8(2,0x5f,(VOL_L_valsaved[vol_ch_position]%100)/10+0x30,0 );
Disp_char_16_8(2,0x67,VOL_L_valsaved[vol_ch_position]%10+0x30,0 );
break;
case 2:
Disp_char_16_8(2,0x05,0x48,0 );
Disp_char_16_8(2,0x0d,0x3a,0 );
Disp_char_16_8(2,0x15,VOL_H_valsaved[vol_ch_position]/1000+0x30,0);
Disp_char_16_8(2,0x1d,(VOL_H_valsaved[vol_ch_position]%1000)/100+0x30,0 );
Disp_char_16_8(2,0x25,0x2e,0 );
Disp_char_16_8(2,0x2a,VOL_H_valsaved[vol_ch_position]%100/10+0x30,0 );
Disp_char_16_8(2,0x32,VOL_H_valsaved[vol_ch_position]%10+0x30,0 );
Disp_char_16_8(2,0x42,0x4c,0 );
Disp_char_16_8(2,0x4a,0x3a,0 );
Disp_char_16_8(2,0x52,VOL_L_valsaved[vol_ch_position]/1000+0x30,0);
Disp_char_16_8(2,0x5a,(VOL_L_valsaved[vol_ch_position]%1000)/100+0x30,0 );
Disp_char_16_8(2,0x62,0x2e,0 );
Disp_char_16_8(2,0x67,VOL_L_valsaved[vol_ch_position]%100/10+0x30,0 );
Disp_char_16_8(2,0x6f,VOL_H_valsaved[vol_ch_position]%10+0x30,0 );
break;
default:
break;
}
}
//---------------------------------------------------------
// NAME: show_volt_set()
// ENTRY: void
// RETURN: void
// FUNCTION:显示电压设置界面
// MODIFY DATE : 2004.1.28
//--------------------------------------------------------
void show_volt_set(unsigned char vol_chanl)
{
switch(vol_chanl)
{
case 1:
LCD_CLR();
SHOW_ALL_HEAD(17);
disp_volt_set(1);
break;
case 2:
LCD_CLR();
SHOW_ALL_HEAD(18);
disp_volt_set(1);
break;
case 3:
LCD_CLR();
SHOW_ALL_HEAD(10);
disp_volt_set(1);
break;
case 4:
LCD_CLR();
SHOW_ALL_HEAD(9);
disp_volt_set(2);
break;
default:
break;
}
}
//---------------------------------------------------------
// NAME: show_main_menu()
// ENTRY: void
// RETURN: void
// FUNCTION:显示主菜单界面
// MODIFY DATE : 2004.1.28
//--------------------------------------------------------
void show_main_menu(unsigned char option)
{
switch( option )
{
case 1: //disp_main_menu_QAM;
SHOW_LOGO(20);
break;
case 2: //disp_main_menu_TEMP;
SHOW_LOGO(38);
break;
case 3: //disp_main_menu_VOLT;
SHOW_LOGO(42);
break;
case 4: //disp_main_menu_SOUND;
SHOW_LOGO(4);
break;
case 5: //disp_main_menu_Enet;
SHOW_LOGO(12);
break;
case 6: //disp_main_menu_COM;
SHOW_LOGO(37);
break;
case 7: //disp_main_menu_CLOCK;
SHOW_LOGO(2);
break;
case 8: //disp_main_menu_PASSWORD;
SHOW_LOGO(13);
break;
default:
break;
}
}
//---------------------------------------------------------
// NAME: show_qam_chanl()
// ENTRY: void
// RETURN: void
// FUNCTION:显示8 通道 qam 设置菜单界面
// MODIFY DATE : 2004.1.28
//--------------------------------------------------------
void show_qam_chanl(unsigned char chanl)
{
switch( chanl )
{
case 1: //Q1
SHOW_LOGO(21);
break;
case 2: //Q2
SHOW_LOGO(39);
break;
case 3: //Q3
SHOW_LOGO(36);
break;
case 4: //Q4
SHOW_LOGO(1);
break;
case 5: //Q5
SHOW_LOGO(3);
break;
case 6: //Q6
SHOW_LOGO(16);
break;
case 7: //Q7
SHOW_LOGO(22);
break;
case 8: //Q8
SHOW_LOGO(23);
break;
default:
break;
}
}
//---------------------------------------------------------
// NAME: show_net_dat()
// ENTRY: *p,
// RETURN: void
// FUNCTION:显示网络设置数据参数
// MODIFY DATE : 2004.1.28
//--------------------------------------------------------
void show_net_dat(unsigned char *p)
{
unsigned char temp,flg;
flg = 0;
temp = (*p) / 100;
if(net_show)
flg = 1;
Disp_char_16_8(2, 2, temp + 0x30, flg);
flg = 0;
net_show = 0;
temp = (*p) % 100 / 10;
Disp_char_16_8(2, 10, temp + 0x30, 0);
temp = (*p) % 10;
Disp_char_16_8(2, 18, temp + 0x30, 0);
Disp_char_16_8(2,26,0x2e,0);
temp = *(p + 1) / 100;
Disp_char_16_8(2, 31, temp + 0x30, 0);
temp = *(p + 1) % 100 / 10;
Disp_char_16_8(2, 39, temp + 0x30, 0);
temp = *(p + 1) % 10;
Disp_char_16_8(2, 47, temp + 0x30, 0);
Disp_char_16_8(2, 55, 0x2e, 0);
temp = *(p + 2) / 100;
Disp_char_16_8(2, 61, temp + 0x30, 0);
temp = *(p+2)%100/10;
Disp_char_16_8(2, 69, temp + 0x30, 0);
temp = *(p + 2) % 10;
Disp_char_16_8(2, 77, temp + 0x30, 0);
Disp_char_16_8(2, 85, 0x2e, 0);
temp = *(p + 3) / 100;
Disp_char_16_8(2,90,temp+0x30,0);
temp = *(p + 3) % 100 / 10;
Disp_char_16_8(2, 98, temp + 0x30, 0);
temp = *(p + 3) % 10;
Disp_char_16_8(2, 106, temp + 0x30, 0);
}
//---------------------------------------------------------
// NAME: show_set_net()
// ENTRY: void
// RETURN: void
// FUNCTION:显示网络设置选择界面
// MODIFY DATE : 2004.1.28
//--------------------------------------------------------
void show_set_net(unsigned char option)
{
switch(option)
{
case 1:
LCD_CLR();
//disp_main_menu_Enet;
SHOW_ALL_HEAD(5);
show_net_dat(net_gatway);
break;
case 2:
LCD_CLR();
SHOW_ALL_HEAD(2);
show_net_dat(net_sub);
break;
case 3:
LCD_CLR();
SHOW_ALL_HEAD(3);
show_net_dat(net_lip);
break;
case 4:
LCD_CLR();
SHOW_ALL_HEAD(4);
show_net_dat(net_dip);
break;
default:
break;
}
}
//---------------------------------------------------------
// NAME: show_net_submenu()
// ENTRY: void
// RETURN: void
// FUNCTION:显示网络设置子网掩码
// MODIFY DATE : 2004.1.28
//--------------------------------------------------------
void show_net_submenu(void)
{
switch(ucMenuCurrentPosition)
{
case 1:
SHOW_LOGO(24);
break;
case 2:
SHOW_LOGO(25);
break;
case 3:
SHOW_LOGO(26);
break;
case 4:
SHOW_LOGO(30);
break;
default:
break;
}
}
//---------------------------------------------------------
// NAME: show_net_currsor()
// ENTRY: *p,
// RETURN: void
// FUNCTION:显示网络设置数据光标位
// MODIFY DATE : 2004.1.28
//--------------------------------------------------------
void show_net_currsor(unsigned char *p)
{
unsigned char temp, postion1, postion2;
postion1 = ucCurserPosition % 3;
postion2 = (ucCurserPosition - 1) / 3;
show_net_dat(p);
switch(postion1)
{
case 1:
temp=(*(p + postion2)) / 100;
switch(postion2)
{
case 0:
Disp_char_16_8(2, 2,temp + 0x30, 1);
break;
case 1:
Disp_char_16_8(2, 31, temp + 0x30, 1);
break;
case 2:
Disp_char_16_8(2, 61,temp + 0x30, 1);
break;
case 3:
Disp_char_16_8(2, 90, temp + 0x30, 1);
break;
default:
break;
}
break;
case 2:
temp=(*(p + postion2)) % 100 / 10;
switch(postion2)
{
case 0:
Disp_char_16_8(2, 10, temp + 0x30, 1);
break;
case 1:
Disp_char_16_8(2, 39, temp + 0x30, 1);
break;
case 2:
Disp_char_16_8(2, 69, temp + 0x30, 1);
break;
case 3:
Disp_char_16_8(2, 98, temp + 0x30, 1);
break;
default:
break;
}
break;
case 0:
temp=(*(p + postion2)) % 10;
switch(postion2)
{
case 0:
Disp_char_16_8(2, 18, temp + 0x30, 1);
break;
case 1:
Disp_char_16_8(2 ,47, temp + 0x30, 1);
break;
case 2:
Disp_char_16_8(2 ,77, temp + 0x30, 1);
break;
case 3:
Disp_char_16_8(2 ,106, temp + 0x30, 1);
break;
default:
break;
}
break;
default:
break;
}
}
//---------------------------------------------------------
// NAME: net_modify()
// ENTRY: void
// RETURN: void
// FUNCTION:显示网络设置数据位修改大小
// MODIFY DATE : 2004.1.28
//--------------------------------------------------------
void net_modify(unsigned char *p)
{
unsigned int dat;
unsigned char postion1,postion2;
unsigned char low,mid,high;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -