Other Parts Discussed in Thread: SYSCONFIG, C2000WARE
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:TMS320F280041C Thread 中讨论的其他器件:SysConfig、 C2000WARE
这与查询有关
因此、我了解到我们必须定义通道才能使用 A0或其他任何引脚
但现在我的问题是、您在哪里定义它...
ADC_INT_number1 = 0U、
我知道有一个用于定义信道的命令、但问题是我从未真正了解信道的定义位置。 F28x4x 系列的示例程序在所有示例中都使用 A0通道。 我想知道如何更改 ADC 通道的地址
我正在附上 ADC 的采样程序供您参考、您能告诉我它的定义位置。
ERT
//###########################################################################
//
// FILE: adc_ex8_ppb_limits.c
//
// TITLE: ADC limits check using post-processing block for f2838x.
//
//!
//! This example sets up the ePWM to periodically trigger the ADC. If the
//! results are outside of the defined range, the post-processing block
//! will generate an interrupt.
//!
//! The default limits are 1000LSBs and 3000LSBs. With VREFHI set to 3.3V, the
//! PPB will generate an interrupt if the input voltage goes above about
//! 2.4V or below about 0.8V.
//!
//! \b External \b Connections \n
//! - A0 should be connected to a signal to convert
//!
void main(void)
{
}
//
// configureEPWM - Setup SOC and compare values for EPWM
//
void configureEPWM(uint32_t epwmBase)
{
//
// Disable SOCA trigger
//
EPWM_disableADCTrigger(epwmBase, EPWM_SOC_A);
//
// Trigger SOCA on CMPA up-count
//
EPWM_setADCTriggerSource(epwmBase, EPWM_SOC_A, EPWM_SOC_TBCTR_U_CMPA);
//
// Generate pulse on 1st event
//
EPWM_setADCTriggerEventPrescale(epwmBase, EPWM_SOC_A, 1U);
//
// Set compare A value to 2048 counts
//
EPWM_setCounterCompareValue(epwmBase, EPWM_COUNTER_COMPARE_A, 2048U);
//
// Set period to 4096 counts
//
EPWM_setTimeBasePeriod(epwmBase, 4096U);
//
// Freeze counter
//
EPWM_setTimeBaseCounterMode(epwmBase, EPWM_COUNTER_MODE_STOP_FREEZE);
}
//
// adcAEvtISR - ISR for ADCA PPB
//
interrupt void adcAEvtISR(void)
{
//
// Warning, you are outside of PPB limits
//
intStatus = ADC_getPPBEventStatus(myADC0_BASE, ADC_PPB_NUMBER1);
if((intStatus & ADC_EVT_TRIPHI) != 0U)
{
//
// Voltage exceeded high limit
//
asm(" ESTOP0");
//
// Clear the trip flag and continue
//
ADC_clearPPBEventStatus(myADC0_BASE, ADC_PPB_NUMBER1, ADC_EVT_TRIPHI);
}
if((intStatus & ADC_EVT_TRIPLO) != 0U)
{
//
// Voltage exceeded low limit
//
asm(" ESTOP0");
//
// Clear the trip flag and continue
//
ADC_clearPPBEventStatus(myADC0_BASE, ADC_PPB_NUMBER1, ADC_EVT_TRIPLO);
}
Interrupt_clearACKGroup(INT_myADC0_EVT_INTERRUPT_ACK_GROUP);
}
//
// End of file
//