📄 pwm.h
字号:
/***************************************************************************************
* *
* Library: Configuration of PWM block in single update mode *
* *
* File: pwm.h *
* *
* Description: pwm21990 include file *
* Purpose : Declare library routines PWM block operation *
* *
* Author : JC *
* Version : 1.0 *
* Date : Dec 2001 *
* Modification History: None *
* *
* Embedded Control Systems *
* Analog Devices Inc. *
***************************************************************************************/
/***************************************************************************************
* *
* Constants that need to be defined in main.h: *
* *
* #define Cry_clock = xxxx; Crystal clock frequency [kHz] *
* #define PLL_clock_Multiplier = xxxx; Multiplier for core clock
* #define H_clock_ratio = xxxx; core/H clock ratio
* #define PWM_dreq = xxxx; [Hz]
* #define PWM_deadtime = xxxx; Desired deadtime [nsec] *
* #define PWM_syncpulse = xxxx; Desired sync pulse time [nsec] *
***************************************************************************************/
/***************************************************************************************
* *
* Other Libraries Required by this code: *
* *
* None *
***************************************************************************************/
#ifndef PWM_INCLUDED
#define PWM_INCLUDED
/***************************************************************************************
* Routines Defined in this code *
***************************************************************************************/
.extern PWM_Init_;
/***************************************************************************************
* Global Variables Defined *
***************************************************************************************/
/* None */
/***************************************************************************************
* *
* Type: Macro *
* *
* Call: PWM_Init(PWMSYNC_ISR, PWMTRIP_ISR); *
* *
* Initialises the PWM block of the adsp-21990 with the parameters set in main.h *
* All outputs are enabled, no crossover and no chopping. Also setup PWM interrupts. *
* *
* Inputs : PWMSYNC_ISR: Label of PWM_SYNC interrupt service routine *
* PWMTRIP_ISR: Label of PWM_TRIP interrupt service routine *
* *
* Ouputs : None *
* *
* Modified: AR, AY0 *
* *
***************************************************************************************/
#define PWM_Init(PWMTRIP_int_label, PWMSYNC_int_label) \
Set_InterruptVector(INT0_ADDR, PWMTRIP_int_label); /* Vector for PWM_TRIP int*/ \
Set_InterruptVector(INT1_ADDR, PWMSYNC_int_label); /* Vector for PWM_SYNC int */ \
iopg = IntCtrl_Page;\
ar = IO(IPR2);\
ay0 = 0xff00;\
ar = ar and ay0;\
ay0= 0x0001; /* assign PWM_TRIP ISR to USR0 and PWM_SYNC ISR to USR1*/\
ar = ar or ay0;\
IO(IPR2) = ar;\
call PWM_Init_ /*Initialize PWM registers*/
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -