⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gdp.c

📁 UpsRS232数据信号转LCD 的原代码
💻 C
字号:
#include<reg52.h>
#define Busy 0x80
//#include <string.h>
#define uchar unsigned char
#define uint unsigned int
extern  void STARTUPH(void);
void com_feeback(void);
void send_string(const uchar *str_ptr,uchar n);

/**************位变量定义*****************/
bit f_receive,f_bat_low,f_bypass,f_shutdown,f_test,f_ac_ok,f_lcdlight,f_press;
bit f_fault,f_overload,f_bit5,f_bit7,f_bit8,f_stop,f_beep,f_com_ok;
bit fla_shutdown,fla_test,fla_stop,fla_beep,fla_com;
bit fla_keydown,fla_lcdlight;
/************计数变量定义区**************/
//uchar ps_code[8];
uchar freq_l,freq_h,bypass_l;
//uint  bypass_h;
uchar cnt_20,cnt_md,cnt_stop,cnt_10,cnt_flash;
//uchar cnt_1s,cnt_1ss,,cnt_actodc;
//uint cnt_lcdlight;
uint cnt_hz,cnt_hz_1;
uchar cnt_keydown,cnt_lcdisplay;

/**************uchar变量定义*************/

uchar rt;

/************数组***********************/


/**************uint变量定义*************/
uint line_10,inv_10,freq_10,thermal_10,load_10,bat_10,cnt_com,bat_v,bat_cap,cnt_lcdlight;
uchar re_buf[46];

uchar model;
uchar code  f_code3[21]=   {"#110.0 015 096.0 60.0"};
uchar code  f_code2[21]=   {"#110.0 010 096.0 60.0"};
uchar code  f_code1[21]=   {"#110.0 005 036.0 60.0"};

uchar   code  hp_1kval_8[8]={"HP 1KVA "};            //gai
uchar   code  hp_2kval_8[8]={"HP 2KVA "};
uchar   code  hp_3kval_8[8]={"HP 3KVA "};
//uchar   code  hp_1kval_8[8]={"   1K   "};
//uchar   code  hp_2kval_8[8]={"   2K   "};
//uchar   code  hp_3kval_8[8]={"   3K   "};

 //uchar code  sn_8[8]={"SENTRI-5"};
 uchar code  sn_8[8]=  {"MD050115"};                    //GAI

  uchar code  co_17[17]=  {"#GDP POWER CO.,  "};        //gai
//uchar code  co_17[17]=  {"#APLAB           "};
uchar code  i_code1[21]={"HP 1KVA    VER 2.0   "} ;     //gai
uchar code  i_code2[21]={"HP 2KVA    VER 2.0   "} ;
uchar code  i_code3[21]={"HP 3KVA    VER 2.0   "} ;

//uchar code  i_code1[21]={"SEN-5 1K   VER 2.0   "} ;
//uchar code  i_code2[21]={"SEN-5 2K   VER 2.0   "} ;
//uchar code  i_code3[21]={"SEN-5 3K   VER 2.0   "} ;
  /****************************************************************************/
uchar code USA_16[16]={"USA GDP POWER"};
uchar code ac_3[3]={"AC:"};
uchar code ok_4[4]={"OK  "};
uchar code loss_4[4]={"LOSS"};
uchar code bat_4[4]={"BAT:"};
uchar code low_3[3]={"LOW"};

//uchar code start_8[8]={"QUANJING"};
//uchar code keji_8[8]= {"KEJI UPS"};
uchar code start_8[8]= {"START..."};
uchar code keji_8[8]=  {"        "};

    
  //uchar code company_8[8]=  {"        "};
//uchar code company_8[8]=  {"CTRONIC "};


uchar code gdp_power_8[8]={"GDPPOWER"};             //gai
  //char code pan_power_8[8]={"  HITA  "};
uchar code company_8[8]={"SCI&TECH"};                //GAI
uchar code inner_8[8]={" INNER  "};
uchar code fault_8[8]={" FAULT! "};
uchar code self_8[8]={"  SELF  "};
uchar code testing_8[8]={"TESTING!"};
uchar code bypass_8[8]={" BYPASS "};
uchar code inverter_8[8]={"INVERTER"};
uchar code output_7[8]=  {"OUTPUT! "};
uchar code no_8[8]={"   NO   "};
uchar code input_8[8]= {" INPUT  "};
uchar code output_8[8]={" OUTPUT "};

uchar code power_8[8]={" POWER  "};
uchar code over_4[4]={"OVER"};
//uchar code black_4[4]={"    "};
uchar code battery_8[8]={"BATTERY "};
uchar code temper_6[6]={"TEMPER"};
uchar code vac_3[3]={"Vac"};
uchar code vdc_3[3]={"Vdc"};
uchar code hz_2[2]={"Hz"};

sbit bflag=ACC^7;
sbit P_bypass=P3^5;   //'0'有效
sbit P_beep=P3^2;      //0


sbit P_free1=P1^6;
sbit P_free2=P1^7;
//sbit P_free3=P3^4;
sbit P_led1=P1^4;
sbit P_led2=P1^5;
sbit RS=P2^7;
sbit RW=P2^6;
sbit P_stop=P3^6;
sbit P_lcdlight=P2^0;
sbit P_keydown=P3^7;
//sbit CS=P1^3;
sbit Elcm=P2^5;

/********延时1毫秒子程序设计*******/
void  bee_delay  (uint t)
    {uchar  Z;
      while(t--)
        {for(Z=0;Z<90;Z++)
          {;}
        }
     return;
    }
void _nop1_(void)
  {;
  }

void WaitForEnable( void )
{   do
	  {
	  P0 = 0xff;
	  RS =0;  //读状态寄存器或写命令寄存器 , 为‘1’时读写数据
          RW = 1; //读操作 。

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -