Vous êtes sur la page 1sur 52

EXP. NO.

:8

DATE

STUDY OF ADDRESSING MODES OF DSP

AIM:
To study about direct, indirect and immediate addressing modes in TMS320C50
debugger.
TOOLS REQUIRED:
1. System with TMS 320C50 debugger software
2. TMS 320C50 Kit.
ALGORITHM:
IMMEDIATE ADDRESSING MODE:
1.
2.
3.
4.

Initialize data pointer with 100H data.


Load the accumulator with first data.
Add the second data with accumulator content.
Store the accumulator content in specified address location.

DIRECT ADDRESSING MODE:


1. Initialize data pointer with 100H data.
2. Load the accumulator with first data, whose address is specified in the instruction.
3. Add the accumulator content with second data, whose address is specified in the
instruction.
4. Store the accumulator content in specified address location.
IN-DIRECT ADDRESSING MODE:
1.
2.
3.
4.

Load the auxiliary register with address location of first data.


The auxiliary register (AR0) is modified indirectly as # symbol.
Load the second data into accumulator and perform addition operation.
Store the result.

PROCEDURE:

Open ME Debugger for C50.


Create a new project and new assembly file.
Type the program
Save and add the program to the project
Add the command file to the project and build the project
Load the program to kit through serial port
Run the program and verify the output through communication window

PROGRAM:
;program for immediate addressing mode

START:

H:

.MMREGS
.TEXT
LDP #100H;
LACC #1241H;
ADD #1200H;
SACL 2H;
B H;

;program for direct addressing mode

START:

H:

.MMREGS
.TEXT
LDP #100H;
LACC 0H;
ADD 1H;
SACL 2H;
B H;

;program for adding two numbers with indirect addressing mode.

START:

H:

.MMREGS
.TEXT
LAR AR0,#8000H;
MAR *,AR0;
LACC *+,0 ;WITH ZERO SHIFT
ADD *+;
SACL *+;
B H;

EXP. NO.

:9

DATE

IMPLEMENTATION OF LINEAR AND CIRCULAR


CONVOLUTION

AIM:
To write a program to find the Linear and Circular Convolution of two sequences x(n)
and h(n) using TMS320C50 debugger.
TOOLS REQUIRED:
1. System with TMS 320C50 debugger software
2. TMS 320C50 Kit.
ALGORITHM:
LINEAR CONVALUTION:
1.
2.
3.
4.
5.

Get the first and second input sequence


From the length of the given sequences find the length of the new sequence
Fold the values of h(n)
Do zero padding to x(n) if necessary
Find the convolution and store the result in memory

CIRCULAR CONVALUTION:
1.
2.
3.
4.

Get the length of the sequences


Get the first and second input sequence
Find the circular convolution of the given sequences
Store the result in memory

PROCEDURE:

Open ME Debugger for C50.


Create a new project and new assembly file.
Type the program
Save and add the program to the project
Add the command file to the project and build the project
Load the program to kit through serial port
Run the program and verify the output through communication window

PROGRAM:
LINEAR CONVALUTION:
.MMREGS
.TEXT
START:
LDP #02H
LAR AR1,#8100H

; x(n) data

LAR AR0,#08200H ;h(n) data


LAR AR3,#8300H

;y(n) starting

LAR AR4,#0007 ;N1+N2-1


;to fold the h(n) values
LAR AR0,#8203H ; data memory 8200 to program memory C100(TBLW)
LACC #0C100H
MAR *,AR0
RPT #3
TBLW *- ;to move 8203- 8200 to C100- C103
;padding of zeros for x(n) values
LAR AR6,#8104H
MAR

*,AR6

LACC

#0H

RPT

#3H

SACL *+
;convolution operation start
LOP:
MAR *,AR1
LACC *+
SACL 050H

;starting of the scope of multiplication

LAR AR2,#0153H ; end of the array, to be multiplied with h(n)


{150+N1-1}
MAR *,AR2
ZAP
RPT #03H

;N1-1 times so that N1 times

MACD 0C100H,*APAC

;to accumulate the final product sample

MAR *,AR3
SACL *+
MAR *,AR4
BANZ LOP,*H:

B H

CIRCULAR CONVALUTION:
TXD

.SET

70H

STS

.SET

71H

DATA

.SET

72H

B3

.SET

0F000H

B2

.SET

00F0H

B0

.SET

000FH

.MMREGS
.TEXT
START:
LDP
LACC
SUB

#100H
0H

