Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 22228

How to build a Look Up Table with CCS 6.2 assembly code?

$
0
0

I will like to  using Assembly code to build a Look Up Table  for output a Sine wave, which complier is CCS V6.2.

Please  help me to correct below program and  instruct.

Thanks your help. 

;-------------------------------------------------------------------------------
; MSP430 Assembler Code Template for use with TI Code Composer Studio
;
;
;-------------------------------------------------------------------------------
.cdecls C,LIST,"msp430.h" ; Include device header file

;-------------------------------------------------------------------------------
.def RESET ; Export program entry-point to
; make it known to linker.
;-------------------------------------------------------------------------------
.text ; Assemble into program memory.
.retain ; Override ELF conditional linking
; and retain current section.
.retainrefs ; And retain any sections that have
; references to current section.
;-------------------------------------------------------------------------------
; Main loop here
;-------------------------------------------------------------------------------

             RESET                    mov.w #0280h,SP                                         ; Initialize stackpointer
                                              mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT
                                              bis.b #066h,&P1DIR                                    ; P1.2 and P1.3 output
                                             bis.b #066h,&P1SEL                                    ; P1.2 and P1.3 TA1/2 otions

                                             mov.w R4,#0C00H                                       ;Initial R4 
                                             mov.w #1024-1,&CCR0                                 ; PWM Period
                                             mov.w #OUTMOD_7,&TA0CCTL1              ; CCR1 reset/set
                                             mov.w R4,&TA0CCR1                              ; CCR1 PWM Duty Cycle
                                             mov.w #ID_2,&TA0CTL                                ;  ID_0 input clock

                                            mov.w #TASSEL_2+MC_1,&TA0CTL ; SMCLK, upmode

                                             mov.w #510,&CCR2 ; CCR2 PWM Duty Cycle

                                             bis.b #CCIE,&TACCTL1 ; SMCLK, upmode

;
                                              Mainloop bis.w #CPUOFF,SR ; CPU off
                                              nop ; Required only for debugger

 ;-------------------------------------------------------------------------------

TA0_ISR; ISR for TACCR0
;-------------------------------------------------------------------------------
                      mov.w  R4, CCR1                                    ; change PWM output value.

                      clr.w &TACTL                                         ; Clear Timer_A control registers

                      mov.w #384,&CCR1                              ; CCR1 PWM Duty Cycle

                      bis.b #CCIE ,&TACCTL1                       ; Exit LPM0 on reti

                      inc.w R4

                      cmp.w R4,#0FFFh 

                      jnz   Lp1

                     mov.w   #0C00h,R4

LP1               reti ;

;--------------------------------------------------------------------------------------------------

;Look Up Table  Start Address &0FFC0 .

data
0C00H: 1024
0C02H: 1023
0C04H: 1021
0C06H: 1025
0C08H: 1026
0C0AH: 1020
0C0CH: 1021
0C0EH: 1029
0C10H: 1025
0C12H: 1016
0C14H: 1025

.

0FFFh: 0000.

;-------------------------------------------- End of data.


Viewing all articles
Browse latest Browse all 22228


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>