DOC

#include DSP28_Deviceh

By Veronica Kelley,2014-06-21 06:02
9 views 0
#include DSP28_DevicehDSP

#include "DSP28_Device.h"

#define comm 0

    #define dat 1

    extern Uchar8 curtime[7]; //当前时间存储

     Uchar8 mm1,mm2,mm3,mm4,mm5,mm6,mm7; //计算出单个时间

    

//extern Uchar8

    U[6][4]={{0x30,0x30,0x30,0x30},{0x30,0x30,0x30,0x30},{0x30,0

    x30,0x30,0x30},{0x30,0x30,0x30,0x30},{0x30,0x30,0x30,0x30},{0

    x30,0x30,0x30,0x30}};

    extern Uchar8 gzh_flg=0; //故障相标志

    //extern Uchar8 IN=0xb1;//0Xb1,0Xb2,0Xb3,0Xb4 malfunction

    phase

    //extern Uchar8 IP=0xb1;//故障相赋初值

extern Uchar8 IN=0x30;//0X31,0X32,0X33,0X34 故障相

    extern Uchar8 IP=0x41;//故障相赋初值

extern Uchar8 right_lift=1; //左右上下显示标志

    extern Uchar8 screen=1; //显示屏幕标志

//============================function==============

    =============//

    void chk_busy(); //判断LCD是否繁忙

    void wr_lcd(unsigned char dat_comm, Uchar8 content);//LCD void clear_screen(void); //LCD清屏

    void clrram (void); //LCD内部RAM

    void lcd_init(void); //LCD初始化

    void long_delay(void); //LCD用较长时间延时 void lcd_firt_show(void); //首次显示调用函数 void lcd_draw(Uint16 addr_x,Uint16 addr_y,unsigned char

    num);//LCD反白用 绘画

    主界面 void screen_1(void); //屏幕1 要与另张图表示对应 void screen_2(void); //查看界面

    void screen_3(void); //系统状态界面

    void screen_4(void); //系统状态界面

    void screen_5(void); //历史记录界面

    void screen_6(void); //历史记录界面

    void screen_7(void); //当前高阻界面

    void screen_8(void); //通讯 界面

    void screen_9(void); //设定 界面

    void screen_10(void); //设定时间界面

void screen_11(void); //设定通信参数界面

    void screen_12(void); //设定密码界面

    void screen_13(void); //设定工作方式界面

    void screen_14(void); //设定变比界面

    void screen_15(void); //设定选线参数界面

    void LCD_SHOW(void); //LCD显示用

    //============================function===========================//

    //==================LCD显示界面所对应的每一位

    ===========================//

    extern Uchar8

    screen_1_w[12]={0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30};//(OX30即对应"0")

     //0 0 0 0 0 0 0 0 0 0 0 0

    extern Uchar8

    screen_3_w[18]={0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30};

     //0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

    extern Uchar8

    screen_4_w[18]={0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30};

     //0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

    extern Uchar8

    screen_5_w[11]={0x31,0x41,0x31,0x30,0x38,0x31,0x30,0x31,0x31,0x32,0x30};

     // 1 A 1 0 8 1 0 1 1 2 0

    extern Uchar8

    screen_6_w[11]={0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30};

     // 0 0 0 0 0 0 0 0 0 0 0

    extern Uchar8

    screen_7_w[12]={0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30};

     // 0 0 0 0 0 0 0 0 0 0 0 0

    extern Uchar8

    screen_10_w[14]={0x32,0x30,0x30,0x38,0x31,0x31,0x32,0x30,0x3

0,0x30,0x30,0x30,0x30,0x30};

     // 2 0 0 8 1 1 2 0 0 0 0 0 0 0

    extern Uchar8 screen_11_w[5]={0x31,0x39,0x36,0x30,0x30};

     // 1 9 6 0 0

    extern Uchar8

    screen_12_w[12]={0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30};

     // 0 0 0 0 0 0 0 0 0 0 0 0

    extern Uchar8 screen_13_w[4]={0x31,0x30,0x30,0x32};

     // 1 0 0 2 extern Uchar8 screen_14_w[6]={0x30,0x31,0x30,0x30,0x31,0x30};

     // 0 1 0 0 1 0

    extern Uchar8

    screen_15_w[8]={0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30};

     //0 0 0 0 0 0 0 0

    //============================data-show===========================//

    void delay(unsigned int d_time)