;length of the input is given in 8000

#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 ;give the inputs x1[n] & x2[n] in AR1 & AR3

LAR

AR3,#8050H

LAR

AR4,1H

ZAP
LOOP:
MAR
LT

*,AR3
*+,AR1

MPY
SPL

;multiply x1[n] & x2[n] and add the multiplication


;output

*+
5H

ADD

5H

MAR

*,AR4

BANZ LOOP,*-,AR2

;outputs of correlation are stored in AR2

SACL *+
CALL ROTATE
LOOP2:
MAR

*,AR0

BANZ LOOP3,*REP:
LAR

AR1,#8050H

LAR

AR0,1H

MAR

*,AR1

LACC

*+

REPXN:

SACL DATA
CALL SERIAL
MAR

;store the samples in DATA


;subroutine to send DATA

*,AR0

BANZ REPXN,*LAR

AR1,#8100H

LAR

AR0,1H

;repeat this for all the 360 output samples

REPHN:
MAR

*,AR1

LACC

*+

SACL DATA

;store the samples in DATA

CALL SERIAL
MAR

;subroutine to send DATA

*,AR0

BANZ REPHN,*-

;repeat this for all the 360 output samples

LAR

AR1,#8010H

LAR

AR0,1H

MAR

*,AR1

LACC

*+

REPOUT:

SACL DATA

;store the samples in DATA

CALL SERIAL
MAR

;subroutine to send DATA

*,AR0

BANZ REPOUT,*HLT:

;repeat this for all the 360 output samples

HLT

;routine to send each digit of DATA individually to the serial port first send the start of
;character "%" separate and send each digits of DATA from MSB send end of character "$"
SERIAL
SPLK

#25H,TXD

;start of character "%"

CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA

AND

#B3

BSAR

12

SACL TXD
CALL HEXASC
CALL TXDATA
RPT
NOP

#0FFFH

;1st digit (from MSB)

LACC

DATA
AND

#B2

BSAR

;second digit

SACL TXD
CALL HEXASC
CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA

AND

#B1

BSAR

;3rd digit

SACL TXD
CALL HEXASC
CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA
AND

#B0

;4th digit

SACL TXD
CALL HEXASC
CALL TXDATA
RPT

#0FFFH

NOP
SPLK

#24H,TXD

;end of character "$"

CALL TXDATA
RPT

#0FFFH

NOP
RET

;loop to convert hex data to ASCII input is in address TXD output is also in TXD

;subtracts 9 from input hex data if >0 add 37h to input hex data
;Otherwise add 30h to input hex data
HEXASC:
LACC TXD
SUB

#9H

BCND

GRT9,GT

LACC TXD
ADD

#30H

SACL TXD
RET
GRT9:
LACC TXD
ADD

#37H

SACL TXD
RET
;loop to send a character to the serial port checks the status of the serial
port(TXREADY-;bit2). if not 0, send that character. Otherwise checks it repeatedly.
TXDATA:
REPCHK:
IN

STS,9

LACC

STS

AND

#04H

BCND

REPCHK,EQ

OUT

TXD,8

RET
H:

ROTATE:
LDP
LACC
SUB

#100H
1H
#1H

SACL 2H
LACC

0050H

;rotate the values of x2[n]

SACB
LAR

AR3,#8051H

LAR

AR5,#8070H

LAR

AR6,2H

MAR

*,AR3

LACC

*+,0,AR5

LOOP1:

SACL *+,0,AR6
BANZ LOOP1,*LACB
MAR

*,AR5

SACL *+
LACC

#8070H

SAMM

BMAR

LAR
MAR
RPT
BLDD
RET

AR3,#8050H
*,AR3
0H
BMAR,*+

INPUT:
LINEAR CONVALUTION:
x(n)
8101 - 3
8102 - 1
8103 - 3

8100 - 1

h(n)

8200 - 0
8201 - 1
8202 - 2
8203 - 1

CIRCULAR CONVALUTION:
8000-0004
x1(n)
8051 - 0001
8052 - 0002
8053 - 0001

8050 - 0002

x2(n )
8061 - 0002
8062 - 0003
8063 - 0004

8060 - 0001

OUTPUT:
LINEAR CONVALUTION:
y(n)
8302 - 5
8303 - 8
8304 - 8
8305 - 7
8306 - 3
8307 - 0

8301 - 1

CIRCULAR CONVALUTION:
8010-000E
8011-0010
8012-000E
8013-0010

EXP. NO.

: 10

