Based on 51 single-chip LCD display 0 to 5V voltag
2016-08-23
0 0 0
no vote
Other
Earn points
#include
#define uchar unsigned char
#define uint unsigned intuchar dispbuf[]={0,0,0,0,0,0,0,0,0};
uchar code L1[]="Current Voltage:";
uchar code L2[]=".v";
uchar code L3[]="HongZhi";
uchar getdata,m,n;
uint temp;sbit ST=P3^0;
sbit OE=P3^1;
sbit EOC=P3^2;
sbit CLK=P3^3;sbit RS=P2^5;
sbit RW=P2^6;
sbit E=P2^7;void delay(uint n)
{
uint x,y;
for(x=n;x>0;x--)
for(y=110;y>0;y--);
}
Void wcom (UCHAR com)//write command
{
RS=0;
RW=0;
P1=com;
delay(5);
E=1;
E=0;
}
Void wdat (UCHAR dat)//write data
{
RS=1;
RW=0;
P1=dat;
delay(5);
E=1;
E=0;
}
void LCD_init()
{
wcom(0x38);
wcom(0x0c);
wcom(0x06);
wcom(0x01);
}void main(void)
{
uchar *ptr;
ptr=&dispbuf;
LCD_init();
ST=0;
OE=0;
ET0=1;
EA=1;
TMOD=0x02;
TH
#define uchar unsigned char
#define uint unsigned intuchar dispbuf[]={0,0,0,0,0,0,0,0,0};
uchar code L1[]="Current Voltage:";
uchar code L2[]=".v";
uchar code L3[]="HongZhi";
uchar getdata,m,n;
uint temp;sbit ST=P3^0;
sbit OE=P3^1;
sbit EOC=P3^2;
sbit CLK=P3^3;sbit RS=P2^5;
sbit RW=P2^6;
sbit E=P2^7;void delay(uint n)
{
uint x,y;
for(x=n;x>0;x--)
for(y=110;y>0;y--);
}
Void wcom (UCHAR com)//write command
{
RS=0;
RW=0;
P1=com;
delay(5);
E=1;
E=0;
}
Void wdat (UCHAR dat)//write data
{
RS=1;
RW=0;
P1=dat;
delay(5);
E=1;
E=0;
}
void LCD_init()
{
wcom(0x38);
wcom(0x0c);
wcom(0x06);
wcom(0x01);
}void main(void)
{
uchar *ptr;
ptr=&dispbuf;
LCD_init();
ST=0;
OE=0;
ET0=1;
EA=1;
TMOD=0x02;
TH
c
单片机
lcd
基于
显示
电压表
Related Source Codes
PClite
0
0
no vote
generic embeded FTP Client
0
0
no vote
UDP Test Demo
0
0
no vote
TMS320F28335 DSP transmits data to EEPROM through
0
0
no vote
TMS320F28335 CAN communication source code
0
0
no vote
No comment