This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430 and Servo Motor (Triying,Triying and Triying...)

Other Parts Discussed in Thread: MSP430G2553

Hi everyone 

I have msp430 launchpad development kid. 

https://estore.ti.com/MSP-EXP430G2-MSP430-LaunchPad-Value-Line-Development-kit-P2031.aspx

this is my item.

And I bought an servo motor. 

this is my servo motor. And I want to move it. I try some c code and asm codes.

But it didnt work.

This is my assembly example code.

*
#include "msp430g2553.h"
;-------------------------------------------------------------------------------
ORG 0F800h ; Program Reset
;-------------------------------------------------------------------------------
RESET mov.w #0280h,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT
SetupP1 bis.b #001h,&P1DIR ; P1.0 output
MOV.B #XT2OFF+RSEL2+RSEL1+RSEL0,&BCSCTL1
MOV.B &CALDCO_1MHZ,&DCOCTL ; Then set target DCOx and
MOV.B &CALBC1_1MHZ,&BCSCTL1 ; Finally set target RSELx ;
Mainloop xor.b #001h,&P1OUT ; Toggle P1.0
call #wait
jmp Mainloop ; Again
;


wait mov.w #9FFh,R5
ss dec R5
jnz ss
ret



;-------------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
ORG 0FFFEh ; MSP430 RESET Vector
DW RESET ;
END

Thanks for ur help

  • Selim Erkan Oguz said:
    I try some c code and asm codes

    Microcontroller development is not about just "trying" random bits of code!

    It's about studying the requirements of your item (the servo) and the capabilities of your controller and then designing a system to meet the one with the other.

    http://bit.ly/pWAASo

     

  • I'm newbie in development. How can I do ?

    Where will I start? for servo driving.

  • Selim Erkan Oguz said:
    I'm newbie in development

    So what background/experience do you have?

    • Any form of programming?
       
    • 'C' programming specifically?
       
    • (basic) electronics?
       
    • basic understanding of microcontrollers in general - memory, CPU, registers, typical peripherals?
       

    Do you actually understand how a servo works, or how to control it?

     

  • Andy Neil said:

    I'm newbie in development

    So what background/experience do you have?

    • Any form of programming?
       
    • 'C' programming specifically?
       
    • (basic) electronics?
       
    • basic understanding of microcontrollers in general - memory, CPU, registers, typical peripherals?
       

    Do you actually understand how a servo works, or how to control it?

     

    [/quote]

    I have assembly less 

    C normal

    Basic electronics good.

    Microcontrollers not bad and not good.

    I research servos. And I learn something.

    This is a normal servo working system

    I think I must give a pulse 0,5 usn to 2400 usn. I didnt find good things for my servo (datasheet or good information) because chinese item.

    I setup my msp430g2553 frequency 1 Mhz with this code.

    MOV.B #XT2OFF+RSEL2+RSEL1+RSEL0,&BCSCTL1 
    MOV.B &CALDCO_1MHZ,&DCOCTL ; Then set target DCOx and
    MOV.B &CALBC1_1MHZ,&BCSCTL1 ; Finally set target RSELx ;

    my frequency is 1 MHz

    I think I will have 0,5 usn delay. I'm using my wait function for it.

    In 1 second 1Mhz progress

    In 0,5usn     x progress.

    x=1MHzx0,5usn 

    is it ok?

    If my pulse 0,9usn my servo must be turn. I think it.