DATE

SAMPLING OF INPUT SIGNAL AND DISPLAY

AIM:
To write a program to convert analog signals into digital signals using TMS320C50
debugger.
TOOLS REQUIRED:
1.
2.
3.
4.

System with TMS 320C50 debugger software


TMS 320C50 Kit.
CRO
Function generator

ALGORITHM:
1.
2.
3.
4.
5.

Initialize data pointer


Give the analog signal as input
Introduce the time delay as per required.
Observe the discrete signal as output
Plot the graph.

PROCEDURE:

Open ME Debugger for C50.


Create a new project and new assembly file.
Type the program
Save and add the program to the project
Add the command file to the project and build the project
Switch on the trainer kit.
Connect the function generator in the corresponding terminals.
Download the program to the trainer kit using Xtalk.exe
Quit from the Xtalk.
Enter into the basic TB.exe
Load and run the program "sample50.bas" which executes the asm program and plots
the samples on the screen.

PROGRAM:
TXD

.SET

0H

STS

.SET

1H

DATA

.SET

2H

DELAY

.SET

3H

B3

.SET

0F000H

B2

.SET

0F00H

B1

.SET

00F0H

B0

.SET

000FH

.MMREGS
.TEXT
START:
LDP

#100H

LAR

AR0,#9000H

LAR

AR1,#359

REP:
IN

0,06

RPT

#0FH

NOP
IN

0,04

SPLK
RPT

#5FFH,DELAY
DELAY

NOP
LACC

AND

#0FFFH

SUB #7FFH
MAR

*,AR0

SACL *+,0,AR1
BANZ REP,*LACC

DELAY

SACL DATA
CALL SERIAL

REPSER:
LAR

AR2,#9000H

LAR

AR0,#359

REPSAMP:
MAR

*,AR2

LACC

*+

SACL DATA
CALL SERIAL
MAR

*,AR0

BANZ REPSAMP,*LAR

AR2,#9000H

LAR

AR0,#359

REPSAM:
MAR

*,AR2

LACC

*+

SACL DATA
CALL SERIAL
MAR

*,AR0

BANZ REPSAM,*REPSER1:
B

REPSER1

;routine to send each digit of DATA individually to the serial port first send the start of
;character "%" separate and send each digits of DATA from MSB send end of character "$"
SERIAL
SPLK

#25H,TXD

;start of character "%"

CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA

AND

#B3

BSAR

12

SACL TXD
CALL HEXASC

;1st digit (from MSB)

CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA
AND

#B2

BSAR

;second digit

SACL TXD
CALL HEXASC
CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA

AND

#B1

BSAR

;3rd digit

SACL TXD
CALL HEXASC
CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA
AND

#B0

;4th digit

SACL TXD
CALL HEXASC
CALL TXDATA
RPT

#0FFFH

NOP
SPLK

#24H,TXD

;end of character "$"

CALL TXDATA
RPT
NOP
RET

#0FFFH

;loop to convert hex data to ASCII input is in address TXD output is also in TXD
;subtracts 9 from input hex data if >0 add 37h to input hex data
;Otherwise add 30h to input hex data
HEXASC:
LACC TXD
SUB

#9H

BCND

GRT9,GT

LACC TXD
ADD

#30H

SACL TXD
RET
GRT9:
LACC TXD
ADD

#37H

SACL TXD
RET
;loop to send a character to the serial port checks the status of the serial
port(TXREADY-;bit2). if not 0, send that character. Otherwise checks it repeatedly.
TXDATA:
REPCHK:
IN

STS,9

LACC

STS

AND

#04H

BCND
OUT

TXD,8

RET
H:

REPCHK,EQ

EXP. NO.

: 11

DATE

WAVEFORM GENERATION

AIM:
To write a program to generate Triangle Wave, Sine Wave, Square Wave and
Sawtooth Wave using TMS320C50 debugger.
TOOLS REQUIRED:
1.
2.
3.
4.

System with TMS 320C50 debugger software


TMS 320C50 Kit.
CRO
Function generator

ALGORITHM:
TRIANGLE WAVE GENERATION:
1. Start the program.
2. Load the LSBs of the address data memory location.
3. Write full 16 bit pattern into address data memory location.
4. Load the content of address data memory location.
5. Add the content of address data memory location.
6. Store the data of accumulator into address data memory location.
7. Modify the current AR as specified.
8. Repeat the steps 2 and 3.
9. Subtract the contents of address data memory location.
10. Repeat the steps 5, 6 and 7.
11. Stop the program.
SINE WAVE GENERATION:
1.
2.
3.
4.

