//###########################################################################
//
// FILE: Example_2806xEPwmRealTimeInt.c
//
// TITLE: ePWM Real-Time Interrupt Example
//
//! \addtogroup f2806x_example_list
//! <h1>ePWM Real-Time Interrupt (epwm_real-time_interrupts)</h1>
//!
//! This example configures the ePWM1 Timer and increments
//! a counter each time an interrupt is taken. ePWM interrupt can
//! be configured as time critical to demonstrate real-time mode
//! functionality and real-time interrupt capability.
//! ControlCard LED2 (GPIO31) is toggled in main loop
//! ControlCard LED3 (GPIO34) is toggled in ePWM1 Timer Interrupt.
//! FREE_SOFT bits and DBBIER.INT3 bit must be set to enable ePWM1
//! interrupt to be time critical and operational in real time mode
//! after halt command.
//! In this example:
//! - ePWM1 is initialized
//! - ePWM1 is cleared at period match and set at Compare-A match
//! - Compare A match occurs at half period
//! - GPIOs for LED2 and LED3 are initialized
//! - Free_Soft bits and DBGIER are cleared
//! - An interrupt is taken on a zero event for the ePWM1 timer
//!
//! \b Watch \b Variables \n
//! - EPwm1TimerIntCount
//! - EPwm1Regs.TBCTL.bit.FREE_SOFT
//! - EPwm1Regs.TBCTR
//! - DBGIER.INT3
//
//###########################################################################
// $TI Release: $
// $Release Date: $
// $Copyright:
// Copyright (C) 2009-2022 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
F28069M实时定时器例子
最新推荐文章于 2025-04-12 14:31:26 发布
该代码示例展示了如何在F2806x微控制器上配置ePWM定时器以实现实时中断。ePWM1中断在周期匹配和比较A匹配时清零和设置,中断服务例程中更新计数器并控制LED状态。主要涉及实时中断、定时器配置和GPIO初始化。

最低0.47元/天 解锁文章
1374

被折叠的 条评论
为什么被折叠?



