Hello, thanks for the responses! I am trying to write this code in assembly as a matter of practice (we are thinking of using this device for one of the assembly courses offered in school and I am to explore its viability).
I have made corrections and now the device exhibits random behavior.
Port 5.4, 5.5 and 5.6 are attached to LEDs on the device.
Sometimes all the LEDs will blink on and off as programmed, and
sometimes the LEDs won't switch on at all. I have attached the
disassembled code as well.
I'd appreciate any help- I am really lost as to how to debug this
erratic behavior :(
.section .text
RESET:
StopWDT: mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT
SetupP1:
bis.b #(BIT4), &P5DIR ;Set P5.4 Out
bis.b #(BIT5), &P5DIR ;Set P5.5 out
bis.b #(BIT6), &P5DIR ;Set P5.6 out
bis.b #(BIT4), &P5OUT ; Turn off P5.4
bis.b #(BIT5), &P5OUT ; Turn off P5.5
bis.b #(BIT6), &P5OUT ; Turn off P5.6
Mainloop:
xor.b #0x70, &P5OUT ; Toggle P5.4, P5.5, P5.6
Wait: mov.w #32000, R15 ; Delay to R15
L1: dec.w R15 ; Decrement R15
jnz L1 ; Delay over?
jmp Mainloop ; Again
;------------------------------------------------------------------------------
; Interrupt Vectors Used MSP530x13x/14x
;------------------------------------------------------------------------------
.section .vectors
.org 0x1E,0xFF ; MSP530 RESET Vector
.word RESET ;
Thanks!
Ali
On Wed, Sep 24, 2008 at 9:58 AM, Grant Edwards <[email protected]> wrote:
> On 2008-09-24, Ralf Hildebrandt <[email protected]> wrote:
>> Ali Shah wrote:
>>
>>> SetupP1:
>>> bis.b #0x05, &P5DIR ; P5.4 output
>>> bis.b #0x06, &P5DIR ; P5.5 output
>>> bis.b #0x07, &P5DIR ; P5.6 output
>>
>> #0x05 == 0000_0101 in binary
>> #0x06 == 0000_0110 in binary
>> #0x07 == 0000_0111 in binary
>>
>> So it seems your intention is
>> bis.b #(BIT4+BIT6+BIT7), &P5DIR ; P5.4-6 output
>>
>> BITx are predefined constants in <common.h>.
>>
>>
>>> mov.b #llo(0xFFFF), &P5OUT ; Toggle off P5
>>
>> P5OUT is a byte register.
>> mov.b #0xFF, &P5OUT ; Toggle off P5
>>
>>
>>
>> Let me give you one hint: C-Compilers are great. They generate very good
>> code - especially for the MSP430 which is a C-friedly architecture.
>
> Secifically, the C compiler knows about bis and bic
> instructions and will use them when it can. To take the above
> as an example, this code will generate a single bis
> instruction:
>
> #define Bit(n) (1<<(n))
>
> P5DIR |= Bit(4)+Bit(5)+Bit(6);
>
> --
> Grant Edwards grante Yow! I don't know WHY I
> at said that ... I think it
> visi.com came from the FILLINGS in
> my rear molars ...
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Mspgcc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>
blink_disassembly
Description: Binary data
