Jump to content

ElevenToes

Members
  • Content Count

    7
  • Joined

  • Last visited

  1. ElevenToes

    Stuck

    Ok, i will try that
  2. ElevenToes

    Stuck

    Sorry about that, TACCR0 = 800; is the position of 0 degrees. So i wanna go back and forth between these two positions infinitely.
  3. ElevenToes

    Stuck

    I am trying to control a servo using an external push button on a breadboard. What am trying to do is when button is pressed servo goes to 90 degrees, when pushed again it goes back to 0 degrees. So far i have it going 90 degrees but i have been having trouble moving it back to zero. #define button1 BIT1#define clk_freq 1000000 #define servo_freq 50 int main(void){ WDTCTL = WDTPW + WDTHOLD; int period = clk_freq / servo_freq; P1DIR |= servo; P1SEL |= servo; TACCR0 = period; TACCR1 = 0; TACCTL1 = OUTMOD_7; TACTL = TASSEL_2 + MC_1; while(1){ if((P1IN & button1)==BIT1) { TACCR1 = 1650; } //if button press again go to 0 degrees } }
  4. Hello, am relatively new to the MSP430 and my coding skills aren't that good yet, am using c on IAR. But am trying to produce this signal:http://www.modeltrainbuilder.com/DCC-operation.html . i kinda get the concept, but implementing it is a problem. I know you can set timer0 to a faster frequency, say 35KHz so that a period of 28us and then timer1 to output the signal. So for example if a bit is '1' Timer1 goes high for 2 timer0 periods and then low the same, and when a bit is '0' timer1 stays high for 4 timer0 periods and then low the same amount. An example code or anything really will be very helpful.
  5. Looking forward to meeting new people and learning about the msp430 as much as possible
×
×
  • Create New...