<< Chapter < Page Chapter >> Page >
Using the MSP-EXP430FG4618 Development Tool analyse the Comparator_A operation. A voltage is applied to one of the Comparator’s inputs, generated optionally by the DAC12 or by other external source. Whenever the external voltage value is higher than the comparison value internally generated, it is generated an interrupt that switches the LED state.

Laboratory signal acquisition: lab4 - voltage signal comparison with comparator_a

Introduction

This laboratory gives examples of the uses of the ADC types available in the hardware development kits. A different laboratory is developed for each kit, taking into account that both the ADC10 and the SD16_A laboratories implement a temperature data logger. The ADC12 laboratory also uses operational amplifiers to perform the analogue signal conditioning.

Overview

This laboratory ( Lab4_ADC.c ) analyses Comparator_A operation. A voltage is applied to one of the Comparator’s inputs, generated either by the DAC12 or by other external source. Whenever the external voltage value is higher than the comparison value internally generated, an interrupt is generated that switches the LED state.

Resources

The resources used by the application are:

- DAC12;

- Comparator_A;

- Digital IO;

- Timer_A.

Software application organization

The application starts by stopping the Watchdog Timer.

Timer_A is configured to generate an interrupt once every msec, and updates the DAC12 output in order to provide a ramp signal.

The Comparator_A’s output is configured to be accessible at pin P6.6, which is available on Header 4 pin 7. The signal applied to CA0 input is compared with 0.5 V cc internal reference voltage. Every time that a compare match occurs, an interrupt is requested and switches the state of LED1.

System configuration

Comparator_a configuration

Configure the registers in order to receive the external signal at the CA0 input and compare it with the internal reference 0.5 V cc . Enable the comparator with an interrupt triggered on a low-to-high transition of the comparator output.

CACTL1 = CAON | CAREF_2 | CARSEL | CAIE; // Enable comp, ref = 0.5*Vcc CACTL2 = P2CA0; // Pin to CA0P2DIR |= 0x042; // P2.1 and P2.6 output direction P2SEL |= 0x040; // P2.1 = LED1 and P2.6 = CAOUTCACTL1 |= CAIE; // Setup interrupt for Comparator //*********************************************************// Comp_A interrupt service routine -- toggles LED //*********************************************************#pragma vector=COMPARATORA_VECTOR __interrupt void Comp_A_ISR (void){ CACTL1 ^= CAIES; // Toggles interrupt edgeP2OUT ^= 0x02; // Toggle P2.1 }

Adc12 configuration

ADC12CTL0 = REF2_5V + REFON; // Internal 2.5V ref on

Dac12 configuration

DAC12_0DAT = 0x00; // DAC_0 output 0V

DAC12_0CTL = DAC12IR | DAC12AMP_5 | DAC12ENC; // DAC_0->P6.6 // DAC reference Vref// 12 bits resolution // Imediate load// DAC full scale output // Medium speed/current// Straight binary // Not grouped

Timer_a configuration

// Compare mode TAR = 0; // TAR resetTACCR0 = 13600; // Delay to allow Ref to settle TACCTL0 |= CCIE; // Compare-mode interruptTACTL = TACLR + MC_1 + TASSEL_2; // up mode, SMCLK // Interrupt enableTAR = 0; // TAR reset TACCTL0 = CCIE; // CCR0 interrupt enabledTACCR0 = 32; // 1 msec counting period TACTL = TASSEL_1 | MC_1 | ID_0; // ACLK, up mode//********************************************************* // ISR to TACCRO from Timer A//********************************************************* #pragma vector=TIMERA0_VECTOR__interrupt void TimerA0_ISR (void) {DAC12_0DAT++; if (DAC12_0DAT == 0xFFF) DAC12_0DAT = 0;if (flag == 1) // if flag active exit LPM0{ flag = 0;LPM0_EXIT; }}

Analysis of operation

The experimental verification of this laboratory can be accomplished by connecting the DAC12’s output, available on Header 8 pin 7, to the Comparator_A’s input CA0, available on Header 4 pin 7.

Observe the signals wave form at the Comparator_A’s input and output using an oscilloscope. The LED1 switches state whenever the input’s voltage value is lower than the compare value.

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

how can chip be made from sand
Eke Reply
is this allso about nanoscale material
Almas
are nano particles real
Missy Reply
yeah
Joseph
Hello, if I study Physics teacher in bachelor, can I study Nanotechnology in master?
Lale Reply
no can't
Lohitha
where is the latest information on a no technology how can I find it
William
currently
William
where we get a research paper on Nano chemistry....?
Maira Reply
nanopartical of organic/inorganic / physical chemistry , pdf / thesis / review
Ali
what are the products of Nano chemistry?
Maira Reply
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
Google
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
hey
Giriraj
Preparation and Applications of Nanomaterial for Drug Delivery
Hafiz Reply
revolt
da
Application of nanotechnology in medicine
has a lot of application modern world
Kamaluddeen
yes
narayan
what is variations in raman spectra for nanomaterials
Jyoti Reply
ya I also want to know the raman spectra
Bhagvanji
I only see partial conversation and what's the question here!
Crow Reply
what about nanotechnology for water purification
RAW Reply
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
Brian Reply
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
LITNING Reply
what is a peer
LITNING Reply
What is meant by 'nano scale'?
LITNING Reply
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
Bob Reply
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
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