You are on page 1of 10

Exp. No.

:
Date:
FUNDAMENT AL P ROGRAMS

A IM :

To perform the following programs using TMS320C50 processor:


• Square wave generation
• Sine wave generation
• Sawtooth wave generation
• Triangular wave generation COMPONENTS REQUIRED:
1. C50 processor kit
2. CRO
3. Function generator
4. Power cable and probes

PROCEDURE:

1. Open the C50 debugger software.


2. In Menu bar, choose Serial => Port settings => Set to Com1.
3. Go to Project => New Project and save it as .dpj file.
4. Go to File => New => Assembly file, then type the program and
save it.
5. In Assembly folder, choose the option Add file to Project and
save it.
6. Similarly in .cmd file, Add file to project and save it.
7. Now go to Project in Menu bar and choose the option Buuld and
in Serial => Load program.
8. Now the program will be loaded in the kit.
9. In Communication window, type input and view the output.
10. Close the window.
CODING:

SQUARE WAVE GENERATION:


.mmregs
.text
start:
ldp #100h lacc #0fffh ;change this value for
amplitude. loop: sacl 0 rpt #0ffh ;change this value
for frequency.
out 0,04 ;address for dac.
cmpl
b loop
.end;

SINE WAVE GENERATION:

WITH THESE DEFAULT VALUES SINE GENERATED IS 100 HZ.


INCFREQ .set10 ;minimum value 1 - change for increasing frequency
every count will increase frequency in steps of 100hz
DECFREQ .set0 ;minimu value 0 - change for decreasing frequency
every count will decrease frequency by half
LENGTH .set 360
AMPLITUDE .set 5
delay .set 7 ;change to increase/decrease frequency in
;different steps;
TEMP .set 0
TEMP1 .set 1
.mmregs
.text
START:
LDP #100H
SPLK #TABLE,TEMP ;load start address of table lar
AR2,#( (LENGTH/INCFREQ)+(LENGTH*DECFREQ) )-1 lar
ar3,#DECFREQ ;repeat counter for reducing frequency
CONT:
CALL DELAY
LACC TEMP ;load address of sine value
TBLR TEMP1 ;read sine data to TEMP1
LT TEMP1
MPY #AMPLITUDE
PAC
SACL TEMP1
mar *,ar3 banz
repeat,*-
lar ar3,#DECFREQ ;repeat counter for reducing frequency
LACC TEMP
ADD #INCFREQ ;increase table value

repeat:
SACL TEMP ;store it
OUT TEMP1,4 ;send sine data to DAC
MAR *,AR2
BANZ CONT,*-
b START
DELAY: lar
ar7,#delay
mar *,ar7
back: banz back,*ret;
TABLE .word XXX

SAWTOOTH WAVE GENERATION :


.mmregs
.text
start:
ldp #120h
lacc #0h ;change lower amplitude
sacl 0
loop: lacc 0
out 0,04h add #05h ;change frequency
sacl 0 sub #0fffh ;change upper
amplitude bcnd loop,leq b start
.end;

TRIANGULAR WAVE GENERATION:

AMPLITUDE .SET 4
FREQ .SET 350
TEMP .SET 0
; .mmregs
.text
START:
LDP #100H
splk #0,TEMP
CONT1: lar
AR2,#FREQ CONT:
out TEMP,4 LACC
TEMP
ADD #AMPLITUDE
SACL TEMP
MAR *,AR2
BANZ CONT,*LAR
AR2,#FREQ CONTx:
OUT TEMP,4
LACC TEMP
SUB #AMPLITUDE
SACL TEMP
MAR *,AR2
BANZ CONTx B
CONT1
.end

RESULT:
Thus fundamental waveform generations are performed using DSP
processor.

OUTPUT:
OUT P UT :
OUT P UT :

OUT P UT :

You might also like