標(biāo)題: 一個(gè)簡(jiǎn)單的流水燈程序仿真不亮 [打印本頁(yè)]

作者: dzh2800    時(shí)間: 2014-11-5 16:06
標(biāo)題: 一個(gè)簡(jiǎn)單的流水燈程序仿真不亮
晶振用內(nèi)部8MHz,仿真是二極管不亮
#include<iom16.h>
#define uchar unsigned char
#define uint unsigned int
void delay_ms(uint k)
{
uint i,j;
for(i=0;i<k;i++)
  {
   for(j=0;j<570;j++)
   ;
  }
}
void main(void)
{
DDRA=0x00;
PORTA=0xff;//
  while(1)
  {
   PORTA=0xaa;


   delay_ms(500);
   PORTA=0x55;
   delay_ms(500);
  }


QQ截圖20141105145132.png (12.8 KB, 下載次數(shù): 181)

QQ截圖20141105145132.png

作者: mqwu    時(shí)間: 2014-11-6 11:52
你沒有禁止analog input; 加這句
ADMUX=0x1E 或者 ADMUX=0x1F //disable the Analog input for PORTA,
你若用其他的I/O PORT就沒有這個(gè)問(wèn)題
作者: liaolinhui    時(shí)間: 2014-11-13 01:07
DDRA=0x00;是將PA設(shè)為輸入,為輸入怎么還會(huì)亮呢,應(yīng)該改為0xff




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1