Start the program


Load the LSBs of the address data memory location
Write full 16 bit pattern into address data memory location.
Load the content of address data memory location. Specify the address of a
subroutine.
5. Multiply the content of the register.
6. Load the content of the register into accumulator.
7. Store the 16 LSBs of the accumulator into the address data memory location.
8. Modify the current AR & ARP as specified.
9. Branch the contents of entire auxiliary register.
10. Load the content of address data memory location.
11. Repeat the Step.
12. Stop the program.

SQUARE WAVE GENERATION:


1.
2.
3.
4.
5.
6.

Start the program


Load the content of address data memory location.
Store the 16 LSBs of the accumulator into the address data memory location.
Load the content of address data memory location.
Complement the contents of the accumulator.
Stop the program.

SAWTOOTH WAVE GENERATION:


1.
2.
3.
4.
5.
6.
7.
8.
9.

Start the program.


Load the LSBs of the address data memory location
Load the content of address data memory location into accumulator.
Store the 16 LSBs of the accumulator into the address data memory location
Write 16 bit value from a data memory location to the specified I/O Port.
Add the content of address data memory location.
Subtract the content of the register.
Branch the program memory address if the specified conditions are met.
Stop the program.

PROCEDURE:

Open ME Debugger for C50.


Create a new project and new assembly file.
Type the program
Save and add the program to the project
Add the command file to the project and build the project
Load the program to kit through serial port
Run the program and verify the output using CRO

PROGRAM:
TRIANGLE WAVE:
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

OUT

DATA,04H

REPH:
LACC

DATA

ADD

#40H

SACL DATA
BANZ REPH,*LAR

AR0,#60

OUT

DATA,04H

REPL:
LACC
SUB

DATA
#40H

SACL DATA
MAR

*,AR0

BANZ REPL,*HLT:

REP

HLT

SINE WAVE:
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
HLT:

REP1
HLT

TABLE:
.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
.word
.word
.word
.word

0800H
0822H
0845H
0867H
088aH
08acH
08cfH
08f1H
0913H
0935H
0958H
097aH
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

.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
.word
.word
.word
.word
.word

0dfaH
0e11H
0e27H
0e3dH
0e52H
0e67H
0e7cH
0e90H
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

.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
.word
.word
.word
.word
.word

0fedH
0fe8H
0fe3H
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
0c94H
0c77H

.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
.word
.word
.word
.word
.word

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
06abH
0689H
0667H
0645H
0623H
0602H
05e0H

.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
.word
.word
.word
.word
.word

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
0185H
0171H
015dH
014aH
0138H
0126H
0114H
0103H
00f2H
00e2H
00d3H
00c4H

.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
.word
.word
.word
.word
.word

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
0016H
001cH
0022H
0028H
0030H
0037H
0040H
0048H
0052H
005cH
0066H
0072H
007dH
0089H
0096H
00a3H
00b1H

.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
.word
.word
.word
.word
.word

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
0331H
034dH
0369H
0385H
03a2H
03bfH
03ddH
03faH
0418H
0437H
0455H
0474H
0493H
04b3H
04d2H
04f2H
0512H
0532H
0553H
0574H
0594H
05b6H

.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word

05d7H
05f8H
061aH
063bH
065dH
067fH
06a1H
06c3H
06e5H
0708H
072aH
074cH
076fH
0791H
07b4H
07d6H

SQUARE WAVE:
.MMREGS
.TEXT
START:
LDP

#100H

LACC

#0FFFH ;change this value for amplitude.

LOOP:
SACL 0
RPT

#0FFH

OUT

0,04H

;change this value for frequency.


;address for DAC.

CMPL
B

LOOP

.END
SAWTOOTH WAVE:
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

LAR

AR1,#9

SPLK

#0F7ffH,DATA

LAR

AR0,#49

REP:

REPH:
CALL SERIAL
LACC

DATA

ADD

#100

;subroutine to send DATA

SACL DATA
MAR

*,AR0

BANZ REPH,*MAR

;repeat this for all the 360 output samples

*,AR1

BANZ REP,*HLT:

HLT

;routine to send each digit of DATA individually to the serial port first send the start of
;character "%" separate and send each digits of DATA from MSB send end of character "$"
SERIAL
SPLK

#25H,TXD

;start of character "%"

CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA

AND

#B3

BSAR

12

