Basic Clock Module Operation
4-12
Basic Clock Module
Sourcing MCLK from a Crystal
After a PUC, the basic clock module uses DCOCLK for MCLK. If required,
MCLK may be sourced from LFXT1 or XT2.
The sequence to switch the MCLK source from the DCO clock to the crystal
clock (LFXT1CLK or XT2CLK) is:
1) Switch on the crystal oscillator
2) Clear the OFIFG flag
3) Wait at least 50 µs
4) Test OFIFG, and repeat steps 1-4 until OFIFG remains cleared.
; Select LFXT1 (HF mode) for MCLK
BIC #OSCOFF,SR ; Turn on osc.
BIS.B #XTS,BCSCTL1 ; HF mode
L1 BIC.B #OFIFG,&IFG1 ; Clear OFIFG
MOV #0FFh,R15 ; Delay
L2 DEC R15 ;
JNZ L2 ;
BIT.B #OFIFG,&IFG1 ; Re−test OFIFG
JNZ L1 ; Repeat test if needed
BIS.B #SELM1+SELM0,&BCSCTL2 ; Select LFXT1CLK