Not applicable
Sep 06, 2013
02:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 06, 2013
02:18 AM
How you ever wonder how to use the analog comparator in XMC1200/XMC1300?
One of the application is use it as oscillator circuit.
The attached image show the 32.76kHz external oscillator circuit.
The comparator in the circuit can be replace with the on-chip comparator by connecting (+) and (-) to the comparator input pin ACMPx.INP and ACMPx.INN and the output from the comparator will be from ACMPx.OUT.
For the schematic below, P2.9 is used as ACMP0.INP, P2.8 is used as ACMP0.INN and P0.10 is used as ACMP0.OUT.
Then, by initialized the analog comparator and the port pin, a stable clock will be available at ACMP0.OUT.
One of the application is use it as oscillator circuit.
The attached image show the 32.76kHz external oscillator circuit.
The comparator in the circuit can be replace with the on-chip comparator by connecting (+) and (-) to the comparator input pin ACMPx.INP and ACMPx.INN and the output from the comparator will be from ACMPx.OUT.
For the schematic below, P2.9 is used as ACMP0.INP, P2.8 is used as ACMP0.INN and P0.10 is used as ACMP0.OUT.
Then, by initialized the analog comparator and the port pin, a stable clock will be available at ACMP0.OUT.
void ACMP0_Init(void)
{
COMPARATOR->ANACMP0 = ((0x0 << COMPARATOR_ANACMP0_CMP_OUT_Pos) & COMPARATOR_ANACMP0_CMP_OUT_Msk) |
((0x0 << COMPARATOR_ANACMP0_CMP_LPWR_Pos) & COMPARATOR_ANACMP0_CMP_LPWR_Msk) |
((0x0 << COMPARATOR_ANACMP0_ACMP0_SEL_Pos) & COMPARATOR_ANACMP0_ACMP0_SEL_Msk) |
((0x0 << COMPARATOR_ANACMP0_CMP_HYST_ADJ_Pos) & COMPARATOR_ANACMP0_CMP_HYST_ADJ_Msk) |
((0x0 << COMPARATOR_ANACMP0_CMP_INV_OUT_Pos) & COMPARATOR_ANACMP0_CMP_INV_OUT_Msk) |
((0x1 << COMPARATOR_ANACMP0_CMP_FLT_OFF_Pos) & COMPARATOR_ANACMP0_CMP_FLT_OFF_Msk) |
((0x1 << COMPARATOR_ANACMP0_CMP_EN_Pos) & COMPARATOR_ANACMP0_CMP_EN_Msk) ;
}
void PORT_Init(void)
{
PORT0->IOCR8 = ((0x0 << PORT0_IOCR8_PC11_Pos) & PORT0_IOCR8_PC11_Msk) |
((0x14 << PORT0_IOCR8_PC10_Pos) & PORT0_IOCR8_PC10_Msk) |
((0x0 << PORT0_IOCR8_PC9_Pos) & PORT0_IOCR8_PC9_Msk) |
((0x0 << PORT0_IOCR8_PC8_Pos) & PORT0_IOCR8_PC8_Msk) ;
}
Labels
0 Replies