Hello! I just wanna begin by saying how much I am loving the msp430 Launchpad!
Its a very versatile learning tool. I am okay at programming hardware and have
had some experience with the launchpad, tinkering with it my self. However I
have run into a problem:
I am trying to develop a code that accepts input through one of the general
purpose I/O pins( specifically a set of two inputs spaced apart at a particular
time interval) and outputs a logic high at another pin to drive a transistor
circuit (external) if the duration between two input signals has met a
predetermined requirement.
At first I though of sampling a particular channel through the ADC10. I set up
the code but I saw that it consistently sampled(even in sample once mode) an
input pin and even the slightest physical touch triggered a voltage detection.
So that solution was of the door.
Second one was to access the capture of the TimerA in msp430g2231. The pseudo
code i have developed is :
1- Wait for an external trigger to start the capture
2- wait for another external trigger to stop the capture
3- check the difference of the two captures
4- IF the difference has met the predetermined requirement, then output high on
a pin
5- IF NOT, then begin from step 1 again, till the requirement has been met
A point to mention is that I am not going to be feeding a particular waveform
for that matter. Its just going to be a voltage level held a particular value
for 1 sec and then drop down to zero. This should trigger the capture for timer
A. The second signal, like the first one, should do the same.
Is this do-able or am I looking in the wrong direction? Thanks in advance for
looking and trying to help!!! :)
Capture Mode Timer A
Started by ●September 4, 2011
Reply by ●September 4, 20112011-09-04
--- In m..., "next2revolution" wrote:
>
> Hello! I just wanna begin by saying how much I am loving the msp430 Launchpad! Its a very versatile learning tool. I am okay at programming hardware and have had some experience with the launchpad, tinkering with it my self. However I have run into a problem:
>
> I am trying to develop a code that accepts input through one of the general purpose I/O pins( specifically a set of two inputs spaced apart at a particular time interval) and outputs a logic high at another pin to drive a transistor circuit (external) if the duration between two input signals has met a predetermined requirement.
>
> At first I though of sampling a particular channel through the ADC10. I set up the code but I saw that it consistently sampled(even in sample once mode) an input pin and even the slightest physical touch triggered a voltage detection. So that solution was of the door.
>
> Second one was to access the capture of the TimerA in msp430g2231. The pseudo code i have developed is :
>
> 1- Wait for an external trigger to start the capture
> 2- wait for another external trigger to stop the capture
> 3- check the difference of the two captures
> 4- IF the difference has met the predetermined requirement, then output high on a pin
> 5- IF NOT, then begin from step 1 again, till the requirement has been met
>
> A point to mention is that I am not going to be feeding a particular waveform for that matter. Its just going to be a voltage level held a particular value for 1 sec and then drop down to zero. This should trigger the capture for timer A. The second signal, like the first one, should do the same.
>
> Is this do-able or am I looking in the wrong direction? Thanks in advance for looking and trying to help!!! :)
>
First, I'm a hobbyist with limits on both my knowledge and experience. So, take the following with all the salt you prefer..
My first question: Is your signal analog or digital?
Looking at an analog signal for a trigger level is going to likely require using the ADC to sample on some timed basis. And, of course, you'll need to decide what your triggers for "high" and "low" are.
On the otherhand, if the input is digital, you can set the flag on your input pin to monitor both the transistions to high and low, measuring the duration in beteween with your timer which you trigger on the first transisiton, and sleep at the second. With the digital signal you could put your device into LPM4 and wakeup on transitions. With the analog you're going to have to be a little more proactive and use something like LPM3 with a timer waking the ADC... HTH
Bob
>
> Hello! I just wanna begin by saying how much I am loving the msp430 Launchpad! Its a very versatile learning tool. I am okay at programming hardware and have had some experience with the launchpad, tinkering with it my self. However I have run into a problem:
>
> I am trying to develop a code that accepts input through one of the general purpose I/O pins( specifically a set of two inputs spaced apart at a particular time interval) and outputs a logic high at another pin to drive a transistor circuit (external) if the duration between two input signals has met a predetermined requirement.
>
> At first I though of sampling a particular channel through the ADC10. I set up the code but I saw that it consistently sampled(even in sample once mode) an input pin and even the slightest physical touch triggered a voltage detection. So that solution was of the door.
>
> Second one was to access the capture of the TimerA in msp430g2231. The pseudo code i have developed is :
>
> 1- Wait for an external trigger to start the capture
> 2- wait for another external trigger to stop the capture
> 3- check the difference of the two captures
> 4- IF the difference has met the predetermined requirement, then output high on a pin
> 5- IF NOT, then begin from step 1 again, till the requirement has been met
>
> A point to mention is that I am not going to be feeding a particular waveform for that matter. Its just going to be a voltage level held a particular value for 1 sec and then drop down to zero. This should trigger the capture for timer A. The second signal, like the first one, should do the same.
>
> Is this do-able or am I looking in the wrong direction? Thanks in advance for looking and trying to help!!! :)
>
First, I'm a hobbyist with limits on both my knowledge and experience. So, take the following with all the salt you prefer..
My first question: Is your signal analog or digital?
Looking at an analog signal for a trigger level is going to likely require using the ADC to sample on some timed basis. And, of course, you'll need to decide what your triggers for "high" and "low" are.
On the otherhand, if the input is digital, you can set the flag on your input pin to monitor both the transistions to high and low, measuring the duration in beteween with your timer which you trigger on the first transisiton, and sleep at the second. With the digital signal you could put your device into LPM4 and wakeup on transitions. With the analog you're going to have to be a little more proactive and use something like LPM3 with a timer waking the ADC... HTH
Bob
Reply by ●September 4, 20112011-09-04
Thanks for the reply. Yeah it is an analogue signal. Using the ADC..im not too
sure about that. Ive tried using the ADC at the Vref of 2.5V but even a human
touch triggers it. I dont know why though.
--- In m..., "Bob" wrote:
>
> --- In m..., "next2revolution" wrote:
> >
> > Hello! I just wanna begin by saying how much I am loving the msp430 Launchpad! Its a very versatile learning tool. I am okay at programming hardware and have had some experience with the launchpad, tinkering with it my self. However I have run into a problem:
> >
> > I am trying to develop a code that accepts input through one of the general purpose I/O pins( specifically a set of two inputs spaced apart at a particular time interval) and outputs a logic high at another pin to drive a transistor circuit (external) if the duration between two input signals has met a predetermined requirement.
> >
> > At first I though of sampling a particular channel through the ADC10. I set up the code but I saw that it consistently sampled(even in sample once mode) an input pin and even the slightest physical touch triggered a voltage detection. So that solution was of the door.
> >
> > Second one was to access the capture of the TimerA in msp430g2231. The pseudo code i have developed is :
> >
> > 1- Wait for an external trigger to start the capture
> > 2- wait for another external trigger to stop the capture
> > 3- check the difference of the two captures
> > 4- IF the difference has met the predetermined requirement, then output high on a pin
> > 5- IF NOT, then begin from step 1 again, till the requirement has been met
> >
> > A point to mention is that I am not going to be feeding a particular waveform for that matter. Its just going to be a voltage level held a particular value for 1 sec and then drop down to zero. This should trigger the capture for timer A. The second signal, like the first one, should do the same.
> >
> > Is this do-able or am I looking in the wrong direction? Thanks in advance for looking and trying to help!!! :)
> > First, I'm a hobbyist with limits on both my knowledge and experience. So, take the following with all the salt you prefer..
>
> My first question: Is your signal analog or digital?
> Looking at an analog signal for a trigger level is going to likely require using the ADC to sample on some timed basis. And, of course, you'll need to decide what your triggers for "high" and "low" are.
> On the otherhand, if the input is digital, you can set the flag on your input pin to monitor both the transistions to high and low, measuring the duration in beteween with your timer which you trigger on the first transisiton, and sleep at the second. With the digital signal you could put your device into LPM4 and wakeup on transitions. With the analog you're going to have to be a little more proactive and use something like LPM3 with a timer waking the ADC... HTH
>
> Bob
>
--- In m..., "Bob" wrote:
>
> --- In m..., "next2revolution" wrote:
> >
> > Hello! I just wanna begin by saying how much I am loving the msp430 Launchpad! Its a very versatile learning tool. I am okay at programming hardware and have had some experience with the launchpad, tinkering with it my self. However I have run into a problem:
> >
> > I am trying to develop a code that accepts input through one of the general purpose I/O pins( specifically a set of two inputs spaced apart at a particular time interval) and outputs a logic high at another pin to drive a transistor circuit (external) if the duration between two input signals has met a predetermined requirement.
> >
> > At first I though of sampling a particular channel through the ADC10. I set up the code but I saw that it consistently sampled(even in sample once mode) an input pin and even the slightest physical touch triggered a voltage detection. So that solution was of the door.
> >
> > Second one was to access the capture of the TimerA in msp430g2231. The pseudo code i have developed is :
> >
> > 1- Wait for an external trigger to start the capture
> > 2- wait for another external trigger to stop the capture
> > 3- check the difference of the two captures
> > 4- IF the difference has met the predetermined requirement, then output high on a pin
> > 5- IF NOT, then begin from step 1 again, till the requirement has been met
> >
> > A point to mention is that I am not going to be feeding a particular waveform for that matter. Its just going to be a voltage level held a particular value for 1 sec and then drop down to zero. This should trigger the capture for timer A. The second signal, like the first one, should do the same.
> >
> > Is this do-able or am I looking in the wrong direction? Thanks in advance for looking and trying to help!!! :)
> > First, I'm a hobbyist with limits on both my knowledge and experience. So, take the following with all the salt you prefer..
>
> My first question: Is your signal analog or digital?
> Looking at an analog signal for a trigger level is going to likely require using the ADC to sample on some timed basis. And, of course, you'll need to decide what your triggers for "high" and "low" are.
> On the otherhand, if the input is digital, you can set the flag on your input pin to monitor both the transistions to high and low, measuring the duration in beteween with your timer which you trigger on the first transisiton, and sleep at the second. With the digital signal you could put your device into LPM4 and wakeup on transitions. With the analog you're going to have to be a little more proactive and use something like LPM3 with a timer waking the ADC... HTH
>
> Bob
>
Reply by ●September 5, 20112011-09-05
I'm going to have to plead a level of ignorance when it comes to the
launchpad - I have a couple, but have only fired one up briefly, and really
haven't explored any of the sample code. I've been more focused on
the 2013, 2274, and a couple of the LCD-capable chips for my hobby projects.
However, googling on "msp430g2231 ADC" (without the quotes...) I ran across this
article, which you might find of use:
http://www.msp430launchpad.com/2010/09/simple-adc-example-on-launchpad.html
Also, there's really no effective way to work with the MSP430 devices without doing the homework of reading the family guides, as well as, the device specific tech docs. Finally, there are dozens of sample programs on TI's site, generally focusing on the various timers, ADCs, and other peripherals. Even if you don't run their code, there are the occasional nuggets contained within... HTH
Bob
--- In m..., "next2revolution" wrote:
>
> Thanks for the reply. Yeah it is an analogue signal. Using the ADC..im not too sure about that. Ive tried using the ADC at the Vref of 2.5V but even a human touch triggers it. I dont know why though.
>
> --- In m..., "Bob" wrote:
> >
> > --- In m..., "next2revolution" wrote:
> > >
> > > Hello! I just wanna begin by saying how much I am loving the msp430 Launchpad! Its a very versatile learning tool. I am okay at programming hardware and have had some experience with the launchpad, tinkering with it my self. However I have run into a problem:
> > >
> > > I am trying to develop a code that accepts input through one of the general purpose I/O pins( specifically a set of two inputs spaced apart at a particular time interval) and outputs a logic high at another pin to drive a transistor circuit (external) if the duration between two input signals has met a predetermined requirement.
> > >
> > > At first I though of sampling a particular channel through the ADC10. I set up the code but I saw that it consistently sampled(even in sample once mode) an input pin and even the slightest physical touch triggered a voltage detection. So that solution was of the door.
> > >
> > > Second one was to access the capture of the TimerA in msp430g2231. The pseudo code i have developed is :
> > >
> > > 1- Wait for an external trigger to start the capture
> > > 2- wait for another external trigger to stop the capture
> > > 3- check the difference of the two captures
> > > 4- IF the difference has met the predetermined requirement, then output high on a pin
> > > 5- IF NOT, then begin from step 1 again, till the requirement has been met
> > >
> > > A point to mention is that I am not going to be feeding a particular waveform for that matter. Its just going to be a voltage level held a particular value for 1 sec and then drop down to zero. This should trigger the capture for timer A. The second signal, like the first one, should do the same.
> > >
> > > Is this do-able or am I looking in the wrong direction? Thanks in advance for looking and trying to help!!! :)
> > >
> >
> > First, I'm a hobbyist with limits on both my knowledge and experience. So, take the following with all the salt you prefer..
> >
> > My first question: Is your signal analog or digital?
> > Looking at an analog signal for a trigger level is going to likely require using the ADC to sample on some timed basis. And, of course, you'll need to decide what your triggers for "high" and "low" are.
> > On the otherhand, if the input is digital, you can set the flag on your input pin to monitor both the transistions to high and low, measuring the duration in beteween with your timer which you trigger on the first transisiton, and sleep at the second. With the digital signal you could put your device into LPM4 and wakeup on transitions. With the analog you're going to have to be a little more proactive and use something like LPM3 with a timer waking the ADC... HTH
> >
> > Bob
>
Also, there's really no effective way to work with the MSP430 devices without doing the homework of reading the family guides, as well as, the device specific tech docs. Finally, there are dozens of sample programs on TI's site, generally focusing on the various timers, ADCs, and other peripherals. Even if you don't run their code, there are the occasional nuggets contained within... HTH
Bob
--- In m..., "next2revolution" wrote:
>
> Thanks for the reply. Yeah it is an analogue signal. Using the ADC..im not too sure about that. Ive tried using the ADC at the Vref of 2.5V but even a human touch triggers it. I dont know why though.
>
> --- In m..., "Bob" wrote:
> >
> > --- In m..., "next2revolution" wrote:
> > >
> > > Hello! I just wanna begin by saying how much I am loving the msp430 Launchpad! Its a very versatile learning tool. I am okay at programming hardware and have had some experience with the launchpad, tinkering with it my self. However I have run into a problem:
> > >
> > > I am trying to develop a code that accepts input through one of the general purpose I/O pins( specifically a set of two inputs spaced apart at a particular time interval) and outputs a logic high at another pin to drive a transistor circuit (external) if the duration between two input signals has met a predetermined requirement.
> > >
> > > At first I though of sampling a particular channel through the ADC10. I set up the code but I saw that it consistently sampled(even in sample once mode) an input pin and even the slightest physical touch triggered a voltage detection. So that solution was of the door.
> > >
> > > Second one was to access the capture of the TimerA in msp430g2231. The pseudo code i have developed is :
> > >
> > > 1- Wait for an external trigger to start the capture
> > > 2- wait for another external trigger to stop the capture
> > > 3- check the difference of the two captures
> > > 4- IF the difference has met the predetermined requirement, then output high on a pin
> > > 5- IF NOT, then begin from step 1 again, till the requirement has been met
> > >
> > > A point to mention is that I am not going to be feeding a particular waveform for that matter. Its just going to be a voltage level held a particular value for 1 sec and then drop down to zero. This should trigger the capture for timer A. The second signal, like the first one, should do the same.
> > >
> > > Is this do-able or am I looking in the wrong direction? Thanks in advance for looking and trying to help!!! :)
> > >
> >
> > First, I'm a hobbyist with limits on both my knowledge and experience. So, take the following with all the salt you prefer..
> >
> > My first question: Is your signal analog or digital?
> > Looking at an analog signal for a trigger level is going to likely require using the ADC to sample on some timed basis. And, of course, you'll need to decide what your triggers for "high" and "low" are.
> > On the otherhand, if the input is digital, you can set the flag on your input pin to monitor both the transistions to high and low, measuring the duration in beteween with your timer which you trigger on the first transisiton, and sleep at the second. With the digital signal you could put your device into LPM4 and wakeup on transitions. With the analog you're going to have to be a little more proactive and use something like LPM3 with a timer waking the ADC... HTH
> >
> > Bob
>