Reply by Mark Borgerson November 11, 20042004-11-11
In article <cmv5un$mg3$1@netnews.hinet.net>, stu.art@msa.hinet.net 
says...
> Anyone know what is the problem that happened on my TI MSP430F449 MCU > I use the IAR Embedded Workbench as the platform and MSP430 FET440 as the > Flash Emulation tool. > I really dont have a clue what happened with the code.. > couse I have use a demo code which worked fine for me to toggle the led as > follow > > ORG 01100h ; Program Start > ;--------------------------------------------------------------------------- > -- > RESET mov.w #0A00h,SP ; Initialize 'F449 stackpointer > StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT > SetupP1 bis.b #0015d,&P5DIR ; P5.1 output > > Mainloop xor.b #0015d,&P5OUT ; Toggle P5.0,P5.1,P5.2. > Wait mov.w #060003,R15 ; Delay to R15 > . > . > . > jmp Mainloop ; Again > ;--------------------------------------------------------------------------- > --- > ; Interrupt Vectors Used MSP430x44x > ;--------------------------------------------------------------------------- > --- > ORG 0FFFEh ; MSP430 RESET Vector > DW RESET ; > END > > It had no problem when executed > > But when I built up another code to initialize the LCD as followed > > ORG 01100h ; Program Start > ;--------------------------------------------------------------------------- > -- > RESET mov.w #0A00h,SP ; Initialize 'F449 stackpointer > StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT > > SetupP6 bis.b #00FFh,&P6DIR ; P6 output > SetupP3 bis.b #00FFh,&P3DIR ; P3 output > bis.b #00FFh,&P5DIR > BIS.B #0000H,&P5OUT > > INIT > mov.w #060000,R15 ;60K > L1 dec.w R15 ;125ns*600000=7.5ms > jnz L1 ;125ns*600000=7.5ms > ;15MS > > bis.b #0000h,&P6OUT ; INIT PROCEDURE1 > bis.b #00FFh,&P3OUT ; > > mov.w #016400,R14 ;16.4K > L2 dec.w R13 ;16.4K*125ns=2.05ms > jnz L2 ;16.4K*125ns=2.05ms > > > bis.b #0000h,&P6OUT ; INIT PROCEDURE2 > bis.b #003Fh,&P3OUT ; > > mov.w #000800,R13 ;400 > L3 dec.w R13 ;400*125n=50us > jnz L3 ;400*125n=50us > > bis.b #0000h,&P6OUT ; INIT PROCEDURE3 > bis.b #003Fh,&P3OUT ; > > bis.b #003Fh,&P3OUT ;function set > bis.b #0004h,&P6OUT ;enable to write > bis.b #000Fh,&P3OUT ;Turn LCD Screen on > > > it showed "User Error Illegal opcode found on address 0x0" > Please , if anyone know or you have this problem before...save me!! > > stuart > > >
As noted by Jetmarc, you don't have a jump back to the beginning. Location 0x0 is the IE1 interrupt enable register, and starts with contents of 0x00 at reset. You should also correct the timing loop at L2, which loads the delay constant into R14, and proceeds to decrement R13. Since R13 hasn't yet been used, its contents are not defined. You might also simplify things by using the same register for the programmed delays. Mark Borgerson
Reply by jetmarc November 11, 20042004-11-11
> bis.b #0004h,&P6OUT ;enable to write > bis.b #000Fh,&P3OUT ;Turn LCD Screen on > > > it showed "User Error Illegal opcode found on address 0x0" > Please , if anyone know or you have this problem before...save me!!
There is no jump and the end of your program. The CPU will execute all memory following your last instruction, and - if god wants it to - wrap from the end of the 64k memory space back to address 0x0, where it appearently finds an illegal opcode.
Reply by stuart.h November 11, 20042004-11-11
Anyone know what is the problem that happened on my TI MSP430F449 MCU
I use the IAR Embedded Workbench as the platform and MSP430 FET440 as the
Flash Emulation tool.
I really dont have a clue what happened with the code..
couse I have use a demo code which worked fine for me to toggle the led as
follow

            ORG     01100h                  ; Program Start
;---------------------------------------------------------------------------
--
RESET       mov.w   #0A00h,SP               ; Initialize 'F449 stackpointer
StopWDT     mov.w   #WDTPW+WDTHOLD,&WDTCTL  ; Stop WDT
SetupP1     bis.b   #0015d,&P5DIR       ; P5.1 output

Mainloop    xor.b   #0015d,&P5OUT       ; Toggle P5.0,P5.1,P5.2.
Wait             mov.w   #060003,R15             ; Delay to R15
            .
            .
            .
          jmp         Mainloop                ; Again
;---------------------------------------------------------------------------
---
;           Interrupt Vectors Used MSP430x44x
;---------------------------------------------------------------------------
---
            ORG     0FFFEh                  ; MSP430 RESET Vector
            DW      RESET                   ;
            END

It had no problem when executed

But when I built up another code to initialize the LCD as followed

             ORG 01100h                  ; Program Start
;---------------------------------------------------------------------------
--
RESET  mov.w   #0A00h,SP               ; Initialize 'F449 stackpointer
StopWDT      mov.w   #WDTPW+WDTHOLD,&WDTCTL  ; Stop WDT

SetupP6      bis.b   #00FFh,&P6DIR        ; P6 output
SetupP3      bis.b   #00FFh,&P3DIR  ; P3 output
                bis.b   #00FFh,&P5DIR
                BIS.B   #0000H,&P5OUT

INIT
                mov.w  #060000,R15  ;60K
L1  dec.w R15   ;125ns*600000=7.5ms
  jnz L1   ;125ns*600000=7.5ms
      ;15MS

        bis.b   #0000h,&P6OUT   ; INIT PROCEDURE1
        bis.b   #00FFh,&P3OUT            ;

                mov.w  #016400,R14  ;16.4K
L2  dec.w R13   ;16.4K*125ns=2.05ms
  jnz L2   ;16.4K*125ns=2.05ms


        bis.b   #0000h,&P6OUT            ; INIT PROCEDURE2
             bis.b   #003Fh,&P3OUT            ;

  mov.w #000800,R13  ;400
L3  dec.w R13   ;400*125n=50us
  jnz L3   ;400*125n=50us

        bis.b   #0000h,&P6OUT           ; INIT PROCEDURE3
             bis.b   #003Fh,&P3OUT            ;

             bis.b   #003Fh,&P3OUT            ;function set
  bis.b   #0004h,&P6OUT            ;enable to write
  bis.b   #000Fh,&P3OUT            ;Turn LCD Screen on


it showed  "User Error    Illegal opcode found on address 0x0"
Please ,  if anyone know or you have this problem before...save me!!

stuart