This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LS3137 ADC的电压比较器功能( Magnitude Threshold)

Other Parts Discussed in Thread: HALCOGEN

ADC设置为连续转换模式,在主循环中查询阈值中断标志寄存器,如果AD值大于阈值后,可以进入到阈值中断内部执行 , 这里是没有问题的。

while (1)
  {
        if ((adcREG1->MAGTHRINTFLG & 0x01) == 0x01)
        {
            if ((adcREG1->MAGTHRINTOFFSET & 0x01) == 0x01)
            {
                ;   /* code */
            }
        }
  }


问题:

这样一直轮训太费资源,在HCG也没有关于阈值比较功能的设置。

所以怎么可以使用阈值中断函数?

  • 我现在的想法是,在中断向量表(ch2~95)中增加一项,就是在HCG中更改一个phantominterrupt,改成MAG中断函数

    但是这个在哪边配置中断地址映射呢?

  • 关于这个我们是有专门的说明的,您可以参考一下

    www.ti.com/.../spnu499c.pdf



    19.7 ADC Magnitude Threshold Interrupts
  • 你好,这个我已经看过了,并且通过查询的方式,可以得知中断标志有没有被置位(如上所述)。
    现在的问题是,这个阈值中断功能,怎么让其产生中断?
    我现在是用HCG配置,HCG里面也没有找到有相关的设置。
    所以,是不支持ADC阈值比较的功能产生IRQ吗?只能通过不断地查询其中断标志来确定?
  • 请参考下下面的回复

    ADC magnitude compare interrupt is supported. The magnitude compare interrupt is independent of the conversion group being used. This interrupt is based on a selected channel number and can generate an interrupt if the conversion on this selected channel is greater than or equal to or less than a reference value. This reference value can be a fixed (programmable) value or can be the conversion result of another channel.

    The Channel in VIM assigned to ADC1 Magnitude compare interrupt is 31 and for ADC2 Magnitude compare interrupt is 59.

    For enabling interrupt in VIM module HALCoGen can be used.

    In the application ADCn Magnitude interrupts has to be enabled from ADMAGINTENASET register.
    Disabling Magnitude compare interrupt can be done in ADMAGINTENACLR register.

    ISR for Magnitude compare interrupt also has to be added from user (HALCoGen does not generate ISR for these interrutps).
  • 谢谢,已成功解决
  • 很高兴您能解决问题