请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号: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;
}
这是我的代码、我无法使中断正常工作。