SACL TXD
CALL HEXASC
CALL TXDATA

;1st digit (from MSB)

RPT

#0FFFH

NOP
LACC

DATA
AND

#B2

BSAR

;second digit

SACL TXD
CALL HEXASC
CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA
AND

#B1

BSAR

;3rd digit

SACL TXD
CALL HEXASC
CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA
AND

#B0

;4th digit

SACL TXD
CALL HEXASC
CALL TXDATA
RPT

#0FFFH

NOP
SPLK

#24H,TXD

;end of character "$"

CALL TXDATA
RPT
NOP
RET

#0FFFH

;loop to convert hex data to ASCII input is in address TXD output is also in TXD
;subtracts 9 from input hex data if >0 add 37h to input hex data
;Otherwise add 30h to input hex data
HEXASC:
LACC TXD
SUB

#9H

BCND

GRT9,GT

LACC TXD
ADD

#30H

SACL TXD
RET
GRT9:
LACC TXD
ADD

#37H

SACL TXD
RET
;loop to send a character to the serial port checks the status of the serial
port(TXREADY-;bit2). if not 0, send that character. Otherwise checks it repeatedly.
TXDATA:
REPCHK:
IN

STS,9

LACC

STS

AND

#04H

BCND
OUT

TXD,8

RET
H:

REPCHK,EQ

EXP. NO.

: 12

DATE

IMPLEMENTATION OF FIR FILTER

AIM:
To design a FIR low pass, high pass, band pass and band reject filters in serial mode.
TOOLS REQUIRED:
1. System with TMS 320C50 debugger software
2. TMS 320C50 Kit.
3. CRO
ALGORITHM:
1. Start the program.
2. Initialize the C table value.
3. Load the auxillary register with 0200H.
4. Modify the auxillary register zero.
5. Block the C table to the program.
6. Set configuration control bit.
7. Load the data pointer with 0AH.
8. Initialize the analog to digital conversion.
9. Load the auxillary register 1 with 0300 content.
10. Load the accumulator in 8000H.
11. AND the accumulator with 0FFFH.
12. Subtract the accumulator content with data 800H.
13. Modify the auxillary register 1.
14. Store the accumulator data in 8000H.
15. Load the auxillary register 1 with content 0333H.
16. Zero the accumulator register.
17. Multiply the accumulator with data.
18. Load the program register, with PM bits to accumulator.
19. Load the auxillary register 1 with content 0300H.
20. Add accumulator content with 800H.
21. Shift the accumulator right 1 bit.
22. Store the accumulator content in 8200 location.
23. Branch the program to step 7.
PROCEDURE:

Open ME Debugger for C50.


Create a new project and new assembly file.
Type the program
Save and add the program to the project
Add the command file to the project and build the project
Load the program to kit through serial port
Run the program and verify the output using CRO

PROGRAM:
LOWPASS FILER:
TXD

.SET

50H

STS

.SET

51H

DATA

.SET

52H

B3

.SET

0F000H

B2

.SET

0F00H

B1

.SET

00F0H

B0

.SET

000FH

.MMREGS
.TEXT
B

START

CTABLE:
.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

0FF82H
0083H
0166H
01CFH
0288H
009DH
0FF5BH
0FE38H
0FDACH
0FE01H
0FF31H
00DEH
0271H
0342H
02DDH
0132H
0FEADH
0FC20H
0FA92H
0FAEEH
0FDB6H
02CCH
096AH
0104CH
015F9H
0192EH
0192EH
015F9H
0104CH
096AH
02CCH

.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word

0FDB6H
0FAEEH
0FA92H
0FC20H
0FEADH
0132H
02DDH
0342H
0271H
00DEH
0FF31H
0FE01H
0FDACH
0FE38H
0FF5BH
009DH
0288H
01CFH
0166H
0083H
0FF82H

START:
MAR *,AR0
LAR

AR0,#0200H

RPT

#33H

BLKP CTABLE,*+
REPFIL:
LAR

AR2,#8100H

LAR

AR3,#359

ISR:
SETC CNF
LDP

#0AH

IN

0,06H

RPT

#01FH

NOP
IN

0,4

MAR *,AR1
LAR

AR1,#0300H

LACC 0
AND #0FFFH
SUB

#800H

SACL *
LAR

AR1,#333H

ZAP
RPT

#33H

MACD

0FF00H,*-

APAC
LAR

AR1,#0300H

SACH *

;give as sach *,1 incase of overflow

LACC *
ADD #800H
SFR

