<< Chapter < Page Chapter >> Page >

The Basic Timer1 is set to generate an interrupt once every second.

The routine main() ends with the interrupts global activation and puts the device in low power mode, awaiting the next interrupt.

Basic Timer1 ISR begins by activating LED2, indicating the beginning of the routine execution and then switches the state of LED1. The counters are updated in cascade and their contents updated on the LCD, through routines LCD_sec() , LCD_min() and LCD_hour() . The routine ends with switching the state of the clock separation points. Finally, LED2 is turned off.

System configuration

Watchdog timer

The Watchdog Timer is disabled with the objective of reducing energy consumption, but giving up the protection afforded by it. This peripheral is configured by the WDTCTL register. Its access is protected by a password. The value to disable it:

WDTCTL = WDTPW | WDTHOLD; // Stop WDT

Fll+ configuration

A 32.768 kHz crystal is applied to the oscillator LFXT1. Since it is possible to select the internal capacitors using software, the value to write to the FLL_CTL0 configuration register to select the 8 pF capacitors is:

FLL_CTL0 |= XCAP18PF; // Set load cap for 32k xtal

Taking into consideration the change mentioned earlier to the FLL+ module, what are the frequencies of each of the clock signals?

ACLK = _________________;

MCLK = _________________;

SMCLK = ________________;

Led ports configuration

LED1 and LED2 are connected to ports P2.2 and P2.1 respectively. How should they be configured so that just the bits related to these ports have digital output functions?

P2DIR |= 0x06; // P2.2 and P2.1 as output

How should the P2OUT register be configured so that the application starts with LED1 on and LED2 off?

P2OUT |= 0x04; // LED1 on and LED2 off

Basic timer1 configuration

Basic Timer1 should generate an interrupt once every second. It uses two counters in series, so that the input of the BTCNT2 counter is the output of the BTCNT1 counter divided by 256. The BTCNT1 counter input is the ACLK with a 32.768 kHz frequency. If the selected output of the BTCNT2 counter is divided by 128, what is the time period associated with the Basic Timer1 interrupt? _________

BTCTL = BTDIV | BT_fCLK2_DIV128; // (ACLK/256)/128 IE2 |= BTIE; // Enable Basic Timer1 interrupt//********************************************************* // BasicTimer1 Interrupt Service Routine//********************************************************* #pragma vector=BASICTIMER_VECTOR__interrupt void basic_timer_ISR(void) {P2OUT |=0x02; // LED1 turn on P2OUT ^=0x04; // LED2 tooglesec++; // increment secondsLCD_sec(); // refresh seconds field in LCDif (sec == 60) // one minute was pass {sec = 0; // reset seconds counter min++; // increment minutesLCD_min(); // refresh minutes field in LCD if (min == 60) // one hour was pass{ min = 0; // reset minutes counterhour++; // increment hours LCD_min(); // refresh hours field in LCDif (hour == 24)// one day was pass {hour = 0; // reset hours counter }} }if (sec&0x01) // toogle clock dots {P3_DOT_ON; P5_DOT_ON;} else{ P3_DOT_OFF;P5_DOT_OFF; }P2OUT&=~0x02; // LED1 turn off }

Low power modes

The task simply updates the counters periodically and refreshes the LCD contents. It is possible to configure the registers for an energy-efficient operation.

Which low power mode should be used? _____________

Which system clocks are activated in the low power mode selected? _________________

BIS_SR(LPM3_bits + GIE); // Enter LPM3 + interrupts enabled

Analysis of operation

System clocks inspection

The MCLK, SMCLK and ACLK system clocks are available at ports P1.1, P1.4 and P1.5 respectively. These ports are located on the SW2, RESET_CC and VREG_EN lines, which are available on the H2 Header pins 2, 5 and 6. All these resources are available because the Chipcon RF module is not installed and SW2 is not used.

Using the Registers view, set bits 1, 4 and 5 of P1SEL and P1DIR registers, to choose the secondary function of these ports configured as outputs. By connecting an oscilloscope to those lines, it is possible to monitor the clock signals.

What are the values measured for each of the system clocks?

ACLK: ________________

SMCLK: _______________

MCLK: ________________

Isr execution time

The Basic Timer1 ISR execution time is fundamental to energy conservation, in order to extend the life of the system battery. The routine execution time can be measured by connecting the oscilloscope to port P2.1, which controls LED2. This output is available on pin 2 of Header H4.

