jxchen 发表于 2015-4-18 23:32:37

AVR EXTERNAL CLOCK 設定問題

本帖最后由 jxchen 于 2015-4-18 23:38 编辑

使用CVAVR 編譯,程式編譯皆正常,我接外部crystal,但燒錄fuse,依據data sheet use external clock must programmer cksel "0000",為何程式沒有跑起來
依據data sheet 配置外部震盪器,xtal2 pin 他是NC,我就不懂了,我的程式只有單純對 IO PORT 填 0 或 1,能否幫忙看看問題點出在那





#include <mega2560.h>
#include <delay.h>


// Declare your global variables here
                                                      
void main(void)
{

// Crystal Oscillator division factor: 1
#pragma optsize-
CLKPR=0x80;
CLKPR=0x00;
#ifdef _OPTIMIZE_SIZE_
#pragma optsize+
#endif

// Port H initialization
// Func7=In Func6=Out Func5=Out Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=0 State5=0 State4=T State3=T State2=T State1=T State0=T
PORTH=0x0;
DDRH=0xff;      //data direction register of port h
}
while (1)
      {
      // Place your code here
      
      PORTH=0x00;
      delay_ms(100);
      PORTH=0xff;
      delay_ms(100);
      };
}

jxchen 发表于 2015-4-21 22:35:15

我已經稿定了,是我會錯意
页: [1]
查看完整版本: AVR EXTERNAL CLOCK 設定問題