1253 views|1 replies

3836

Posts

19

Resources
The OP
 

MSP430 MCU application of timer, PWM, comparator [Copy link]

1. The timer uses two modes: query and interrupt. Most logic chips have the ability to output 0 more than the ability to output 1. (1) Query mode: TMSEL determines the working mode of the watchdog. If set to 1, the watchdog works in timing mode. SSEL selects the clock source of the watchdog timer. SSEL is set to 1. IS0IS1 determines the output frequency of the watchdog timer. (Note: The interrupt flag must be cleared when using query mode) main() { ... while(True) { if(IFG1&0x01) { P1OUT ^= 0x01;//Flip state IFG &=0xfe;//Clear the interrupt flag bit (2) Interrupt mode: The settings of WDTCTL are the same as the query mode. In addition, the interrupt enable bit (WDTIE, located in IE1.0) needs to be set so that the microcontroller can respond to this interrupt. #pragma vector=WDT_VECTOR __interrupt void WDT_ISR() { P1OUT ^=0x01; [size= 4]} main() { ... while(True); } 2.PWM (implemented with timer A) (1) The DA effect can be achieved by increasing the frequency, but in some cases it still cannot meet the requirements. In this case, an integration circuit is needed to obtain the ideal DA effect (2) Setting of TA: Comparison/capture module control register: capture comparison register CCRx. Note: The output PWM period should be much smaller than the integration constant of the integration circuit. To improve DA accuracy, CCR0 should not be too small. 3. Comparator

This post is from Microcontroller MCU

Latest reply

Thanks for sharing  Details Published on 2018-12-25 09:14
 

6366

Posts

4937

Resources
2
 
Thanks for sharing
This post is from Microcontroller MCU
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list