;remove if o/p is less amplitude

MAR

*,AR2

SACL *+,0,AR3
BANZ ISR,*REP:
LDP

#100H

LAR

AR2,#8100H

LAR

AR3,#359

REPXN:
MAR

*,AR2

LACC

*+

SUB #1000
SACL DATA

;store the samples in DATA

CALL SERIAL
MAR

;subroutine to send DATA

*,AR3

BANZ REPXN,*B

;repeat this for all the 360 output samples

REPFIL

;routine to send each digit of DATA individually to the serial port first send the start of
;character "%" separate and send each digits of DATA from MSB send end of character "$"
SERIAL
SPLK

#25H,TXD

CALL TXDATA
RPT
NOP

#0FFFH

;start of character "%"

LACC

DATA

AND

#B3

BSAR

12

;1st digit (from MSB)

SACL TXD
CALL HEXASC
CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA
AND

#B2

BSAR

;second digit

SACL TXD
CALL HEXASC
CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA
AND

#B1

BSAR

;3rd digit

SACL TXD
CALL HEXASC
CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA
AND

#B0

SACL TXD
CALL HEXASC
CALL TXDATA
RPT
NOP

#0FFFH

;4th digit

SPLK

#24H,TXD

;end of character "$"

CALL TXDATA
RPT

#0FFFH

NOP
RET
;loop to convert hex data to ASCII input is in address TXD output is also in TXD
;subtracts 9 from input hex data if >0 add 37h to input hex data
;Otherwise add 30h to input hex data
HEXASC:
LACC TXD
SUB

#9H

BCND

GRT9,GT

LACC TXD
ADD

#30H

SACL TXD
RET
GRT9:
LACC TXD
ADD

#37H

SACL TXD
RET
;loop to send a character to the serial port checks the status of the serial
port(TXREADY-;bit2). if not 0, send that character. Otherwise checks it repeatedly.
TXDATA:
REPCHK:
IN

STS,9

LACC

STS

AND

#04H

BCND

H:

REPCHK,EQ

OUT TXD,8
RET
B
H

HIGHPASS FILTER:
TXD

.SET

50H

STS

.SET

51H

DATA

.SET

52H

B3

.SET

0F000H

B2

.SET

0F00H

B1

.SET

00F0H

B0

.SET

000FH

.MMREGS
.TEXT
B

START

CTABLE:
.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

0FCEFH
62H
0FD50H
14AH
0FE1BH
28FH
0FF11H
3E5H
0FFD1H
4ECH
0FFF5H
54FH
0FF28H
4DAH
0FD38H
398H
0FA2EH
1DDH
0F627H
55H
0F131H
4BH
0EA6DH
568H
0D950H
459EH
459EH
0D950H
568H
0EA6DH
4BH
0F131H
55H

.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word

0F627H
1DDH
0FA2EH
398H
0FD38H
4DAH
0FF28H
54FH
0FFF5H
4ECH
0FFD1H
3E5H
0FF11H
28FH
0FE1BH
14AH
0FD50H
62H
0FCEFH

START:
MAR *,AR0
LAR

AR0,#0200H

RPT

#33H

BLKP CTABLE,*+
REPFIL:
LAR

AR2,#8100H

LAR

AR3,#359

ISR:
SETC CNF
LDP

#0AH

IN

0,06H

RPT

#01FH

NOP
IN

0,4

MAR *,AR1
LAR

AR1,#0300H

LACC 0
AND #0FFFH
SUB

#800H

SACL *

LAR

AR1,#333H

ZAP
RPT

#33H

MACD

0FF00H,*-

APAC
LAR

AR1,#0300H

SACH *

;give as sach *,1 incase of overflow

LACC *
ADD #800H
SFR

;remove if o/p is less amplitude

MAR

*,AR2

SACL *+,0,AR3
BANZ ISR,*REP:
LDP

#100H

LAR

AR2,#8100H

LAR

AR3,#359

REPXN:
MAR

*,AR2

LACC

*+

SUB #1000
SACL DATA

;store the samples in DATA

CALL SERIAL
MAR

;subroutine to send DATA

*,AR3

BANZ REPXN,*B

;repeat this for all the 360 output samples

REPFIL

;routine to send each digit of DATA individually to the serial port first send the start of
;character "%" separate and send each digits of DATA from MSB send end of character "$"
SERIAL
SPLK

#25H,TXD

CALL TXDATA
RPT
NOP

#0FFFH

;start of character "%"

