Quantcast
Channel: MSP 低功耗微控制器论坛 - 最近的话题
Viewing all articles
Browse latest Browse all 3634

如何在MSP430G2553建立组语查表功能 Look Up Table

$
0
0

我使用CCS V6.2 编译一个Sinewave 波形,在TI 组语手册中未查阅到查表(Look Up Table)相关指令及Data 安排正确表示法,(Look Up Table 数据区)

 

我将程序附录于下,请帮我指证错误地方及正确语法, 谢谢您的协助,

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 3634

Trending Articles