The execution time of this routine varies with the number of the counter updates and respective updates to the LCD. What are the times measured for each of these situations and what their frequencies?

Seconds update: ______ with a time period of ______

Seconds and minutes update: ______ with a time period of ______

LCD fields update: ______ with a time period of ______

If the developer chooses to update all the LCD fields at each interrupt, the time required is much greater than the solution presented. Efficient programming contributes to a reduction in the system power consumption.

Measurement of electrical current drawn

The power consumption was discussed in the previous point. The electrical power required by the system during operation is measured by replacing the jumper on the Header PWR1 by an ammeter, which indicates the electric current taken by device during operation.

What is the value read? __________

This example and many others are available on the MSP430 Teaching ROM.

Request this ROM, and our other Teaching Materials here (External Link)

Questions & Answers

what is microbiology
Agebe Reply
What is a cell
Odelana Reply
what is cell
Mohammed
how does Neisseria cause meningitis
Nyibol Reply
what is microbiologist
Muhammad Reply
what is errata
Muhammad
is the branch of biology that deals with the study of microorganisms.
Ntefuni Reply
What is microbiology
Mercy Reply
studies of microbes
Louisiaste
when we takee the specimen which lumbar,spin,
Ziyad Reply
How bacteria create energy to survive?
Muhamad Reply
Bacteria doesn't produce energy they are dependent upon their substrate in case of lack of nutrients they are able to make spores which helps them to sustain in harsh environments
_Adnan
But not all bacteria make spores, l mean Eukaryotic cells have Mitochondria which acts as powerhouse for them, since bacteria don't have it, what is the substitution for it?
Muhamad
they make spores
Louisiaste
what is sporadic nd endemic, epidemic
Aminu Reply
the significance of food webs for disease transmission
Abreham
food webs brings about an infection as an individual depends on number of diseased foods or carriers dully.
Mark
explain assimilatory nitrate reduction
Esinniobiwa Reply
Assimilatory nitrate reduction is a process that occurs in some microorganisms, such as bacteria and archaea, in which nitrate (NO3-) is reduced to nitrite (NO2-), and then further reduced to ammonia (NH3).
Elkana
This process is called assimilatory nitrate reduction because the nitrogen that is produced is incorporated in the cells of microorganisms where it can be used in the synthesis of amino acids and other nitrogen products
Elkana
Examples of thermophilic organisms
Shu Reply
Give Examples of thermophilic organisms
Shu
advantages of normal Flora to the host
Micheal Reply
Prevent foreign microbes to the host
Abubakar
they provide healthier benefits to their hosts
ayesha
They are friends to host only when Host immune system is strong and become enemies when the host immune system is weakened . very bad relationship!
Mark
what is cell
faisal Reply
cell is the smallest unit of life
Fauziya
cell is the smallest unit of life
Akanni
ok
Innocent
cell is the structural and functional unit of life
Hasan
is the fundamental units of Life
Musa
what are emergency diseases
Micheal Reply
There are nothing like emergency disease but there are some common medical emergency which can occur simultaneously like Bleeding,heart attack,Breathing difficulties,severe pain heart stock.Hope you will get my point .Have a nice day ❣️
_Adnan
define infection ,prevention and control
Innocent
I think infection prevention and control is the avoidance of all things we do that gives out break of infections and promotion of health practices that promote life
Lubega
Heyy Lubega hussein where are u from?
_Adnan
en français
Adama
which site have a normal flora
ESTHER Reply
Many sites of the body have it Skin Nasal cavity Oral cavity Gastro intestinal tract
Safaa
skin
Asiina
skin,Oral,Nasal,GIt
Sadik
How can Commensal can Bacteria change into pathogen?
Sadik
How can Commensal Bacteria change into pathogen?
Sadik
all
Tesfaye
by fussion
Asiina
what are the advantages of normal Flora to the host
Micheal
what are the ways of control and prevention of nosocomial infection in the hospital
Micheal
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Teaching and classroom laboratories based on the “ez430” and "experimenter's board" msp430 microcontroller platforms and code composer essentials. OpenStax CNX. May 19, 2009 Download for free at http://cnx.org/content/col10706/1.3
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Teaching and classroom laboratories based on the “ez430” and "experimenter's board" msp430 microcontroller platforms and code composer essentials' conversation and receive update notifications?

Ask