LACC

DATA

AND

#B3

BSAR

12

;1st digit (from MSB)

SACL TXD
CALL HEXASC
CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA
AND

#B2

BSAR

;second digit

SACL TXD
CALL HEXASC
CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA
AND

#B1

BSAR

;3rd digit

SACL TXD
CALL HEXASC
CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA
AND

#B0

SACL TXD
CALL HEXASC
CALL TXDATA
RPT
NOP

#0FFFH

;4th digit

SPLK

#24H,TXD

;end of character "$"

CALL TXDATA
RPT

#0FFFH

NOP
RET
;loop to convert hex data to ASCII input is in address TXD output is also in TXD
;subtracts 9 from input hex data if >0 add 37h to input hex data
;Otherwise add 30h to input hex data
HEXASC:
LACC TXD
SUB

#9H

BCND

GRT9,GT

LACC TXD
ADD

#30H

SACL TXD
RET
GRT9:
LACC TXD
ADD

#37H

SACL TXD
RET
;loop to send a character to the serial port checks the status of the serial
port(TXREADY-;bit2). if not 0, send that character. Otherwise checks it repeatedly.
TXDATA:
REPCHK:
IN

STS,9

LACC

STS

AND

#04H

BCND

H:

REPCHK,EQ

OUT TXD,8
RET
B
H

BANDPASS FILTER:
TXD

.SET

50H

STS

.SET

51H

DATA

.SET

52H

B3

.SET

0F000H

B2

.SET

0F00H

B1

.SET

00F0H

B0

.SET

000FH

.MMREGS
.TEXT
B

START

CTABLE:
.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

208H
257H
218H
143H
0H
0FE9EH
0FD7AH
0FCE7H
0FD08H
0FDD1H
0FEECH
0FFE4H
3DH
0FFA1H
0FDFCH
0FB8FH
0F8ECH
0F6D4H
0F608H
0F713H
0FA21H
0FEE6H
4A7H
0A60H
0EF8H
1187H
1187H
0EF8H
0A60H
4A7H
0FEE6H
0FA21H
0F713H

.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word

0F608H
0F6D4H
0F8ECH
0FB8FH
0FDFCH
0FFA1H
3DH
0FFE4H
0FEECH
0FDD1H
0FD08H
0FCE7H
0FD7AH
0FE9EH
0H
143H
218H
257H
208H

START:
MAR *,AR0
LAR

AR0,#0200H

RPT

#33H

BLKP CTABLE,*+
REPFIL:
LAR

AR2,#8100H

LAR

AR3,#359

ISR:
SETC CNF
LDP

#0AH

IN

0,06H

RPT

#01FH

NOP
IN

0,4

MAR *,AR1
LAR

AR1,#0300H

LACC 0
AND #0FFFH
SUB

#800H

SACL *

LAR

AR1,#333H

ZAP
RPT

#33H

MACD

0FF00H,*-

APAC
LAR

AR1,#0300H

SACH *

;give as sach *,1 incase of overflow

LACC *
ADD #800H
SFR

;remove if o/p is less amplitude

MAR

*,AR2

SACL *+,0,AR3
BANZ ISR,*REP:
LDP

#100H

LAR

AR2,#8100H

LAR

AR3,#359

REPXN:
MAR

*,AR2

LACC

*+

SUB #1000
SACL DATA

;store the samples in DATA

CALL SERIAL
MAR

;subroutine to send DATA

*,AR3

BANZ REPXN,*B

;repeat this for all the 360 output samples

REPFIL

;routine to send each digit of DATA individually to the serial port first send the start of
;character "%" separate and send each digits of DATA from MSB send end of character "$"
SERIAL
SPLK

#25H,TXD

CALL TXDATA
RPT
NOP

#0FFFH

;start of character "%"

LACC

DATA

AND

#B3

BSAR

12

;1st digit (from MSB)

SACL TXD
CALL HEXASC
CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA
AND

#B2

BSAR

;second digit

SACL TXD
CALL HEXASC
CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA
AND

#B1

BSAR

;3rd digit

SACL TXD
CALL HEXASC
CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA
AND

#B0

SACL TXD
CALL HEXASC
CALL TXDATA
RPT
NOP

#0FFFH

;4th digit

SPLK

#24H,TXD

;end of character "$"

CALL TXDATA
RPT

#0FFFH

NOP
RET
;loop to convert hex data to ASCII input is in address TXD output is also in TXD
;subtracts 9 from input hex data if >0 add 37h to input hex data
;Otherwise add 30h to input hex data
HEXASC:
LACC TXD
SUB

