Part Number:TMS320F280023
280025程序ADC初始化如下程序:
//
// Reset the ADCs
//
SysCtl_resetPeripheral(SYSCTL_PERIPH_RES_ADCA);
SysCtl_resetPeripheral(SYSCTL_PERIPH_RES_ADCC);
//
// Disable converters during configuration
//
ADC_disableConverter(ADCA_BASE);
ADC_disableConverter(ADCC_BASE);
//
// Set for VREF internal 3.3V – Must set ADC C voltage reference the same
// as ADC B voltage reference on double-bonded devices. See datasheet
// section 5.10 Analog Peripherals.
//
ADC_setVREF(ADCA_BASE, ADC_REFERENCE_INTERNAL, ADC_REFERENCE_3_3V);
ADC_setVREF(ADCC_BASE, ADC_REFERENCE_INTERNAL, ADC_REFERENCE_3_3V);
//
// ADCCLK max = 50 MHz, SYSCLK = 100 MHz -> Prescaler = 2.0
//
ADC_setPrescaler(ADCA_BASE, ADC_CLK_DIV_2_0);
ADC_setPrescaler(ADCC_BASE, ADC_CLK_DIV_2_0);
//
// SOC configuration, sample all values on EPWM SOCA
//
ADC_setupSOC(LLC_ADCCTLBASE_ISEC, LLC_ADCSOC_ISEC, ADC_TRIGGER_EPWM2_SOCA,
LLC_ADCIN_ISEC, 8);
ADC_setupSOC(LLC_ADCCTLBASE_IPRIRESO,
LLC_ADCSOC_IPRIRESO, ADC_TRIGGER_EPWM2_SOCA,
LLC_ADCIN_IPRIRESO, 8);
ADC_setupSOC(LLC_ADCCTLBASE_VSEC, LLC_ADCSOC_VSEC, ADC_TRIGGER_EPWM2_SOCA,
LLC_ADCIN_VSEC, 8);
//
// No ADC interrupt triggers SOC0
// (TRIGSEL determined by SOC and not ADCINT1 or ADCINT2)
//
ADC_setInterruptSOCTrigger(LLC_ADCCTLBASE_ISEC, LLC_ADCSOC_ISEC,
ADC_INT_SOC_TRIGGER_NONE);
ADC_setInterruptSOCTrigger(LLC_ADCCTLBASE_IPRIRESO, LLC_ADCSOC_IPRIRESO,
ADC_INT_SOC_TRIGGER_NONE);
ADC_setInterruptSOCTrigger(LLC_ADCCTLBASE_VSEC, LLC_ADCSOC_VSEC,
ADC_INT_SOC_TRIGGER_NONE);
//
// All SOCs handled in round-robin mode
//
ADC_setSOCPriority(ADCA_BASE, ADC_PRI_ALL_ROUND_ROBIN);
ADC_setSOCPriority(ADCC_BASE, ADC_PRI_ALL_ROUND_ROBIN);
//
// Enable converters
//
ADC_enableConverter(ADCA_BASE);
ADC_enableConverter(ADCC_BASE);
//
// Wait 1 ms after power-up before using the ADC
//
DEVICE_DELAY_US(1000);
程序运行到DEVICE_DELAY_US(1000);提示如下:
No source available for "_system_post_cinit() at C:/Users\1\workspace_v10
No source available for "_system_post_cinit() at C:/Users\1\workspace_v10
No source available for "_system_post_cinit() at C:/Users\1\workspace_v10
No source available for "_system_post_cinit() at C:/Users\1\workspace_v10
No source available for "_system_post_cinit() at C:/Users\1\workspace_v10
No source available for "_system_post_cinit() at C:/Users\1\workspace_v10
然后就嗝屁了,
delay函数来自于ti自带文件:
//*****************************************************************************
//
// Macro to call SysCtl_delay() to achieve a delay in microseconds. The macro
// will convert the desired delay in microseconds to the count value expected
// by the function. \b x is the number of microseconds to delay.
//
//*****************************************************************************
#define DEVICE_DELAY_US(x) SysCtl_delay(((((long double)(x)) / (1000000.0L / \
(long double)DEVICE_SYSCLK_FREQ)) – 9.0L) / 5.0L)
Green Deng:
这个delay_us没怎么使用过,一般都是用的就是delay_us()函数。
然后,你的程序是在线仿真的时候出现问题还是flash调试出现问题?后者的话有没有在程序中加入memcpy函数?