Jump to content


  • Content Count

  • Joined

  • Last visited

  1. Yes of course! Another question. How can I power the receiver circuit using the mains line in a safe way?
  2. Hey guys, I'm interested in building a remote-controlled (IR) light dimmer using the MSP430 for both the transmitter and the receiver. I'm still in the design phase, but I think I've figured most of it out. But because I'm still new to electronics, I don't know the best way to do things or what components there are out there. I have two issues in particular: [*:3mo52mus]- Is there a knob (just like those in a wall-mounted dimmer) which is NOT a pot but a free-rotating wheel with a way of sensing rotation clockwise and counter-clockwise? Does something like this exist? [*:3mo52mus]- The way I have it set right now, the transmitter will send an up or down command and the receiver in the switchbox must then somehow raise or lower the light intensity. What's the most elegant way of doing this? (Short of strapping a motor to a potentiometer). Is there some kind of 'electronic potentiometer'? Thanks for the help!
  3. Ah, I see. Is there a way to turn this off?
  4. Yup! That was the problem. I removed the RST jumper and it works fine now. Thanks! Edit: Actually I was wrong. The jumper isn't what makes the difference between working and not working. What makes the difference is whether or not you're debugging it or not. It only seems to work when you're not in debugging mode.
  5. I've been tryin to get the code posted there to work on my EXP430G2 board (rev 1.4) with the G2231 but to no avail (even a straight copy/paste doesn't work). The code compiles and runs, but pressing the switch does absolutely nothing. Am I supposed to change something if I'm using the G2231? One thing I thought was the problem was this line: #define FLIP_HOLD (0x3300 | WDTHOLD) /* flip HOLD while preserving other bits */ Shouldn't the 0x3300 part be 0x5A00 (WDTPW)? (Although I tried that with no go). I tried playing around with the code, but nothing seems to work. Also, many changes he makes to WDTCTL is missing WDTPW. Is that a mistake? I tried adding it, but didn't make a difference either.
  6. teoah

    Tip on unused pins

    N00b question, but I don't understand floating pins. How can it make any difference if the pin isn't connected to anything? How can input ever read as 1 if there's no current?
  7. Thanks both of you for clearing up the watchdog timer question! Ah ok. I'm starting to understand. So when I do, for example, P1DIR |= BIT0 It translates into an instruction (BIS.B from what I see?) which sets the first bit of the Port 1 direction register, which then sets the first I/O pin on Port 1 as output, using logic gates. Then, when I do P1OUT |= BIT0 I set the output on the first I/O pin on Port 1 to high, which basically means to let the current go through? (ie. turn on the LED if there's an LED there). So then, is "writing to a pin" the same thing as "setting the output to high or low" ? Two more questions: - So each pin that can both be an input and an output has two different circuits to toggle between the two modes? - What are pullup/pulldown resistors? Or when are they supposed to be enabled? - What's PUC?
  8. Thanks for the reply bluehash! Yes, I understand that. My question is, how do I tickle the dog (using code) if I don't want to put him to sleep? Or is the dog tickled automatically? Yes! That's what I mean. What does it mean to set a pin as input or output?
  9. From what I understand, using OR is not the same at all as using +. For example: 1001 OR 1100 = 1101 (in decimals -> 9 OR 12 = 13) but 13 in binary is 10101, not 1101. So the end result is not the same.
  10. Thanks for the warm welcome. It works like a charm! Being completely new to this world, I have a few general questions (let me know if I should post it in another subforum): - Are all variables limited to 16 bits? For example, my DELAY variable has a maximum value of 0xFFFF. How would I go about sleeping for longer, say... 0xFFFFFFFF? (short of looping in a loop I guess). - I kind of understand why we need to disable the watchdog timer, but what if I wanted to leave it on? How would I make sure that it won't reset my program unexpectedly, but still reset it if it crashes? (Not sure if this question even makes sense) - What does volatile mean? It works just as well when I try without it. - I understand the idea of registers and instructions, but the concept of input/output is still a bit fuzzy. Where can I read some more about it? Thanks!
  11. Hi, I am a newb (both in C and programmers) with an MSP430G2231 mounted on a LaunchPad. I successfully compiled the "Hello World" program: #include "msp430g2231.h" #define LEDRED BIT0; #define DELAY (0xFFFF); void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1DIR |= LEDRED; // Set P1.0 to output direction P1OUT &= ~LEDRED; // Turn off LED while (1) { P1OUT ^= LEDRED; // Toggle LED volatile unsigned int i = DELAY; // Delay while (i != 0) i--; } } Right now, I'm trying to also get the green LED to blink as well, so I have the following code: #include "msp430g2231.h" #define LEDRED BIT0; #define LEDGREEN BIT6; #define DELAY (0xFFFF); void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1DIR |= LEDRED + LEDGREEN; // Set P1.0 to output direction P1OUT &= ~(LEDRED + LEDGREEN); // Turn off LED while (1) { P1OUT ^= LEDRED + LEDGREEN; // Toggle LED volatile unsigned int i = DELAY; // Delay while (i != 0) i--; } } But for some reason, it just won't compile! It tells me "expression has no effect on the three lines with LEDGREEN, and "expected an expression" at the ~(LEDRED + LEDGREEN) line. The weird thing is that when I use BIT0 and BIT6 instead of LEDRED and LEDGREEN, everything compiles fine! Anyone knows what's going on here?
  • Create New...