#9H

BCND

GRT9,GT

LACC TXD
ADD

#30H

SACL TXD
RET
GRT9:
LACC TXD
ADD

#37H

SACL TXD
RET
;loop to send a character to the serial port checks the status of the serial
port(TXREADY-;bit2). if not 0, send that character. Otherwise checks it repeatedly.
TXDATA:
REPCHK:
IN

STS,9

LACC

STS

AND

#04H

BCND

H:

REPCHK,EQ

OUT TXD,8
RET
B
H

BAND REJECT FILTER:


TXD

.SET

50H

STS

.SET

51H

DATA

.SET

52H

B3

.SET

0F000H

B2

.SET

0F00H

B1

.SET

00F0H

B0

.SET

000FH

.MMREGS
.TEXT
B

START

CTABLE:
.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

0FEB9H
14EH
0FDA1H
155H
0FE1BH
282H
0FEAFH
2ACH
0FD35H
8DH
0F9D9H
0FE07H
0F7CCH
0FEE2H
0FA2FH
4BAH
1AH
25CH
420H
1008H
89H
0D61H
0F3F2H
0AF9H
0DB7EH
045DFH
045DFH
0DB7EH
0AF9H
0F3F2H
0D61H
89H
1008H

.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word
.word

420H
25CH
1AH
4BAH
0FA2FH
0FEE2H
0F7CCH
0FE07H
0F9D9H
8DH
0FD35H
2ACH
0FEAFH
282H
0FE1BH
155H
0FDA1H
14EH
0FEB9H

START:
MAR *,AR0
LAR

AR0,#0200H

RPT

#33H

BLKP CTABLE,*+
REPFIL:
LAR

AR2,#8100H

LAR

AR3,#359

ISR:
SETC CNF
LDP

#0AH

IN

0,06H

RPT

#01FH

NOP
IN

0,4

MAR *,AR1
LAR

AR1,#0300H

LACC 0
AND #0FFFH
SUB

#800H

SACL *

LAR

AR1,#333H

ZAP
RPT

#33H

MACD

0FF00H,*-

APAC
LAR

AR1,#0300H

SACH *

;give as sach *,1 incase of overflow

LACC *
ADD #800H
SFR

;remove if o/p is less amplitude

MAR

*,AR2

SACL *+,0,AR3
BANZ ISR,*REP:
LDP

#100H

LAR

AR2,#8100H

LAR

AR3,#359

REPXN:
MAR

*,AR2

LACC

*+

SUB #1000
SACL DATA

;store the samples in DATA

CALL SERIAL
MAR

;subroutine to send DATA

*,AR3

BANZ REPXN,*B

;repeat this for all the 360 output samples

REPFIL

;routine to send each digit of DATA individually to the serial port first send the start of
;character "%" separate and send each digits of DATA from MSB send end of character "$"
SERIAL
SPLK

#25H,TXD

CALL TXDATA
RPT
NOP

#0FFFH

;start of character "%"

LACC

DATA

AND

#B3

BSAR

12

;1st digit (from MSB)

SACL TXD
CALL HEXASC
CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA
AND

#B2

BSAR

;second digit

SACL TXD
CALL HEXASC
CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA
AND

#B1

BSAR

;3rd digit

SACL TXD
CALL HEXASC
CALL TXDATA
RPT

#0FFFH

NOP
LACC

DATA
AND

#B0

SACL TXD
CALL HEXASC
CALL TXDATA
RPT
NOP

#0FFFH

;4th digit

SPLK

#24H,TXD

;end of character "$"

CALL TXDATA
RPT

#0FFFH

NOP
RET
;loop to convert hex data to ASCII input is in address TXD output is also in TXD
;subtracts 9 from input hex data if >0 add 37h to input hex data
;Otherwise add 30h to input hex data
HEXASC:
LACC TXD
SUB

#9H

BCND

GRT9,GT

LACC TXD
ADD

#30H

SACL TXD
RET
GRT9:
LACC TXD
ADD

#37H

SACL TXD
RET
;loop to send a character to the serial port checks the status of the serial
port(TXREADY-;bit2). if not 0, send that character. Otherwise checks it repeatedly.
TXDATA:
REPCHK:
IN

STS,9

LACC

STS

AND

#04H

BCND

H:

REPCHK,EQ

OUT TXD,8
RET
B
H

Vous aimerez peut-être aussi