uint16_t g_ui16RGBData[] = { 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95 };
void PerGenCfg(void)
{
//
// Enable the GPIO Peripheral.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
// Enable the Timer_1_A Peripheral.
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);
ROM_GPIOPinConfigure(GPIO_PD2_T1CCP0);
ROM_GPIOPinTypeTimer(GPIO_PORTD_BASE, GPIO_PIN_2);
// Enable the uDMA Peripheral.
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
// Enable processor interrupts.
ROM_IntMasterEnable();
}
void ConfigureTimer1A(void)
{ // Disable Timer_1_A
ROM_TimerDisable(TIMER1_BASE, TIMER_A);
// Sets the clock source for the specified timer module.
TimerClockSourceSet(TIMER1_BASE, TIMER_CLOCK_SYSTEM);
// Configures the Timer_1_A.
//HWREG(TIMER1_BASE + TIMER_O_TAMR) = 0x20a;
ROM_TimerConfigure(TIMER1_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PWM);
// Sets the timer prescale value.
ROM_TimerPrescaleSet(TIMER1_BASE,TIMER_A, 0x00);
// Sets controls the output level.
ROM_TimerControlLevel(TIMER1_BASE, TIMER_A, false);
// Sets the timer load value and Match value.
ROM_TimerLoadSet(TIMER1_BASE, 150 – 1);
ROM_TimerMatchSet(TIMER1_BASE, 50 – 1);
// Enable PWM Mode interrupt.
HWREG(TIMER1_BASE + TIMER_O_TAMR) |= TIMER_TAMR_TAPWMIE;
ROM_uDMAEnable();
ROM_uDMAControlBaseSet(ui8ControlTable);
ROM_IntEnable(INT_UDMAERR);
ROM_uDMAChannelControlSet(UDMA_CH20_TIMER1A, UDMA_SIZE_16 | UDMA_DST_INC_NONE | UDMA_SRC_INC_16 | UDMA_ARB_1); ROM_uDMAChannelTransferSet(UDMA_CH20_TIMER1A | UDMA_PRI_SELECT, UDMA_MODE_AUTO, g_ui16RGBData ,
(void *)(TIMER1_BASE+TIMER_O_TBMATCHR), 256);
ROM_uDMAChannelAttributeDisable(UDMA_CH20_TIMER1A, UDMA_ATTR_ALTSELECT | UDMA_ATTR_USEBURST | UDMA_ATTR_REQMASK);
ROM_uDMAChannelAttributeEnable(UDMA_CH20_TIMER1A, UDMA_ATTR_HIGH_PRIORITY);
TimerDMAEventSet(TIMER1_BASE, TIMER_DMA_CAPEVENT_A);
TimerIntEnable(TIMER1_BASE, TIMER_TIMA_DMA);
TimerIntRegister(TIMER1_BASE, TIMER_A, Timer1IntHandler);
ROM_TimerEnable(TIMER1_BASE, TIMER_A);}
Susan Yang:
请您x先参考一下下面的帖子
e2e.ti.com/…/482410