版主
主题
回帖0
积分34308
阅读权限200
注册时间2008-11-22
最后登录1970-1-1
在线时间 小时
|
楼主 |
发表于 2009-2-9 20:47
|
显示全部楼层
<P>原帖由 <I>g54188</I> 于 2009-2-9 10:23 发表 <A href="https://www.yleee.com.cn/redirect.php?goto=findpost&pid=3522&ptid=369" target=_blank><IMG alt="" src="https://www.yleee.com.cn/images/common/back.gif" border=0></A> LZ你好,我也是在沈老师那里买的这个屏,用你的程序和你画的接线,屏很闪,好象字是重叠起的样,用24M晶振比用12M晶振厉害,不知道那里有问题,望LZ指教,谢谢!!! delay_nms(1); //此处延时,请根据点阵闪烁状况加以调 ... </P>
<P> </P>
<P>我的12M就眼睛看感觉也不怎么闪,没有重叠的情况 。相机拍就闪起来很厉害了。</P>
<P><BR>程序里调用的是 delay_nms(1);</P>
<P> </P>
<P>实际上并不是1ms,名字懒得改了,</P>
<P> </P>
<P><FONT color=magenta size=5>12M</FONT>内容是。</P>
<P> </P>
<P>void delay_nms(unsigned int count)<BR>{<BR> unsigned int i,j;<BR> for(i=0;i<count;i++)<BR> for(j=0;j<<FONT color=red>45</FONT>;j++); <BR>}</P>
<P> </P>
<P> </P>
<P><FONT color=magenta size=5>24M</FONT>的是</P>
<P> </P>
<P>void delay_nms(unsigned int count)<BR>{<BR> unsigned int i,j;<BR> for(i=0;i<count;i++)<BR> for(j=0;j<<FONT color=red>270</FONT>;j++); <BR>}</P>
<P> </P>
<P> </P>
<P>另,自己试验过了。在24M下会出现温度显示16.0°C的情况,原因为某个数取值大于<FONT color=teal>unsigned char</FONT> 的最大值256,导致延时不足。</P>
<P> </P>
<P><STRONG>解决方法:</STRONG></P>
<P><FONT color=magenta size=5>24M</FONT>情况下,<FONT color=teal>ds18B20.h</FONT>中的<FONT color=teal>delay函数</FONT>改成如下就没问题了。</P>
<P> </P>
<P>void delay(unsigned char i) //(2*i+3) us<BR>{ </P>
<P> unsigned char j=i;<BR> while(--j);<BR> while(--i); <BR>} </P>
<P> </P>
<P> </P>
<P> </P>
[ 本帖最后由 litchiate 于 2009-2-9 20:50 编辑 ] |
|