欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 451|回復(fù): 1
收起左側(cè)

生成雙通道帶死區(qū)的PWM波

[復(fù)制鏈接]
ID:1151321 發(fā)表于 2025-5-22 19:25 | 顯示全部樓層 |閱讀模式
用GPIO1和GPIO2生成雙通道PWM波,一般為10Khz,通過修改Duty可以直接進行占空比
#include "DSP2833x_Device.h"     // DSP2833x Headerfile Include File
#include "DSP2833x_Examples.h"   // DSP2833x Examples Include File

Uint16    *ExRamStart = (Uint16 *)0x100000;

void ConfigEPwm(void);
interrupt void EPWM_INT(void);

float Duty;

void main(void)
{
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the DSP2833x_SysCtrl.c file.
   InitSysCtrl();

// Step 2. Initalize GPIO:
// This example function is found in the DSP2833x_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
   InitGpio();  // Skipped for this example
// InitXintf16Gpio();   //zq

   InitEPwm1Gpio();

   Duty=0.5;

// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
   DINT;// 禁用CPU全局中斷(防止配置過程中被中斷打斷)
   InitPieCtrl();// 初始化PIE(外設(shè)中斷擴展)控制寄存器
   IER = 0x0000;// 清零CPU中斷使能寄存器(禁用所有CPU級中斷)
   IFR = 0x0000;// 清零CPU中斷標志寄存器(清除所有未處理的中斷標志)
   InitPieVectTable();// 初始化PIE向量表(存儲中斷服務(wù)函數(shù)地址)

   EALLOW;
   PieVectTable.EPWM1_INT=&EPWM_INT;// 將EPWM1中斷服務(wù)函數(shù)地址寫入PIE向量表
   EDIS;

   IER |= M_INT3;// 使能CPU的第3組中斷(對應(yīng)ePWM、eQEP等外設(shè)中斷)

   PieCtrlRegs.PIEIER3.bit.INTx1 = 1;// 使能PIE第3組的第1個中斷(即ePWM1中斷)

   EINT;// 啟用全局中斷(允許CPU響應(yīng)中斷)

   ConfigEPwm();

// Step 4. Initialize the Device Peripheral. This function can be
//         found in DSP2833x_CpuTimers.c
  // InitCpuTimers();   // For this example, only initialize the Cpu Timers

// Configure CPU-Timer 0, 1, and 2 to interrupt every second:
// 150MHz CPU Freq, 1 second Period (in uSeconds)

   //ConfigCpuTimer(&CpuTimer0, 150, 1000000);
   //ConfigCpuTimer(&CpuTimer1, 150, 1000000);
   //ConfigCpuTimer(&CpuTimer2, 150, 1000000);
//

評分

參與人數(shù) 1黑幣 +40 收起 理由
admin + 40 共享資料的獎勵!

查看全部評分

回復(fù)

使用道具 舉報

ID:609503 發(fā)表于 2025-5-23 17:43 | 顯示全部樓層
只有函數(shù)調(diào)用,沒有具體的實現(xiàn)啊。
回復(fù)

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機教程網(wǎng)

快速回復(fù) 返回頂部 返回列表