12864 show images

Source: Internet
Author: User
Tags 0xc0
/*************************************** ***************************************
Function Introduction: The program driver 12864 displays a pair of images.

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

Implemented using the modulo Software


# Include <reg51.h>
# Include <intrins. h>


# Define uchar unsigned char
# Define uint unsigned int
/* 12864 port definition */
# Define LCD _data P0 // data port
Sbit LCD _rs = P3 ^ 5; // register selection Input
Sbit LCD _rw = P3 ^ 6; // LCD read/write control
Sbit LCD _en = P3 ^ 4; // LCD enabling control
Sbit LCD _psb = P3 ^ 7; // string/parallel control
Sbit wela = P2 ^ 6;
Sbit Dula = P2 ^ 7;


Unsigned char code Zhu [] = // Image Code
{
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x05, 0xae, 0x90, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0 x, 0 x, 0x80, 0 x, 0 x, 0 x, 0x00, 0x2b, 0x55, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0xa8, 0 x, 0x15, 0x20, 0 x, 0 x, 0 x, 0x97, 0xfb, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0x45, 0x55, 0x08, 0xa0, 0 x, 0 x, 0x00, 0x0a, 0x6f, 0xf4, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0xb2, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00, 0xba, 0xe0, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0x4d, 0x55,0x15,0x15,0x20,0x00,0x00,0x95, 0xd5, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xff, 0xe8, 0x40,0x40,0x00,0x00,0x00, 0x4a, 0xaa, 0x80 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xff, 0xff, 0x2a, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0xff, 0xfd, 0xd0, 0xaa, 0x01,0 X, 0 x, 0x25, 0x20, 0x10, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0xff, 0xff, 0xb6, 0 x, 0x10, 0 x, 0x01, 0x4a, 0x49,0 X, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0xff, 0xff, 0xfd, 0xe8, 0x50, 0 x, 0 x, 0 x, 0x24, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00,
0xab, 0xff, 0xff, 0x55, 0 x, 0 x, 0 x, 0 x, 0x49, 0x5e, 0xa0, 0 x, 0 x, 0 x, 0 x, 0x00,
0x84, 0xbf, 0xff, 0xf4, 0x88,0 X, 0 x, 0 x, 0 x, 0x05, 0xff, 0xf4, 0 x, 0 x, 0 x, 0x00,
0x29, 0x0b, 0xff, 0xfa, 0x20, 0x00,0x00,0x00,0x02, 0xbf, 0xff, 0xfc, 0x00,0x00,0x00,0x00,0x00,
0x44, 0xa0, 0x57, 0xfd, 0x80, 0 x, 0 x, 0 x, 0x08, 0x5f, 0xff, 0xff, 0x80, 0 x, 0 x, 0x00, 0x00,
0x91, 0x0a, 0xaa, 0xf6, 0x50,0x00,0x00,0x00,0X41, 0xff, 0xff, 0xff, 0xc0, 0x00,0x00,0x00,
0x44, 0xa0, 0x01, 0x1b, 0 x, 0 x, 0 x, 0x26, 0xff, 0xff, 0xff, 0x90, 0 x, 0 x, 0 x, 0x00,
0x11, 0x0a, 0xaa, 0x6d, 0x68,0x00,0x00,0x00, 0x0b, 0xfb, 0xff, 0xef, 0xe0, 0x00,0x00,0x00,
0xc4, 0xa0, 0x01,0x02,0x82,0x00,0x00,0x00,0X43, 0xf1, 0xfe, 0x63, 0xf0, 0x00,0x00,0x00,
0x15,0x55,0x54,0x55, 0x6a, 0x00,0x00,0x00, 0x9f, 0xe3, 0xfc, 0x87,0x38,0x00,0x00,0x00,
0xca, 0xab, 0x91,0x00,0x90,0x00,0x00,0x00,0x07, 0xc1, 0xfa, 0x2a, 0x80 ,0x00,0x00,0x00,0x00,
0x25, 0xff, 0xfe, 0x95, 0x2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0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xff, 0xf0, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};


# Define delaynop (); {_ NOP _();};


Void delay0 (uchar X); // x * 0.14 Ms
Void BEEP ();
Void dataconv ();
Void LCD _pos (uchar X, uchar y); // determine the display position


Void delay (ms int)
{
While (MS --)
{
Uchar I;
For (I = 0; I <250; I ++)
{
_ NOP _();
_ NOP _();
_ NOP _();
_ NOP _();
}
}
}


/*************************************** ****************************/
/**/
/* Check the LCD busy status */
/* When LCD _busy is 1, it is busy. Wait. When LCD-busy is 0, it is idle and can write commands and data. */
/**/
/*************************************** ****************************/
Bit LCD _busy ()
{
Bit result;
LCD _rs = 0;
LCD _rw = 1;
LCD _en = 1;
Delaynop ();
Result = (BIT) (P0 & 0x80 );
LCD _en = 0;
Return (result );
}
/*************************************** ****************************/
/**/
/* Write command data to LCD */
/* Rs = L, RW = L, E = high pulse, D0-D7 = instruction code. */
/**/
/*************************************** ****************************/
Void LCD _wcmd (uchar cmd)
{
While (LCD _busy ());
LCD _rs = 0;
LCD _rw = 0;
LCD _en = 0;
_ NOP _();
_ NOP _();
P0 = cmd;
Delaynop ();
LCD _en = 1;
Delaynop ();
LCD _en = 0;
}
/*************************************** ****************************/
/**/
/* Write the display data to the LCD */
/* Rs = H, RW = L, E = high pulse, D0-D7 = data. */
/**/
/*************************************** ****************************/
Void LCD _wdat (uchar dat)
{
While (LCD _busy ());
LCD _rs = 1;
LCD _rw = 0;
LCD _en = 0;
P0 = dat;
Delaynop ();
LCD _en = 1;
Delaynop ();
LCD _en = 0;
}
/*************************************** ****************************/
/**/
/* LCD initialization settings */
/**/
/*************************************** ****************************/
Void LCD _init ()
{


LCD _psb = 1; // parallel port Mode

LCD _wcmd (0x34); // extended command operation
Delay (5 );
LCD _wcmd (0x30); // basic command operation
Delay (5 );
LCD _wcmd (0x0c); // display on, close the cursor
Delay (5 );
LCD _wcmd (0x01); // clear the LCD display content
Delay (5 );
}


/*************************************** ****
Function Name: draw_pm
Function: drawing on the entire LCD screen
Parameter count: None
Return Value: None
**************************************** ****/
Void draw_pm (const uchar * PTR)
{
Uchar I, J, K;
Wela = 0;
Dula = 0;
LCD _wcmd (0x34); // enable the Extended Instruction Set
I = 0x80;
For (j = 0; j <32; j ++)
{
LCD _wcmd (I ++ );
LCD _wcmd (0x80 );
For (k = 0; k <16; k ++)
{
LCD _wdat (* PTR ++ );
}
}
I = 0x80;
For (j = 0; j <32; j ++)
{
LCD _wcmd (I ++ );
LCD _wcmd (0x88 );
For (k = 0; k <16; k ++)
{
LCD _wdat (* PTR ++ );
}
}
LCD _wcmd (0x36); // open the drawing display.
LCD _wcmd (0x30); // return to the basic instruction set
}


Main ()
{
Wela = 0;
Dula = 0;
LCD _init (); // initialize the LCD
Draw_pm (Zhu); // display pictures of cute pig
While (1 );
}

12864 show images

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.