2021년 11월 11일 목요일

ATxmega clock Initialize the external crystal oscillator

  /*

Initialize the external crystal oscillator

*/

OSC_XOSCCTRL = OSC_XOSCSEL_XTAL_16KCLK_gc | OSC_FRQRANGE_12TO16_gc; 

OSC.CTRL |= OSC_XOSCEN_bm; 

while(!(OSC.STATUS & OSC_XOSCRDY_bm)); 

CCP = CCP_IOREG_gc; CLK.CTRL = CLK_SCLKSEL_XOSC_gc;



/*

Configure the output for the system clock

-> Port C.7

*/

PORTC.DIRSET = (0x01 << 0x07);

PORTCFG.CLKEVOUT |= PORTCFG_CLKOUT_PC7_gc;

댓글 없음:

댓글 쓰기