51单片机用ADC0809转换后用LCD1602显示错误 输出电压没有规律的跳变 10
用51单片机想在AD0809转换后用LCD1602显示出来AD输出接P3口ST与ALE接p1.2OE接p1.0EOC接p1.1CLK接p1.3ADDABC分别接1.41....
用51单片机 想在AD0809转换后用LCD1602显示出来 AD输出接P3口 ST与ALE接p1.2 OE接p1.0 EOC接p1.1 CLK接p1.3 ADDA B C分别接1.4 1.5 1.6 用IN3口输入电压 LCD接P0口 还没有接电压显示屏上就一直跳数 这是什么原因 程序应该怎么改啊 LCD程序是对的 主函数里注释了AD()输出正常 大神们救我啊
#include<reg51.h>
#include"lcd.h"
#include<math.h>
unsigned char table1[]=" The voltage is: ";
unsigned char getdata;
sbit OE = P1^0;
sbit EOC = P1^1;
sbit ST = P1^2;
sbit CLK = P1^3;
unsigned int temp;
void TimeInit()
{
TMOD = 0x02;
TH0 = 216;
TL0 = 216;
IE = 0x82;
TR0 = 1;
P1 = 0x3f;
}
void AD(void)
{
ST = 0;
ST = 1;
ST = 0;
OE = 0;
Lcd1602_Delay1ms(1);
while(EOC==0);
OE = 1;
getdata = P3;
OE = 0;
}
void main()
{
unsigned char k,bai,shi,ge;
unsigned int i;
LcdInit();
TimeInit();
while(1)
{
AD();
LcdWriteCom(0x80);
for(i=0;i<16;i++)
{
LcdWriteData(table1);
}
temp = getdata*1.0/255*500;
bai=temp/100;
shi=temp%100/10;
ge=temp%10;
LcdWriteCom(0x80+0x40+6);
LcdWriteData(bai+0x30);
LcdWriteData(0x2e);
LcdWriteData(shi+0x30);
LcdWriteData(ge+0x30);
LcdWriteData('V');
Lcd1602_Delay1ms(50);
}
}
void Timer0_INT() interrupt 1
{
CLK = !CLK;
} 展开
#include<reg51.h>
#include"lcd.h"
#include<math.h>
unsigned char table1[]=" The voltage is: ";
unsigned char getdata;
sbit OE = P1^0;
sbit EOC = P1^1;
sbit ST = P1^2;
sbit CLK = P1^3;
unsigned int temp;
void TimeInit()
{
TMOD = 0x02;
TH0 = 216;
TL0 = 216;
IE = 0x82;
TR0 = 1;
P1 = 0x3f;
}
void AD(void)
{
ST = 0;
ST = 1;
ST = 0;
OE = 0;
Lcd1602_Delay1ms(1);
while(EOC==0);
OE = 1;
getdata = P3;
OE = 0;
}
void main()
{
unsigned char k,bai,shi,ge;
unsigned int i;
LcdInit();
TimeInit();
while(1)
{
AD();
LcdWriteCom(0x80);
for(i=0;i<16;i++)
{
LcdWriteData(table1);
}
temp = getdata*1.0/255*500;
bai=temp/100;
shi=temp%100/10;
ge=temp%10;
LcdWriteCom(0x80+0x40+6);
LcdWriteData(bai+0x30);
LcdWriteData(0x2e);
LcdWriteData(shi+0x30);
LcdWriteData(ge+0x30);
LcdWriteData('V');
Lcd1602_Delay1ms(50);
}
}
void Timer0_INT() interrupt 1
{
CLK = !CLK;
} 展开
2个回答
2016-07-23
展开全部
在你的模板目录下新建一个模板文件rss_php.htm
内容为
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title><![CDATA[{dede:global.cfg_webname/}]]></title>
<link>{dede:global.cfg_basehost/}</link>
<description>{dede:global.cfg_description/}</description>
<language>zh-cn</language>
<generator><![CDATA[{dede:global.cfg_webname/}]]></generator>
<webmaster>binxl@126.com</webmaster>
{dede:arclist row='1000' titlelen='100' orderby='pubdate'}
<item>
<title><![CDATA[[field:title/]]]></title>
<link>[field:arcurl/]</link>
<description><![CDATA[[field:description function='html2text(@me)'/]]]></description> <pubDate>[field:pubdate function='strftime("%a, %d %b %Y %H:%M:%S +0800",@me)'/]</pubDate>
<category><![CDATA[[field:typename/]]]></category>
<author><![CDATA[[field:writer/]]]></author>
</item>
{/dede:arclist}</channel>
</rss>
内容为
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title><![CDATA[{dede:global.cfg_webname/}]]></title>
<link>{dede:global.cfg_basehost/}</link>
<description>{dede:global.cfg_description/}</description>
<language>zh-cn</language>
<generator><![CDATA[{dede:global.cfg_webname/}]]></generator>
<webmaster>binxl@126.com</webmaster>
{dede:arclist row='1000' titlelen='100' orderby='pubdate'}
<item>
<title><![CDATA[[field:title/]]]></title>
<link>[field:arcurl/]</link>
<description><![CDATA[[field:description function='html2text(@me)'/]]]></description> <pubDate>[field:pubdate function='strftime("%a, %d %b %Y %H:%M:%S +0800",@me)'/]</pubDate>
<category><![CDATA[[field:typename/]]]></category>
<author><![CDATA[[field:writer/]]]></author>
</item>
{/dede:arclist}</channel>
</rss>
追问
这是什么...已经解决了 不过用电压源给一个电压示数偏差好大 怎么提高精准度啊
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询