fx8125 发表于 2013-8-19 22:38:11

我的LED灯都会亮然而我做的例题是马老师书的demo10-1

本帖最后由 fx8125 于 2013-8-20 15:41 编辑

#include <mega48.h>
void main(void)
{
    DDRD.6 = 1;
    PORTD.6 = 1;
   
    ACSR = 0x40;
   
    while (ACO)
    {
      if (ACO)
            PORTD.6 = 0;
      else
            PORTD.6 = 1;
    }
}
请各位高手帮我看看我看马老师书,可是我用48不是16,IF那边ACSR.5不能用,所以我用ACO。
外部都改成跟马老师一样,只是他还是永远亮就算我调超过片内基准电压1.22超过很多。
如果有用马老师书的人请帮我看看.

guew 发表于 2013-8-19 22:51:02

本帖最后由 guew 于 2013-8-19 22:54 编辑

你是来自外国的留学生吗?

fx8125 发表于 2013-8-19 23:04:51

对阿我是来自外国留学生

guew 发表于 2013-8-20 01:18:28

to replace the ‘ACO‘ in while with ’1‘,and ‘ACO’ in if with‘(ACSR >> 5)&0x01’.

guew 发表于 2013-8-20 01:26:54

本帖最后由 guew 于 2013-8-20 01:40 编辑

Since the bit of ACO is macro defined by 5 in the header file which comes with CVAVR. Upon what you done in the coding, the program sucks in the if statement forever, which explains led nonresponding.

fx8125 发表于 2013-8-20 01:40:41

thanks you

guew 发表于 2013-8-20 01:44:15

where are you from, Pakistan?

guew 发表于 2013-8-20 01:49:49

wait, more likely from non-english speaking country.

sunliezhi 发表于 2013-8-20 07:07:35

fx8125 发表于 2013-8-20 01:40 static/image/common/back.gif
thanks you

thanks you?   谢死你 ?   {:lol:}

alias 发表于 2013-8-20 07:23:02

>>the program sucks in the if statement forever,

文法上: the program stuck in the if statement forever...

(动词verb): stick, sticks, sticking, stuck

用 sucks 也可,不过表达的意思大为不同,且须改为:

the program sucks (running | executing | looping | circulating) in the if statement forever.


tim 发表于 2013-8-20 07:46:37

guew 发表于 2013-8-20 01:49 static/image/common/back.gif
wait, more likely from non-english speaking country.

来自一个文字中不使用标点符号的国家{:titter:}
页: [1]
查看完整版本: 我的LED灯都会亮然而我做的例题是马老师书的demo10-1