Jump to content


  • Content Count

  • Joined

  • Last visited

  1. Hey Guys, I need some help again. I need to read the ADC on an interrupt basis so basically when the vibration sensor is hit, it should send an interrupt to run a function. Otherwise it should stay in LPM0. Any ideas? Currently my code looks like this: #define __MSP430G2231__ #include #define PHOTOCELL BIT0 #define LED BIT6 int analogRead(unsigned int pin); void main() { volatile int val; int threshold = 45; WDTCTL = WDTPW + WDTHOLD; P1DIR |= LED; P1OUT = 0; ADC10CTL0 = ADC10ON + ADC10SHT_0 + SREF_0; for (; { val = analogRead(PHOTOCELL); if(val + 10 > th
  2. Hey Guys, Somebody probably already solved this issue and I wanted to learn. What is the best way to connect a battery to the LaunchPad? It has those 3 pins on the board. I specifically want to use a 9 volt battery and I already know how to use the voltage regulator but how do I make it look nice on connecting some sort of 3-prong cable to the power source of the board. Thanks!
  3. Okay, so right now, it looks like there is some noise issues. I have the vibration sensor connected just like this: Except I have a 3.3v zener diode. I have the transistor hooked up exactly like the schematic shown here: http://processors.wiki.ti.com/index.php ... _Drive_LED I first tested out the transistor by it self, and it works. My main problem right now is when I put this code for the vibration sensor (Please check the code if I messed up anything) #define __MSP430G2231__ #include #define PHOTOCELL BIT0 int analogRead(unsigned int pin); void main() { volati
  4. I still see something messed up. When I hook up the transistor to the LED connected to P1.6, the LED does not turn off. Its very strange. Also, whenever I put my finger close to the ground wires, the LED lights up. Any ideas? NatureTM: Are you sure that the code is working the way it is? It seems like it is while turning on the on-board LED's. Also, Do I need to configure the timers on the pins in my code? I need to input a value on P1.0 and output an LED signal on P1.6. The code that I am currently using: #define __MSP430G2231__ #include #define PHOTOCELL BIT0 int anal
  5. Wait did you connect a Piezo Vibration Sensor to it? Yea I know it works now, thanks tho, but I am still trying to figure out how to read the Vibration Sensor... Any ideas?
  6. #define __MSP430G2231__ #include #define PHOTOCELL INCH_0 // photocell divider on P1.0/A0 int analogRead(unsigned int pin); void main() { volatile unsigned int val; WDTCTL = WDTPW + WDTHOLD; // kill wdt+ P1OUT = 0x00; ADC10CTL0 = ADC10ON + ADC10SHT_0 + SREF_0; // ACD10 on, 4 clock cycles per sample, Use Vcc/Vss references // change frequency to ~15.25mhz (DCO(15,3)) BCSCTL1 |= (BIT0 + BIT1 + BIT2 + BIT3); DCOCTL &= ~(BIT7); DCOCTL |= (BIT6 + BIT5); for (; { val = analogRead(PHOTOCELL); } } int analogRead(unsigned int pin) { ADC10CTL1 = ADC10SSEL_2 + pin;// Selec
  7. Wait I hope that means that you are going to help me?!?
  8. Man I dont think so... I need to get this working by tomorrow... I underestimated the complexity of MSP430 Programming. I made tons of projects with the Arduino, but the LaunchPad coding is much more confusing... Yea I know how to read it, sort of. Can you guys sort of edit the code and I will test it out and sort of guide me through it?
  9. Yea I am really confused man... I think Ill need some serious help please. Any help? The problem is I cant read the voltage levels on the Local Debug window. It keeps saying 86...
  10. Im actually having trouble reading val... once second please.
  11. Umm... 1. C 2. B As far as I know, for number two, you can constrain the values any way you want. I have seen both 0 to 255 and 0 to 1023 used.
  12. Okay, How do I know if I am reading the voltage correctly?
  13. Okay, so all I need to do is call analogRead() on the pin that I am reading the Vibration Sensor, make an if statement comparing it with a threshold, and turn on an LED if it passes it? Is the rectifier/capacitor necessary? Is it required? Oh and sorry about the two posts. I actually was in a hurry in the beginning and forgot about my previous post. Wont happen again!
  • Create New...