TXT

ai.txt

By Marilyn Henderson,2014-06-18 19:41
11 views 0
ai.txt

#include

    #include

    #include"stdio.h"

    #include"absacc.h"

    #define uchar unsigned char

    #define uint unsigned int

    #define data_8 P0

    sbit STB=P3^6;

    sbit BUSY=P2^7;

    sbit AllControl=P1^7;

    sbit Printer=P0^1;

    /**************************************************/ //ºº×ÖÄÚÂë

    uchar code

    table1[]={0xcb,0xae,0xc8,0xdc,0xd0,0xd4,0xcb,0xe1};//Ë?ÈÜÐÔËá uchar code

    table2[]={0xd1,0xf9,0xc6,0xb7,0xb2,0xe2,0xca,0xd4,0xbd,0xe1,0xb9,0xfb};//ÑùÆ??âÊÔ?á?û

    uchar code table3[]={0xd0,0xf2,0x20,0xba,0xc5,0xa3,0xba};//ÐòºÅ: uchar code table4[]={0xc8,0xd5,0x20,0xc6,0xda,0xa3,0xba};//ÈÕÆÚ: uchar code table5[]={0xca,0xb1,0x20,0xbc,0xe4,0xa3,0xba};//Ê??ä: uchar code table6[]={0xb1,0xb8,0x20,0xd7,0xa2,0xa3,0xba};//??×?: uchar code tables[]={0x50,0x48,0x20,0xd6,0xb5,0xa3,0xba};//PH Öµ?º uchar code table7[]="****";

    uchar code tabletime[6]={0xc4,0xea,0xd4,0xc2,0xc8,0xd5};//Äê ÔÂÈÕ uchar code

    digit[10]={0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39};//0~9

    uchar colon=0x3a;

    uchar dot=0x2e;

    /************************************************/

    /////////////*****************************////////////// //ÑÓÊ?º?Êý

    void delay(uchar s)

    {

     uchar j,k;

     for(j=110;j>0;j--)

     for(k=s;k>0;k--);

    }

/************************************************/

    void SEND_BYTE(uchar InData)

    {

     while(BUSY);

     data_8=InData;

     STB=0;

     _nop_();

     _nop_();

     _nop_();

     STB=1;

    // BUSY=1;

    }

     void SEND_2BYTE(uchar Data1,uchar Data2)

     {

     SEND_BYTE(Data1);

     SEND_BYTE(Data2);

     }

    /******************************************************/

    //?òÓ?ÃüÁîº?Êý

    void enter_hanzimode(void) //?øÈ뺺×ÖÄ?Ê? {

     SEND_2BYTE(0x1c,0x26);

    }

    void change_row(void)//??ÐÐ

    {

     delay(30);

     SEND_BYTE(0x0d);

    }

    void print_space_nullstring(uchar m,uchar n)//m=0x00,?òÓ?n?Õ?ñ??nÔÚÐÐ?íÖ?ÄÚ??m=0x01???òÓ?n?ÕÐÐ??n=0~255

    {

     SEND_BYTE(0x1b);

     SEND_BYTE(0x66);

     SEND_BYTE(m);

     SEND_BYTE(n);

    }

    void horizontal_vertical_magnify(uchar n) //ºáÏò×ÝÏò?Å?ón?? n=1~8

    {

     SEND_BYTE(0x1b);

     SEND_BYTE(0x57);

     SEND_BYTE(n);

    }

/******************************************************/

    void SEND_nBYTE(uchar n,uchar *nData)

     {

     while(n--)

     {

     SEND_BYTE(*nData++);

     delay(100);

     }

     }

     /****************/

    //º?ÊýÃû?Æ?ºInit_Print //Èë?Ú?ÎÊý?ºÎÞ

    //??ÄÜÃèÊö?º?òÓ??ú?õÊ??? /*******************************************************/

    void Init_Print(void) {

     BUSY=1;

     STB=1;

     SEND_BYTE(0x1b);

     SEND_BYTE(0x40);

    }

    /******************************************************/

    void Print_String(uchar *String) //?òÓ?×Ö?û??ºó?Ø?µ

    { uchar CH;

     for (;;) {

     CH=*String;

     if (CH==0)

     {

     // SEND_BYTE(0x0d);

     break;

     }

     SEND_BYTE(CH);

     String++;

     }

     //SEND_BYTE(0x0d);//??ÐÐ }

    /******************************************************/

    // º?ÊýÃû: Print_Sample_result // ?ÎÊý ?ºÎÞ

    // ÃèÊö?º?òÓ?ÄÚÈÝ?üÀ? // Ë?ÈÜÐÔËá

    // ****ÑùÆ??âÊÔ?á?û**** // ÐòºÅ?º37

    // ÈÕÆÚ?º2010Äê10ÔÂ26ÈÕ // Ê??ä?º16:45

    // PHÖµ?º3.8

    //

    // ??×??º

/******************************************************/

    //º?ÊýÃû?Æ?ºmain

    //Èë?Ú?ÎÊý?ºÎÞ

    //??ÄÜÃèÊö?º?òÓ??âÊÔ?á?û

    /******************************************************/

    void main(void)

    {

     AllControl=1; //Ê?ÄÜ?òÓ??ú

     delay(1);

     Printer=0;;

     delay(1);

     AllControl=0;

     Init_Print(); // ?õÊ???

     print_space_nullstring(0x01,0x60);

     horizontal_vertical_magnify(0x02); //?Å?óÐèÔÚ?øÈ뺺×ÖÄ?Ê?Ö?Ç?ÉèÖÃ

     enter_hanzimode(); //?øÈ뺺×ÖÄ?Ê?

     SEND_nBYTE(7,table6);//?òÓ????? ×?:??

     change_row();

     SEND_nBYTE(7,tables);//?òÓ???PH Öµ:??

     SEND_BYTE(digit[3]);

     SEND_BYTE(dot);

     SEND_BYTE(digit[8]);

     change_row();

     SEND_nBYTE(7,table5);//?òÓ???Ê? ?ä?º??

     SEND_2BYTE(digit[1],digit[7]);

     SEND_BYTE(colon);

     SEND_2BYTE(digit[0],digit[9]);

     change_row();

     SEND_nBYTE(7,table4);//?òÓ???ÈÕ ÆÚ?º??

     SEND_2BYTE(digit[2],digit[0]);

     SEND_2BYTE(digit[1],digit[0]);

     SEND_2BYTE(tabletime[0],tabletime[1]);

     SEND_2BYTE(digit[1],digit[0]);

     SEND_2BYTE(tabletime[2],tabletime[3]);

     SEND_2BYTE(digit[2],digit[9]);

     SEND_2BYTE(tabletime[4],tabletime[5]);

     change_row();

     SEND_nBYTE(7,table3);//?òÓ???Ðò ºÅ?º??

     SEND_2BYTE(digit[3],digit[7]);

     change_row();

     Print_String(table7);//?òÓ???****ÑùÆ??âÊÔ?á?û****??

     SEND_nBYTE(12,table2);

     Print_String(table7);

     change_row();

     SEND_BYTE(0x20); //?òÓ?6?ö?Õ?ñ

     SEND_BYTE(0x20);

     SEND_BYTE(0x20);

     SEND_BYTE(0x20);

     SEND_BYTE(0x20);

     SEND_BYTE(0x20);

     SEND_nBYTE(8,table1); //?òÓ???Ë?ÈÜÐÔËá??

     change_row();

     change_row();

     change_row();

     change_row();

     change_row();

     while(1);

    }

Report this document

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