Jump to content
Sign in to follow this  
mavis311

LaunchPad on-board button doesn't trigger interrupt

Recommended Posts

@bluehash For register info you need to use the MSP430 User guide, it has all the definitions of all the registers http://www.ti.com/litv/pdf/slau144e

the exact register settings for P1REN

8.2.4 Pullup/Pulldown Resistor Enable Registers PxREN

Each bit in each PxREN register enables or disables the pullup/pulldown

resistor of the corresponding I/O pin. The corresponding bit in the PxOUT

register selects if the pin is pulled up or pulled down.

Bit = 0: Pullup/pulldown resistor disabled

Bit = 1: Pullup/pulldown resistor enabled

and the second half you need is

If the pin

Share this post


Link to post
Share on other sites

Since my initial problem is solved, I just wanted to thank you all for your help. I've learned a good bit so far, but have even more to learn. I'm sure you'll continue to hear from me as I progress along this path.

 

Thanks!

Share this post


Link to post
Share on other sites

Okay, brain's back (barely).

 

At first I thought that the reason enabling the internal resistor has an effect is that there is an external resistor. When you enable the internal resistor, you are actually placing the internal resistor in parallel with the external resistor, thereby reducing the resistance. I tried this theory by changing everything to port 1.4 and attaching a button.

 

Wouldn't work. I finally figured out it would trigger on a high! For the life of me, I couldn't get it to trigger on low with that d#$% internal resistor enabled! It works fine with a high trigger, or with P1REN disabled and an external pull-up resistor.

 

I'm giving up on the internal resistors until I find the right herbs and incantations in the documentation, or someone tells me I have to sacrifice a chicken or something (not happening, made a mess of the circuit boards last time :lol: ).

 

-Doc

Share this post


Link to post
Share on other sites

Tried all the combos: internal enabled with/without external, internal disabled with/without external. With the internal enabled, I could only get it to trigger on a high (oddly, even with an external pull-up resistor). With the internal disabled, it acted as you would expect: triggered low well with external pull-up, slightly unstable, but still triggered low without external pull-up. All this regardless of the P1OUT setting for 1.4,

 

I think it has to do with FM ("Frakkin Magic").

 

-Doc

Share this post


Link to post
Share on other sites

I've never heard of this pull-up/-down resistor thing until all this.

Now let me know if I don't have even a slippery grasp of this, but I've been assuming that enabling the resistor prevented p1.3 from getting a high enough signal to trigger the interrupt.

 

 

BTW, I love this bit:

Okay, brain's back (barely).

...until I find the right herbs and incantations in the documentation, or someone tells me I have to sacrifice a chicken or something (not happening, made a mess of the circuit boards last time :lol: ).

Share this post


Link to post
Share on other sites

At this point, I can't get it to do what it's supposed to do at all.

 

The basic idea (how it's supposed to work) is that if you leave an input pin open (no connection/button not pressed), the voltage on that pin will wander randomly. At any given time, it could be at zero (low), at Vcc (high), or anywhere in between. If the voltage wanders low enough, we get a low reading (randomly). So, we put a pull-up resistor on the pin, keeping it (just barely) high. When you get an actual low on the pin (by connecting to ground through a button or other device), it's a lower resistance than the pull-up resistor, so it "pulls" the pin low. This can all be swapped for a "pull-down" resistor.

 

As you can tell from my previous post, I can't get the internal resistors to behave properly at all.

 

-Doc

Share this post


Link to post
Share on other sites

hopefully you have a similar setup on a pin

P1.4------------------[ button ] -------------ground or Vs

 

button connect to Ground

 

P1IN |= BIT4; //enables input
P1REN |= BIT4; // enables resistor
P1OUT |= BIT4; //resistor set to pull up
P1IES |= BIT4; //enables edge select of high to low
P1IE |= BIT4 //enables interrupt

 

 

button connected to +V (3v-5v)

 

P1IN |= BIT4; //enables input
P1REN |= BIT4; // enables resistor
P1IE |= BIT4 //enables interrupt
//P1OUT and P1IES are not used, but this is set to pull down resistor, and triggers low to high

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×