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.

Introduce time delays, ASSEMBLY language - MSP430 f2013

Hi,

I'm using msp430-ezf2013

I want to output a digital signal using pins 3,4,5,6,7,8,9

I want to begin with pin9 and go to pin8 then to pin7...until pin3

I want to introduce a specific time delay between each activation

I'm using ASSEMBLY language

I'd like to know the instructions in this language to confire a specific pin as an output and the instructions to the delays.

Thanks for your help!

  • Hi Joaquim,

    There are two ways to do the "delay". The first is to simply decrement a register until it reaches zero, then the delay becomes Tdelay = #Rx * 3, where #Rx is the original value assigned to register Rx, and 3 is the number of cycles needed to decrement Rx and to "execute" the conditional jump. Of course this needlessly wastes CPU cycles and power, which defeats the purpose of using MSP430 in the first place.

    Another way is to use hardware timer and interrupt, where you set the timer (either Timer_A or WDT would do) to generate interrupt at certain interval; you would then put the device to sleep (LPMx) and use the interrupt to wake the device up and resume execution. Rinse, repeat. This way the device spends majority of time in low power mode, and only wakes up long enough to complete the immediate task (toggling ports, saving measurements, etc).

    You can find code for both in MSP430F20xx Code Examples (slac080i), available here: http://www.ti.com/litv/zip/slac080i

    Tony

  • As a reference I'm attaching two of the examples from TI for the F20x3, one using software delay, the other using WDT and interrupts. Both in assembly mnemonics for the Code Composer Studio.

    Tony

    6355.msp430x20x3_lpm3.asm

    6332.msp430x20x3_1.asm

**Attention** This is a public forum