共2条
1/1 1 跳转至页
PWM 请教版主:PWM脉冲问题?我的程序
问
#include "MSP430x12x.h"
; ACLK = TACLK = LFXT1 = default DCO ~ 800kHz.
; Normal mode LPM3
; //*External watch crystal installed on XIN XOUT is required for ACLK*//
;
; MSP430F123(2)
; -----------------
; /|\| XIN|-
; | | |
; --|RST XOUT|-
; | |
; | P1.2|--> CCR1 - 50% PWM
; | P1.3|--> CCR2 - 50% PWM
;******************************************************************************
;------------------------------------------------------------------------------
ORG 0E000h ; Program Start
;------------------------------------------------------------------------------
RESET mov.w #300h,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT
MOV.B #0FEH,&P2DIR
MOV.B #008H,&P2IE
MOV.B #0,&P2IES
EINT
Mainloop bis.w #LPM3, SR ; Enter LPM3
nop ; Required only for C-spy
SetupTA mov.w #TASSEL1+TACLR,&TACTL ; ACLK, Clear TAR
SetupC0 mov.w #10,&CCR0 ; PWM Period/2
SetupC1 mov.w #OUTMOD_2,&CCTL1 ; CCR1 toggle/reset
mov.w #5,&CCR1 ; CCR1 PWM Duty Cycle
SetupC2 mov.w #OUTMOD_6,&CCTL2 ; CCR2 toggle/set
mov.w #5,&CCR2 ; CCR2 PWM duty cycle
SetupP1 bis.b #00Ch,&P1DIR ; P1.2 and P1.3 output
bis.b #00Ch,&P1SEL ; P1.2 and P1.3 TA1/2 otions
bis.w #MC1+MC0,&TACTL ; Start Timer_A in up-down mode
RETI ;
;------------------------------------------------------------------------------
; Interrupt Vectors Used MSP430x12x(2)
;------------------------------------------------------------------------------
ORG 0FFFEh ; MSP430 RESET Vector
DW RESET ;
ORG 0FFE6H
DW SetupTA
END
是否可以利用P2.0中断产生脉冲输出?
怎么来做延时1S,然后才产生4MS的脉冲信号?
; ACLK = TACLK = LFXT1 = default DCO ~ 800kHz.
; Normal mode LPM3
; //*External watch crystal installed on XIN XOUT is required for ACLK*//
;
; MSP430F123(2)
; -----------------
; /|\| XIN|-
; | | |
; --|RST XOUT|-
; | |
; | P1.2|--> CCR1 - 50% PWM
; | P1.3|--> CCR2 - 50% PWM
;******************************************************************************
;------------------------------------------------------------------------------
ORG 0E000h ; Program Start
;------------------------------------------------------------------------------
RESET mov.w #300h,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT
MOV.B #0FEH,&P2DIR
MOV.B #008H,&P2IE
MOV.B #0,&P2IES
EINT
Mainloop bis.w #LPM3, SR ; Enter LPM3
nop ; Required only for C-spy
SetupTA mov.w #TASSEL1+TACLR,&TACTL ; ACLK, Clear TAR
SetupC0 mov.w #10,&CCR0 ; PWM Period/2
SetupC1 mov.w #OUTMOD_2,&CCTL1 ; CCR1 toggle/reset
mov.w #5,&CCR1 ; CCR1 PWM Duty Cycle
SetupC2 mov.w #OUTMOD_6,&CCTL2 ; CCR2 toggle/set
mov.w #5,&CCR2 ; CCR2 PWM duty cycle
SetupP1 bis.b #00Ch,&P1DIR ; P1.2 and P1.3 output
bis.b #00Ch,&P1SEL ; P1.2 and P1.3 TA1/2 otions
bis.w #MC1+MC0,&TACTL ; Start Timer_A in up-down mode
RETI ;
;------------------------------------------------------------------------------
; Interrupt Vectors Used MSP430x12x(2)
;------------------------------------------------------------------------------
ORG 0FFFEh ; MSP430 RESET Vector
DW RESET ;
ORG 0FFE6H
DW SetupTA
END
是否可以利用P2.0中断产生脉冲输出?
怎么来做延时1S,然后才产生4MS的脉冲信号?
共2条
1/1 1 跳转至页
回复
我要赚赏金打赏帖 |
|
|---|---|
| 设备功耗web监控界面(ESP32C5)被打赏¥28元 | |
| OrangePiZero2W系统被打赏¥33元 | |
| Linux环境下以模拟方式快速实现出入管理功能测试被打赏¥24元 | |
| 树莓派3+Klipper,老3D打印机满血升级被打赏¥33元 | |
| OK1126B-S开发板下串口屏及其应用被打赏¥21元 | |
| 低功耗超声波液位测距仪(ESP32S3)被打赏¥27元 | |
| 在K230DBOX上实现多时段语音提示功能被打赏¥14元 | |
| 使K230DBOX实现相机持续拍照功能被打赏¥12元 | |
| 基于K230DBOX的文本管理器设计被打赏¥14元 | |
| 基于K230DBOX的彩色画板功能实现被打赏¥15元 | |
我要赚赏金
