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.

[参考译文] TM4C123GH6PM:WTIME0中断不能#39;t 工作。

Guru**** 2479745 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/697327/tm4c123gh6pm-wtimer0-interrupt-doesn-t-work

器件型号:TM4C123GH6PM
#include 
#include 
#include "inc/hw_gpio.h"
#include "void/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_timer.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#define "tomeintrl_freq_define.h"

#define #define "mosrmctrl_mos"#define #define #define #define "tore.mos_mos_tractor.000#define #define #define #define #define #define #define
"ine/tore.tore.mos"#define #define #define #define #define #define #define #tore.tore.tor_mos












TimerIntClear (WTIMER 0_BASE、TIMER_CAPB_MATCH);
TimerDisable (WTIMER 0_BASE、TIMER_B);
}

int
main (void)
{

SysCtlClockSet (SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHz);

SysCtlPeripheralEnable (SYSCTL_Periph_WTIME0);

IntMasterEnable();
SysCtlPeripheralEnable (SYSCTL_Periph_GPIOC);

GPIOPinConfigure (GPIO_PC5_WT0CCP1);

GPIOPinTypeTimer (GPIO_PORTC_BASE、GPIO_PIN_5);

TimerConfigure (WTIMER0_BASE,TIMER_CFG_SPLIT_PAIR | TIMER_CFG_B_PWM);
TimerLoadSet (WTIMER 0_BASE、TIMER_B、PERIODE-1);

设定角度(30);

TimerIntEnable (WTIMER 0_BASE、TIMER_CAPB_MATCH);
TimerIntRegister (WTIMER 0_BASE、TIMER_B、WTIMER 0IntHandler);
TimerEnable (WTIMER 0_BASE、TIMER_B);


while (1)
{
printf("...");
}
}
int
setAngle (int angle)
{
uint16_t micros =(SERVO_MICROS_MAX - SERVO_MICROS_MIN)*角度/ 180 + SERVO_MICROS_MIN;
uint32_t PER =周期-1 -(micros*80);
TimerMatchSet (WTIMER 0_BASE、TIMER_B、PER);
返回 PER;
}

这是我的代码、我无法使中断正常工作。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您是否只是尝试生成周期性中断? 您为 PWM 配置了宽定时器、并为捕获事件启用了中断。 尝试将计时器配置为 TIMER_CFG_A_PERIODICRACRACRACY_MOTIMER_TIMA_TIMEOUT、并启用 TIMER_TIMEOUT 的中断。
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我需要 PWM 在其产生第一个脉冲后停止、因此我计划使用中断来实现这一目的。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    很抱歉、花了这么长时间。 我认为有一种方法可以执行"1shot PWM"、但 TivaWare 库不支持该方法。 在我有机会处理这一请求之前,我花了一些时间。 总之、通过创建新的定义、我可以将计时器配置为执行单个脉冲。 从附加的.zip 文件导入工程。

    /cfs-file/__key/communityserver-discussions-components-files/908/1Shot_2D00_WT0PWM.zip