TMS320c50 Programs
Short Description
Programs...
Description
8 point FFT using TMS320C50 processor AIM : To write a program to find FFT of an 8 point input sequence using TMS320C50 processor. PROGRAM: INPUT .set 8010H BIT_REV .set 8020H INPLACE .set 8030H TWIDLE .set 8090H N .set 0H STG .set 1H STGC .set 3H GRP .set 4H GRPC .set 5H BFLY .set 6H BFLYC .set 7H DNS .set 8H DNSC .set 9H TXD .SET 70H STS .SET 71H DATA .SET 72H B3 .SET 0F000H B2 .SET 0F00H B1 .SET 00F0H B0 .SET 000FH .mmregs .text START: LDP #100H LACC N SPLK #8H,N CALL 0B000H LAR AR0,#BIT_REV LAR AR5,#INPLACE CALL 0B100H SPLK #3H,STG SPLK #1H,BFLY SPLK #2H,DNS SPLK #2H,0FH ZAP LT 0FH stage MPY N
;inputs are given in 8010 ;bitreversed input are found in 8020 ;final outputs are in 8030 ;twidle factor values are in 8090
;call the subroutine for bitreversing the input ;transfer the bitrevesed data in 8020 to 8030 ;and include the imaginary part ;call the subroutine for this purpose ;for 8 point FFT 3 stages are found ;for first stage butterfly=1 ;dual node spacing=2 ;8 real values & 8 imaginary values for each
SPL LT MPY SPL 2H LAR MAR RPT BLPD
2H 2H STG
;location 8002 hold the number of table ;values or twidle factor values
AR1,#TWIDLE *,AR1 2H #TABLE,*+
LAR AR1,#TWIDLE LACC STG SUB #1H SACL STGC LACC 00 SACL GRP LAR AR7,STGC STGLOP LACC GRP BSAR 1H SACL GRP SUB #1H SACL GRPC LAR AR6,GRPC LACC BFLY SUB #1H SACL BFLYC LACC DNS SUB #1H SACL DNSC LAR AR0,#INPLACE GRPLOP LAR AR2,BFLYC BFLYLOP CALL 0B200H MAR RPT LACC CALL MAR RPT LACC CALL MAR RPT MPY
*,AR0 DNSC *+ 0B200H *,AR0 DNSC *0B300H
;transfer the twidle factor values from program ;memory to the data memory(8090) ;stage value is subtracted by 1 for counter ;purpose ;let group=8 ;stage loop ;group=group/2 ;group value is subtracted by 1 for counter ;purpose ;group loop
;dual node spacing value is subtracted by 1 ;for counter purpose ;this is the main butterfly loop ;take the input values from 8030 ;butterfly counter ;call the subroutine for the complex ;multiplication of input values and twidle ;factor values ;incrment the location 8030 for next complex ;multiplication(for example in first stage ;location is incremented from 8030 to 8032) ;gain call the subroutine
;call the subroutine for comlex addition ;and complex subtraction
*,AR0 increase the butterfly for next stage #2H
DNSC LACC *+ MAR *,AR2 BANZ BFLYLOP,*MAR *,AR RPT DNSC LACC *+ MAR *,AR6 BANZ GRPLOP,*LT BFLY SPL BFLY LT DNS MPY #2H SPL DNS MAR *,AR7 BANZ STGLOP,*REP: LAR AR1,#8010H LAR AR0,#7H REPXN: MAR *,AR1 LACC *+ SACL DATA MAR *,AR0 BANZ REPXN,*LAR AR1,#8030H LAR AR0,#7H REPREAL: MAR *,AR1 LACC * ADRK #2H SACL DATA MAR *,AR0 BANZ REPREAL,*LAR AR1,#8031H LAR AR0,#7H REPIMG: MAR *,AR1 LACC * ADRK #2H SACL DATA MAR *,AR0 BANZ REPIMG,*B REP HLT: B HLT HEXASC:
;increment the 8030 location for next butterfly ;decrement the butterfly & check ;increment the 8030 location for next ;group ;decrement the group & check ; ;increase the dual node spacing for ;next stage ;decrement the stage & check
;store the samples in DATA ;repeat this for all the 360 output samples
;store the samples in DATA ;repeat this for all the 360 output samples
;store the samples in DATA ;repeat this for all the 360 output samples
LACC TXD SUB #9H BCND GRT9,GT LACC TXD ADD #30H SACL TXD RET GRT9: LACC TXD ADD #37H SACL TXD RET TXDATA: REPCHK: IN STS,9 LACC STS AND #04H BCND REPCHK,EQ OUT TXD,8 RET H B H TABLE .word 00100H .word 00000H .word 00100H .word 00000H .word 00100H .word 00000H .word 00100H .word 00000H .word 00100H .word 00000H .word 00100H .word 00000H .word 00100H .word 00000H .word 00100H .word 00100H .word 00100H .word 00100H .word 00100H .word 00000H .word 00100H .word 00000H .word 00000H .word 0FF00H .word 00100H
.word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word
00000H 00100H 00000H 00100H 00000H 00000H 0FF00H 00100H 00000H 00100H 00000H 00100H 00000H 000B5H 0FF4BH 00100H 00000H 00000H 0FF00H 00100H 00000H 0FF4BH 0FF4BH
RESULT: Thus a program to find FFT of an 8 point input sequence using TMS320C50 processor is successfully done.
INPUT: 8000-0008 8010-0700 8011-0B00 8012-0F00 8013-0B00 8014-0700 8015-0300 8016-0000 8017-0300 BITREVERSED OUTPUT: 8020-0700 8021-0700 8022-0F00 8023-0000 8024-0B00 8025-0300 8026-0B00 8027-0300 FFT OUPUT: 8030-3900 8031-0000 8032-0000 8033-E5B0 8034-FF00 8035-0000 8036-0000 8037-03B0 8038-0100 8039-0000 803A-0000 803B-FC50 803C-FF00 803D-0000 803E-0000 803F-1A50
CIRCULAR CONVOLUTION USING TMS320C50 PROCESSOR AIM: To write a program to find cirucular convolution using TM320C50 processor. PROGRAM: .mmregs .text START: LDP #100H LACC 0H SUB #1H SACL 1H LAR AR0,1H LAR AR1,#8060H LAR AR2,#8100H COPYX2: MAR *,AR1 LACC *+,0,AR2 SACL *+,0,AR0 BANZ COPYX2,*LAR AR0,1H LAR AR2,#8010H LOOP3: LAR AR1,#8060H LAR AR3,#8050H LAR AR4,1H ZAP LOOP: MAR *,AR3 LT *+,AR1 MPY *+ SPL 5H ADD 5H MAR *,AR4 BANZ LOOP,*-,AR2 SACL *+ CALL ROTATE LOOP2: MAR *,AR0 BANZ LOOP3,*REP: LAR AR1,#8050H
;length of the input is given in 8000
;give the inputs x1[n] & h2[n] in AR1 & AR3
;multiply x1[n] & X2[n] and add the multiplication; ;output
outputs of correlation are stored in AR2
LAR AR0,1H REPXN: MAR *,AR1 LACC *+ SACL 72H MAR *,AR0 BANZ REPXN,*LAR AR1,#8100H LAR AR0,1H REPHN: MAR *,AR1 LACC *+ SACL 72H MAR *,AR0 BANZ REPHN,*LAR AR1,#8010 LAR AR0,1H REPOUT: MAR *,AR LACC *+ SACL 72H MAR *,AR0 BANZ REPOUT,*HLT: B HLT ROTATE: LDP #100H LACC 1H SUB #1H SACL 2H LACC 0050H SACB LAR AR3,#805 LAR AR5,#8070H LAR AR6,2H LOOP1: MAR *,AR3 LACC *+,0,AR5 SACL *+,0,AR6 BANZ LOOP1,*LACB MAR *,AR5 SACL *+ LACC #8070H SAMM BMAR LAR AR3,#8050H MAR *,AR3
;store the samples in DATA ;repeat this for all the 360 output samples
;store the samples in DATA ;repeat this for all the 360 output samples
;store the samples in DATA ;repeat this for all the 360 output samples ;rotate the values of X2[n]
RPT 0H BLDD BMAR,* RET
RESULT: Thus the program to perform circular convolution using TMS320C50 processor is done successfully .
INPUT: 8000-0004 x1(n) = 8050 - 0000 8051 – 0001 8052 - 0002 8053 – 0001 h2(n ) = 8060 - 0001 8061 – 0002 8062 – 0003 8063 - 0004 OUTPUT: 8010-000E 8011-0010 8012-000E 8013-0010
FIR LOW PASS FILTER USING TMS320C50 PROCESSOR
AIM: To design FIR filter for the following specification: Approximation type: Window design - Blackmann Window Filter type: Lowpass filter Filter Order: 52 Cutoff frequency in KHz = 3.000000 PROGRAM: .mmregs .text ;Move the Filter coefficients from program memory to data memory START: MAR *,AR0 LARAR0,#0200H RPT #33H BLKP CTABLE,*+ SETC CNF ;Input data and perform convolution ISR: LDP #0AH LACC #0 SACL 0 IN 0,06H LARAR7,#0 ;change value to modify sampling freq. MAR *,AR7 BACK: BANZ BACK,*IN 0,04H NOP NOP NOP NOP MAR *,AR1 LAR AR1,#0300H LACC 0 AND #0FFFH XOR #800H SUB #800H SACL * LAR AR1,#333H MPY #0 ZAC ZAP RPT #33H MACD 0FF00H,*APAC LAR AR1,#0300H
MAR *,AR1 RPT #01H SFR SACH * LACC * ADD #800H SACL * OUT *,04H IN 0,16H NOP B ISR NOP NOP HLT: B HLT CTABLE: .word 0FE8BH .word 0FEE2H .word 0FF74H .word 02BH .word 0ECH .word 0196H .word 0208H .word 022BH .word 01EDH .word 0150H .word 061H .word 0FF40H .word 0FE18H .word 0FD19H .word 0FC77H .word 0FC5EH .word 0FCEEH .word 0FE35H .word 02BH .word 02B4H .word 059EH .word 08A9H .word 0B8FH .word 0E07H .word 0FD4H .word 010C7H .word 010C7H .word 0FD4H .word 0E07H .word 0B8FH .word 08A9H
;give as sach *,1 incase ofoverflow
.word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word
059EH 02B4H 02BH 0FE35H 0FCEEH 0FC5EH 0FC77H 0FD19H 0FE18H 0FF40H 061H 0150H 01EDH 022BH 0208H 0196H 0ECH 02BH 0FF74H 0FEE2H 0FE8BH
RESULT: Thus a FIR low pass filter is designed with following specifications using TMS320C50 processor .
IIR LOW PASS FILTER USING TMS320C50 PROCESSOR AIM: To design a IIR low pass filter using TMS320C50. PROGRAM: .MMREGS .TEXT START: LDP #100H LACC #0 SACL 02H SACL 03H SACL 00H LOOP: LACC #0 SACL 00H IN 0,06H LAR AR7,#30H MAR *,AR7 BACK:BANZ BACK,*IN 0,04H NOP NOP NOP NOP LACC 00H AND #0FFFH XOR #800H SUB #800H SACL 00H LT 00H MPY #315EH PAC SACH 2H,1 LT 03H MPY #4E9FH PAC SACH 04H,1 LACC 02H ADD 04H SACL 03H ADD #800H SACL 00H OUT 00H,04H
IN 0,16H B LOOP NOP NOP HLT: B HLT
RESULT: Thus a IIR low pass filter is designed using TMS320C50 processor.
LINEAR CONVOLUTION USING TMS320C50 PROCESSOR
AIM: To perform linear convolution using TMS320C50. PROGRAM: .mmregs .text START: LDP #02H LAR AR1,#8100H lar ar0,#08200H LAR AR3,#8300H LAR AR4,#0007 lar ar0,#8203H lacc #0c100h mar *,ar0 rpt #3 tblw *padding of zerros for x(n) values lar ar6,#8104h mar *,ar6 lacc #0h rpt #3h sacl *+ convolution operation starts LOP: MAR *,AR1 LACC *+ SACL 050H LAR AR2,#0153H MAR *,AR2 ZAP RPT #03H MACD 0C100H,*APAC MAR *,AR3 SACL *+ MAR *,AR4 BANZ LOP,*H: B H
; x(n) datas ;h(n) datas ;y(n) start ;N1+N2-1 ;to fold the h(n) values; ; data mem 8200 to program mem c100(tblw)
;to move 8203- 8200 to c100- c103
;starting of the scope of multiplication ; end of the array, to be multiplied with h(n) {150+N1-1} ;N1-1 times so that N1 times ;to accmulate the final product sample
RESULT: Thus the program to perform linear convolution using TMS320C50 is done. INPUT ( x(n) ) 8100 - 1
8101 - 3 8102 - 1 8103 - 3 INPUT ( h(n) ) 8200 - 0 8201 - 1 8202 - 2 8203 - 1 OUTPUT ( y(n) ) 8300 - 1 8301 - 5 8302 - 8 8303 - 8 8304 - 7 8305 - 3 8306 - 0
SINE WAVEFORM GENERATION USING TMS320C50 PROCESSOR AIM:
To write a program to generate sine wave using TMS320C50. PROGRAM: TXD .SET 0H STS .SET 1H DATA .SET 2H TEMP .SET 3H B3 .SET 0F000H B2 .SET 0F00H B1 .SET 00F0H B0 .SET 000FH .mmregs .text START: LDP #100H LACC #TABLE SACL TEMP REP1: LACC #TABLE SACL TEMP LAR AR0,#372 REP: LACC TEMP TBLR DATA OUT DATA,04H LACC TEMP ADD #1H SACL TEMP MAR *,AR0 BANZ REP,*B REP1 HLT: B HLT TABLE: .word 0800H .word 0822H .word 0845H .word 0867H .word 088aH .word 08acH .word 08cfH .word 08f1H .word 0913H .word 0935H .word 0958H .word 097aH
.word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word
099cH 09bdH 09dfH 0a01H 0a22H 0a43H 0a64H 0a85H 0aa6H 0ac6H 0ae7H 0b07H 0b27H 0b46H 0b66H 0b85H 0ba4H 0bc3H 0be1H 0bffH 0c1dH 0c3aH 0c58H 0c74H 0c91H 0cadH 0cc9H 0ce5H 0d00H 0d1bH 0d35H 0d4fH 0d69H 0d82H 0d9bH 0db3H 0dcbH 0de3H 0dfaH 0e11H 0e27H 0e3dH 0e52H 0e67H 0e7cH 0e90H
.word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word
0ea3H 0eb6H 0ec9H 0edbH 0eedH 0efeH 0f0eH 0f1eH 0f2eH 0f3dH 0f4bH 0f59H 0f66H 0f73H 0f80H 0f8bH 0f97H 0fa1H 0fabH 0fb5H 0fbeH 0fc6H 0fceH 0fd5H 0fdcH 0fe2H 0fe8H 0fedH 0ff1H 0ff5H 0ff8H 0ffbH 0ffdH 0ffeH 0fffH 0fffH 0fffH 0ffeH 0ffdH 0ffbH 0ff8H 0ff5H 0ff1H 0fedH 0fe8H 0fe3H
.word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word
0fddH 0fd6H 0fcfH 0fc7H 0fbfH 0fb6H 0facH 0fa2H 0f98H 0f8cH 0f81H 0f74H 0f68H 0f5aH 0f4cH 0f3eH 0f2fH 0f20H 0f10H 0effH 0eeeH 0eddH 0ecbH 0eb8H 0ea5H 0e92H 0e7eH 0e69H 0e54H 0e3fH 0e29H 0e13H 0dfcH 0de5H 0dceH 0db6H 0d9dH 0d84H 0d6bH 0d51H 0d37H 0d1dH 0d02H 0ce7H 0cccH 0cb0H
.word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word
0c94H 0c77H 0c5aH 0c3dH 0c20H 0c02H 0be4H 0bc5H 0ba7H 0b88H 0b69H 0b49H 0b2aH 0b0aH 0aeaH 0ac9H 0aa9H 0a88H 0a67H 0a46H 0a25H 0a04H 09e2H 09c1H 099fH 097dH 095bH 0939H 0916H 08f4H 08d2H 08afH 088dH 086aH 0848H 0825H 0803H 07e0H 07beH 079bH 0779H 0756H 0734H 0711H 06efH 06cdH
.word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word
06abH 0689H 0667H 0645H 0623H 0602H 05e0H 05bfH 059eH 057dH 055cH 053cH 051bH 04fbH 04dbH 04bcH 049cH 047dH 045eH 043fH 0421H 0403H 03e5H 03c7H 03aaH 038dH 0371H 0354H 0339H 031dH 0302H 02e7H 02cdH 02b2H 0299H 027fH 0267H 024eH 0236H 021eH 0207H 01f0H 01daH 01c4H 01afH 019aH
.word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word
0185H 0171H 015dH 014aH 0138H 0126H 0114H 0103H 00f2H 00e2H 00d3H 00c4H 00b5H 00a7H 009aH 008dH 0081H 0075H 0069H 005fH 0055H 004bH 0042H 003aH 0032H 002aH 0024H 001dH 0018H 0013H 000eH 000aH 0007H 0005H 0002H 0001H 0000H 0000H 0000H 0001H 0002H 0004H 0006H 000aH 000dH 0011H
.word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word
0016H 001cH 0022H 0028H 0030H 0037H 0040H 0048H 0052H 005cH 0066H 0072H 007dH 0089H 0096H 00a3H 00b1H 00c0H 00ceH 00deH 00eeH 00feH 010fH 0121H 0133H 0145H 0158H 016bH 017fH 0194H 01a9H 01beH 01d4H 01eaH 0201H 0218H 022fH 0247H 0260H 0278H 0292H 02abH 02c5H 02dfH 02faH 0315H
.word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word
0331H 034dH 0369H 0385H 03a2H 03bfH 03ddH 03faH 0418H 0437H 0455H 0474H 0493H 04b3H 04d2H 04f2H 0512H 0532H 0553H 0574H 0594H 05b6H 05d7H 05f8H 061aH 063bH 065dH 067fH 06a1H 06c3H 06e5H 0708H 072aH 074cH 076fH 0791H 07b4H 07d6H
RESULT: Thus sine wave is generated using TMS320C50 processor. SQUAREWAVEFORM GENERATION USING TMS320C50 PROCESSOR
AIM: To write a program to generate a squarewave using TMS320C50. PROGRAM: .text start: LDP #140h LACC #0FFFH SACL 0H OUT 0,04H NOP LAR AR3,#0000 DELAY1: MAR *,AR3 RPT #07FFFH NOP BANZ DELAY1,*LACC #0H SACL 0H OUT 0,04H NOP LAR AR3,#0000 DELAY2: MAR *,AR3 RPT #07FFFH NOP BANZ DELAY2,*B start
RESULT: Thus a square wave is generated using TMS320C50 processor.
TRIANGULAR WAVEFORM GENERATION USING TMS320C50 PROCESSOR
AIM: To write a program to generate a triangular wave using TMS320C50 processor. PROGRAM: TXD .SET 0H STS .SET 1H DATA .SET 2H TEMP .SET 3H B3 .SET 0F000H B2 .SET 0F00H B1 .SET 00F0H B0 .SET 000FH .mmregs .text START: LDP #100H REP: SPLK #0,DATA LAR AR0,#60 REPH: OUT DATA,04H LACC DATA ADD #40H SACL DATA BANZ REPH,*LAR AR0,#60 REPL: OUT DATA,04H LACC DATA SUB #40H SACL DATA MAR *,AR0 BANZ REPL,*B REP HLT: B HLT
RESULT: Thus a triangular wave is generated using TMS320C50 processor.
View more...
Comments