This repository has been archived on 2024-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
justhomework/MCU/MCU_REAL _FINAL/draw.c

138 lines
No EOL
1.9 KiB
C

#include "img.h"
#include "display.h"
#include "draw.h"
#include <reg52.h>
sbit RS = P2 ^ 0;
sbit RW = P2 ^ 1;
sbit E = P2 ^ 2;
sbit CSA = P2 ^ 4;
sbit CSB = P2 ^ 5;
void drawNUMBER()
{
unsigned int j;
for(j =0 ; j < 64; j++)
{
CSA = 1;
CSB = 0;
RS = 0;
RW = 0;
P1 = 0xb8 + 2;
write();
P1 = 0X40 + j;
write(); //Ò³2ÁÐjÆÁA
RS = 1;
RW = 0;
P1 = NUMBER_PAGE0[j - 1];
write();
RS = 0;
RW = 0;
P1 = 0xb8 + 3;
write();
P1 = 0X40 + j;
write(); //Ò³3ÁÐjÆÁA
RS = 1;
RW = 0;
P1 = NUMBER_PAGE1[j - 1];
write();
}
for(j =0 ; j < 16; j++)
{
CSA = 0;
CSB = 1;
RS = 0;
RW = 0;
P1 = 0xb8 + 2;
write();
P1 = 0X40 + j;
write(); //Ò³2ÁÐjÆÁB
RS = 1;
RW = 0;
P1 = NUMBER_RPAGE0[j - 1];
write();
RS = 0;
RW = 0;
P1 = 0xb8 + 3;
write();
P1 = 0X40 + j;
write(); //Ò³3ÁÐjÆÁB
RS = 1;
RW = 0;
P1 = NUMBER_RPAGE1[j - 1];
write();
}
}
void drawNAME()
{
unsigned int j;
for(j = 0; j < 48; j++)
{
CSA = 1;
CSB = 0;
RS = 0;
RW = 0;
P1 = 0xb8 + 0;
write();
P1 = 0X40 + j;
write(); //Ò³0ÁÐjÆÁA
RS = 1;
RW = 0;
P1 = NAME_PAGE0[j - 1];
write();
RS = 0;
RW = 0;
P1 = 0xb8 + 1;
write();
P1 = 0X40 + j;
write(); //Ò³1ÁÐjÆÁA
RS = 1;
RW = 0;
P1 = NAME_PAGE1[j - 1];
write();
}
}
void drawFullIMG(unsigned char img[])
{
unsigned int j,i;
for(j = 0; j < 64; j++)
for(i=0;i<8;i++)
{
CSA = 1;
CSB = 0;
RS = 0;
RW = 0;
P1 = 0xb8 + i;
write();
P1 = 0X40 + j;
write(); //Ò³iÁÐjÆÁA
RS = 1;
RW = 0;
P1 = img[j - 1];
write();
}
}