
iragdoll
Members-
Content Count
45 -
Joined
-
Last visited
About iragdoll
-
Rank
Advanced Member
-
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
-
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!
-
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
-
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
-
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?
-
#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
-
Wait I hope that means that you are going to help me?!?
-
Haha lol... Me neither...
-
Like money wise?
-
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?
-
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...
-
Im actually having trouble reading val... once second please.
-
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.
-
Okay, How do I know if I am reading the voltage correctly?
-
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!