{

     while(d_time--);

    }

    void chk_busy()

    {

     unsigned int temp;

     //LCD_REG = 0x06;//RS=0(comm), RW=1(read)

     Set_LCDRSET_Data;

     Set_LCDRW_Data;Clr_LCDRS_Data; // 110

     Set_LCD_CP_Data;

     Clr_LCD_CP_Data;

     temp = 0x0080;

     KickDog();

     while((temp&0x0080)!=0)

     {

     Set_LCDEN_Data;

    // KickDog();

     temp = LCD_DAT;

    // KickDog();

     }

     Clr_LCDEN_Data;

    }

    /*---------------WRITE LCD------------------*/ void wr_lcd(unsigned char dat_comm, Uchar8 content) {

     chk_busy();

     if(dat_comm)

     {

     //LCD_REG = 0x05;//RS=1(data), RW=0(write)

     Set_LCDRSET_Data;

     Clr_LCDRW_Data;Set_LCDRS_Data; //101

     Set_LCD_CP_Data;

     Clr_LCD_CP_Data;

     }

     else

     {

     //LCD_REG = 0x04;//RS=0(comm), RW=0(write) //100

     Set_LCDRSET_Data;

     Clr_LCDRW_Data;Clr_LCDRS_Data;

     Set_LCD_CP_Data;

     Clr_LCD_CP_Data;

     }

     Set_LCDEN_Data;

     LCD_DAT = content;

     Clr_LCDEN_Data;

    }

    void clear_screen(void)

{

     Uchar8 x,y;

     wr_lcd (comm,0x34);//use extern order;

     for(y=0; y<16; y++)

     {

     for(x=0; x<16; x++)

     {

     wr_lcd (comm,0x80+y); // write coordinate(y) to

    GDRAM

     wr_lcd (comm,0x80+x); // write coordinate(x) to

    GDRAM

     wr_lcd (dat,0x00); //clear screen

     wr_lcd (dat,0x00);

     wr_lcd (comm,0x90+y);

     wr_lcd (comm,0x80+x);

     wr_lcd (dat,0x00);

     wr_lcd (dat,0x00);

     }

     wr_lcd (comm,0x36); // plot open; extern order;choose

    eight bites data stream

    }

    }

/*----------------CLEAR DDRAM------------------*/

    void clrram (void)

    {

     wr_lcd (comm,0x30);

     wr_lcd (comm,0x01);

     clear_screen();///////zeng

    }

/*------------------INTT_LCD-----------------*/

    void lcd_init(void)

    {

     //LCD_REG = 0x03;//RESET

     Clr_LCDRSET_Data;

     Delay(1000);

     Set_LCDRW_Data;

     Set_LCDRS_Data; //011

     Set_LCD_CP_Data;

     Clr_LCD_CP_Data;

     delay(1000);

     //LCD_REG = 0x04;

     Set_LCDRSET_Data;

     Clr_LCDRW_Data;Clr_LCDRS_Data; //100

     Set_LCD_CP_Data;

     Clr_LCD_CP_Data;

     wr_lcd (comm,0x30); //30---basic order operate

     wr_lcd (comm,0x01); //clear screen,address pointer to 00h

     wr_lcd (comm,0x06); // cursor move direction ;cursor move right,the screen move right

     wr_lcd (comm,0x0c); // open display, close cursor

Report this document

For any questions or suggestions please email
cust-service@docsford.com