Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by athornsb

  1. Ok so I'm actually using RobGs code now plugged into my interrupt. P2IES=0, and the pullup resistors are turned on. Turning the switch either direction it only counts down, and seems to fire multiple times per transition. (I'm about to try debouncing this)
  2. It is configured for 0 to 1 detection (P2IES=0x00). It seems like maybe the processor isn't referencing ground/0 correctly.
  3. Hey all, I'm completely stumped on a bug for my design day project. I've got a rotary encoder that is used to change a value on an LCD screen. The code works perfectly when the encoders state at power up is 00. However if either pin is high, it doesn't work at all. Some transitions will cause the value on the screen to move in the wrong direct, and some transitions don't seem to trigger an interrupt at all. This is the code I'm using and would LOVE some help! Is it possible that the MSP430 is recording the initial values as reference voltages causing subsequent interrupts to not work?
  4. Thanks to both of you. I used something similar to what you both mentioned. Since I need LPM3 for my application, I used the basic principles you two mentioned except with my VLO sourced timer A0. I essentially wrote my existing encoder interrupt into the timer with a way to measure delay. Now all I do in my encoder interrupt is: inactivity=0; //reset the inactivity counter sample_flag=1; P2IE &= ~GRAY0; //deactivate further switch interrupts P2IE &= ~GRAY1; Once the delay has been measured with the timer and a sample taken, it clears the P2IF
  5. Rob, my only worry is if 32ms may be too long for a rotary encoder. That would give me a maximum of 30 position changes/second which seems reasonable, I just don't want to end up missing more than 1-2 position changes since that could confuse the software about which direction its spinning. Since your option is the easiest in terms of how much extra code I have to write I think I'll try that first.
  6. Hey road runner, could you explain how that main code functions? I need my code to stay in low power mode 3 as much of the time as possible (it's a low-power solar application). It would be ideal to have a debounce flag, controlled by my timer ISR, that could wake the CPU temporarily to sample the value of the gray code switch. Ike thanks, but I don't think that debounce code will work for my application. That code appears to check the switch only so often to avoid the stutter you typically get with a bunch button. However with a rotary gray code switch, I need more of an average. At
  7. Hey all. I'm using an msp430g2553 to output an integer to an LCD and let that integer to be modified with a rotating gray code switch. I am attempting to debounce the switch by sampling its value every 1ms for 5ms (5 samples) each time the switch interrupt fires. I am trying to accomplish this with the following code: for(i=0; i<SAMPLE_NUM; i++) { ms=0; while(ms==0) { //do nothing until at least 1 ms has elapsed } gray0_val = P2IN&GRAY0; //latch current port pin values gray1_val = P2IN&GRAY1; The issue is at line 2-3 where I re
  8. Actually I see now that it's the P1SEL definition that controls if the pin is pulse width modulated, allowing me to use that option to send it to just one of my pins. Sorry, please ignore this post!
  9. I'm looking to refresh the LCD in our project at 30-90Hz. I have found the included code online, but don't understand how the signal is being tied to the output pins. I have a lot of pins set to output already, and need the PWM signal to only be present on one. Oh, and because of intense power restrictions, I am using the VLO for my timer interrupts and will need to use it for the PWM signal as well. NOTE: the PWM mode that toggles from high to -high will need to be used, instead of high to ground. Thanks guys! #include "msp430x21x2.h" void main(void) { WDTCTL = WDTPW + WDTHOLD; /
  10. That's perfect, thanks. I'm gonna head off and watch the low power video for anything I missed, and then go back to the lab and re test this thing! Oh and it may have been, I can't remember (I assumed this was some TI chip i wasn't familiar with). I used it in a class for NC State, but that class is actually moving away from Renesas in favor of TI now.
  11. Actually it's a senior project. We are using a G series launchpad for now, but will be transitioning to a 1 series chip on a bread board once all of the code works.
  12. Oh just to give you a little more info about the project..... It's incredibly simple. We need an MSP430 connected to a solar cell or cells, a 3 digit LCD, and a graycode switch. The MCU will let users change a single parameter with the switch, and output the value to the display. It also must run off a relatively small solar cell, and spend much of its time in a low light space. We are designing a little additional hardware to power it (cap(s) and maybe a charge pump, so instantaneous power draw isnt much of a concern). I don't anticipate needing more than 2 counter interrupts and a si
  13. Ok so that means I dont need to set ADC10 Data Transfer Control or ADC10 Control bits? Again thanks, I've programmed a Renesas micro controller before, but never a TI, so a lot of this is new to me.
  14. Thanks, I'll check out those getting started labs just to be sure. Ok last 2 questions, hopefully!... What is the most power efficient way to debounce a switch? In the past I just incremented a global variable with a fast timer interrupt, but I would hate to wake our system that often. Do I need to turn the ADC off in some way, or has switching off any unnecessary clocks already accomplished this? I read elsewhere that the ADC is a power hog and can interfere with LPM. Thanks.
  15. Oh is there anything I need to know about testing the power draw? If your suggestions don't reduce the power dramatically, I'll be totally at a loss. We have been connecting the Vcc and ground to a 2.2V power supply (after removing the MSP430 from the launchpad board). Then we connect a multimeter to measure the current draw.
  16. Thanks! Will do. Change I made as well that might change things: I changed my IDE to deploy in release mode rather than debug mode. I wondered if maybe debug code in main was breaking me out of low power mode. Also, have I configured the main clock for 1Mhz correctly? We want it to run at the lowest speed regardless of supply voltage.
  17. Thanks for the P2SEL tip. We havent connected any other components to the board, and we are actually DETACHING the MSP430 chip from the board to test power draw. We are using the board for development and code deployment only, and it won't be used in our final build. (mainly because yes, we noticed that the LEDs and their resistors use quite a bit of power)
  18. At this point no. Eventually we will be connecting a gray code switch and LCD panel. And yes we tried both a program that immediately (first line of code) puts it in LPM4, as well as a LPM example copy pasted from the MSP430 wiki. Both produced the same result as my code.
  19. P.S. Any power optimizations that can be made to that code that you guys spot, even if its not the core of the problem, would still be greatly appreciated! Clock precision isn't much of an issue for what we're doing, which is why I'm already using VLO for the interrupt.
  20. The same question is posted on reddit here: http://redd.it/18bkdl We are meeting with our project sponsors tonight and would love to have some kind of answer as to what's going on with our power draw. We are using an MSP430 Launchpad to develop a small project to be powered by a solar cell. Eventually we will have a single hardware interrupt, and a 30 Hz counter interrupt to update an LCD. We have estimated our power budget to be around 20 micro Watts. Oddly, with the software I have written and provided below, we are getting around 30 micro amps at 2.2V when we separate the MSP fro
  • Create New...