在线时间21 小时
UID180912
注册时间2009-1-8
NXP金币0
该用户从未签到
中级会员
 
- 积分
- 242
- 最后登录
- 2021-12-10
|

楼主 |
发表于 2014-2-17 15:49:27
|
显示全部楼层
回复:MK60DN512VLQ10进入VLLS3模式后的唤醒问题(续)
回复第 8 楼 于2014-02-17 14:26:48发表:
请问楼主的hscmp_init();程序怎么写的?
比较中断函数及其向量表都有改写吗?
比较中断函数和向量表都改了,我测过了比较功能正常,能按输入信号变化进入中断,就是进入VLLS3后不行,CMP1_IN3输入一直是1.5V左右,没有变化,一进VLLS3就醒了,而且不是复位,是继续执行while(1)里面的。hscmp_init();如下,是由CMP0的例程改的,注释没改。谢谢!
static void hscmp_init(void)
{
//Enable HSCMP module clock
SIM_SCGC4 |= (SIM_SCGC4_CMP_MASK );
//Set up HSCMP0 in NVIC. ISR put into vector table in isr.h file
enable_irq(INT_CMP1-16); //CMP0 Vector is 75. IRQ# is 75-16=59
// Configure CMP.
CMP_CR0_REG(CMP1_BASE_PTR) = 0x00; // Filter and digital hysteresis disabled
CMP_CR1_REG(CMP1_BASE_PTR) = 0x15; // Continuous mode, high-speed compare, unfiltered output, output pin disabled
CMP_FPR_REG(CMP1_BASE_PTR) = 0x00; // Filter disabled
CMP_SCR_REG(CMP1_BASE_PTR) = 0x3E; // Enable rising and falling edge interrupts, clear flags
CMP_DACCR_REG(CMP1_BASE_PTR) = 0xF0; // 6-bit reference DAC enabled, output set to vdd/64*(48+1)= 2.53v, (Vin selected is vin2=Vdd)
CMP_MUXCR_REG(CMP1_BASE_PTR) = 0x1F; // P-input as external channel 1. M-input as 6b DAC = 2.53v, it is adjustable with CMP_DACCR_REG
CMP_CR1_REG(CMP1_BASE_PTR) |= CMP_CR1_OPE_MASK; // Enable output pin for HSCMP0.
}
|
|