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.

MSP430FR2433: MSP430FR2433 - VARIABLE IN RAM (IAR ASM)

Part Number: MSP430FR2433

How to declare a variable in RAM in IAR ASEMBLER?

The code that worked before, now does not work!
I specify the address 0x2000h, but nothing is written there!
The disassembler indicates that the address is 0xE400.
But nothing is recorded there either !!!

#include "msp430.h" ; #define controlled include file

;*--------------------------- Variable in RAM --------------------------------*/
#define MODE (02000h)

             NAME main                                                        ; module name
             PUBLIC main                                                     ; make the main label vissible
                                                                                        ; outside this module
            ORG 0FFFEh
            DC16 init                                                              ; set reset vector to 'init' label

            RSEG CSTACK                                                   ; pre-declaration of segment
            RSEG CODE                                                       ; place program in 'CODE' segment

init:       MOV #SFE(CSTACK), SP                                   ; set up stack

main:    NOP                                                                    ; main program
             MOV.W #WDTPW+WDTHOLD,&WDTCTL        ; Stop watchdog timer

             mov.w #0000h,MODE
             mov.w #0001h,MODE
             mov.w MODE,R7

             JMP $                                                                  ; jump to current location '$' (endless loop)
             END


  • Hi Vitaly,

    Here is a resource that shows how to place variables in specific memory locations in IAR and CCS:

    processors.wiki.ti.com/.../Placing_Variables_in_Specific_Memory_Location_-_MSP430

    Give this a try and let me know if you continue to have issues.

    Thanks!

    Mitch
  • Hello!
    Thanks for the answer. But there are only examples in the C language.

    I also tried to write in this area. The result is the same.
    Write to FRAM occurs with the removal of the write protection of the cells in the register SYSCFG0

    MSP430FR2433: 15KB of Program FRAM + 512B of Information FRAM + 4KB of RAM
    01800h to 019FFh - Information Memory FRAM
    02000h to 02FFFh - RAM 4KB
    0C400h to 0FFFFh - Program 15KB FRAM

    How to write to RAM in IAR ASSEMBLER? Where to see examples on the assembler?

    One gets the impression that the write protection in RAM is set up somewhere.

    As was the case with input / output ports:

    bic.w   #LOCKLPM5,PM5CTL0       ; Unlock I/O pins

  • Hey Vitaly,

    It looks like you need to include the "&" in front of MODE. For example:

    mov.w #0001h, &MODE

    Thanks,

    Mitch
  • Thansk! It works!

     

    #include "msp430.h" ; #define controlled include file

    ;*--------------------------- Variable in RAM --------------------------------*/
    #define MODE (0x2000)

               NAME   main                                              ; module name
               PUBLIC main                                             ; make the main label vissible outside this module
              ORG 0FFFEh
               DC16 init                                                    ; set reset vector to 'init' label

               RSEG CSTACK                                         ; pre-declaration of segment
               RSEG CODE                                             ; place program in 'CODE' segment

    init:     MOV #SFE(CSTACK), SP                          ; set up stack

    main: NOP                                                              ; main program
              MOV.W #WDTPW+WDTHOLD,&WDTCTL ; Stop watchdog timer

              mov.w #0000h,&MODE
              mov.w &MODE,R7
              mov.w #0001h,&MODE
              mov.w &MODE,R7

              JMP $                                                              ; jump to current location '$' (endless loop)
              END

**Attention** This is a public forum