Questions are in regards to programming the MSP430 microcont

Questions are in regards to programming the MSP430 microcontroller

Timer_A is running on a 500 KHz clock. What delay (in seconds) is generated in the continuous mode? Give the answer for all values of ID (Input Divider). Timer_A is running on a 500 KHz clock. We wish to obtain a delay of 0.25 seconds by configuring the timer in the up mode. Find suitable values of TACCR0 and ID (Input Divider). Give all the possible solutions. Timer_A is running based on ACLK which is using a 32, 768 Hz crystal. What delay values can we generate in the continuous mode? Give your answer for all the cases of ID (Input Divider). Timer_A is running off an 8 MHz clock signal. Can we configure the timer to generate a delay of 0.1 second? Explain. Write a C code that runs Timer_A based on a frequency of 16, 384 Hz and generates a delay of 0.25 second. Use the up mode. Use ACLK which is based on 32 KHz. Each time the duration elapses, toggle LED1 that is mapped to Port 2 bit #7 (active low). (The code should be based on polling the tinier slat us: i.e. don 7 use interrupts.)

Solution

EZ430-RF2500 Toggle LED using Switch - Polling

#include \"msp430x22x4.h\"
2
3 void configureClocks();
4 volatile unsigned int i; // volatile to prevent optimization
5
6 void main(void)
7 {
8 WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
9 configureClocks();
10
11 // Configure LED on P1.0
12 P1DIR = BIT0; // P1.0 output
13 P1OUT &= ˜BIT0; // P1.0 output LOW, LED Off
14
15 // Configure Switch on P1.2
16 P1REN |= BIT2; // P1.2 Enable Pullup/Pulldown
17 P1OUT = BIT2; // P1.2 pullup
18
19 while(1)
20 {
21 if(P1IN & ˜BIT2) // P1.2 is Low?
22 {
23 P1OUT ˆ= BIT0; // Toggle LED at P1.0
24 }
25 }
26 }
27
28 void configureClocks()
29 {
30 // Set system DCO to 8MHz
31 BCSCTL1 = CALBC1_8MHZ;
32 DCOCTL = CALDCO_8MHZ;
33
34 // Set LFXT1 to the VLO @ 12kHz
35 BCSCTL3 |= LFXT1S_2;
36 }

MSP430 Hello World with Clock Control

#include \"msp430x22x4.h\"
2
3 void configureClocks();
4 volatile unsigned int i; // volatile to prevent optimization
5
6 void main(void)
7 {
8 WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
9 configureClocks();
10 P1DIR |= 0x01; // Set P1.0 to output direction
11
12 for (;;)
13 {
14 P1OUT ˆ= 0x01; // Toggle P1.0 using exclusive-OR
15 i = 50000; // Delay
16 do (i--);
17 while (i != 0);
18 }

19 }
20
21 void configureClocks()
22 {
23 // Set system DCO to 8MHz
24 BCSCTL1 = CALBC1_8MHZ;
25 DCOCTL = CALDCO_8MHZ;
26
27 // Set LFXT1 to the VLO @ 12kHz
28 BCSCTL3 |= LFXT1S_2;
29 }

EZ430-RF2500 Toggle LED using Switch - Low Power Mode

#include \"msp430x22x4.h\"
2
3 void configureClocks();
4 volatile unsigned int i; // volatile to prevent optimization
5
6 void main(void)
7 {
8 WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
9 configureClocks();
10
11 // Configure LED on P1.0
12 P1DIR = BIT0; // P1.0 output
13 P1OUT &= ˜BIT0; // P1.0 output LOW, LED Off
14
15 // Configure Switch on P1.2
16 P1REN |= BIT2; // P1.2 Enable Pullup/Pulldown
17 P1OUT = BIT2; // P1.2 pullup
18 P1IE |= BIT2; // P1.2 interrupt enabled
19 P1IES |= BIT2; // P1.2 Hi/lo falling edge
20 P1IFG &= ˜BIT2; // P1.2 IFG cleared just in case
21
22 // Enter Low Power Mode 4 (LPM4) w/interrupt
23 __bis_SR_register(LPM4_bits + GIE);
24 }
25
26 void configureClocks()
27 {
28 // Set system DCO to 8MHz
29 BCSCTL1 = CALBC1_8MHZ;
30 DCOCTL = CALDCO_8MHZ;
31
32 // Set LFXT1 to the VLO @ 12kHz
33 BCSCTL3 |= LFXT1S_2;
34 }

Questions are in regards to programming the MSP430 microcontroller Timer_A is running on a 500 KHz clock. What delay (in seconds) is generated in the continuous
Questions are in regards to programming the MSP430 microcontroller Timer_A is running on a 500 KHz clock. What delay (in seconds) is generated in the continuous

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site