0% found this document useful (0 votes)
34 views

Lab Tasks Question No. 01) :-: Digital Signal Processing Lab

The document contains 3 questions and answers related to C programming tasks for a digital signal processing lab. Question 1 asks to design a function to perform arithmetic operations (addition, subtraction, multiplication) and display the output, allowing the user to select the operation and input values. The answer provides C code to do this. Question 2 asks to create a project to calculate and save the first 10 Fibonacci numbers in an array, then observe the array graph using CCS V3.3. The answer provides C code to calculate and print the Fibonacci series. Question 3 asks to create a project where pressing switches sets the corresponding LED on a C6713 DSK board. The answer provides C code using D

Uploaded by

Muhammad Anas
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Lab Tasks Question No. 01) :-: Digital Signal Processing Lab

The document contains 3 questions and answers related to C programming tasks for a digital signal processing lab. Question 1 asks to design a function to perform arithmetic operations (addition, subtraction, multiplication) and display the output, allowing the user to select the operation and input values. The answer provides C code to do this. Question 2 asks to create a project to calculate and save the first 10 Fibonacci numbers in an array, then observe the array graph using CCS V3.3. The answer provides C code to calculate and print the Fibonacci series. Question 3 asks to create a project where pressing switches sets the corresponding LED on a C6713 DSK board. The answer provides C code using D

Uploaded by

Muhammad Anas
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

LAB TASKs

Question no. 01):-


Design and implement a function of C in CCS which computes
arithmetic operations (Addition,
Subtraction and multiplication) and display its output. (Note: User
should be able to select
arithmetic operation and Function should be able to take input values
from user)
Answer no. 01):-
Code in C
#include<stdio.h>
int main()
{
int a,b;
int op;
printf(" 1.Addition\n 2.Subtraction\n 3.Multiplication\n");
printf("Enter the values of a & b: ");
scanf("%d %d",&a,&b);
printf("Enter your Choice : ");
scanf("%d",&op);
switch(op)
{
case 1 :
printf("Sum of %d and %d is : %d",a+b);
break;
case 2 :
printf("Difference of %d and %d is : %d",a-b);
break;
case 3 :
printf("Multiplication of %d and %d is : %d",a*b);
break;
default :
printf(" Enter Your Correct Choice.");
break;
}
return 0;
}

Digital Signal Processing Lab Page 1


1.Addition
2.Subtraction
3.Multiplication
Enter the values of a & b: 1
0
Enter your Choice : 2
Difference of 1 and 56344 is : 0
Question no. 02):-
Create a project in CCS V3.3 (in the simulation mode). Create a new C
source code file. Your code should calculate and save the first 10
elements of the Fibonacci series in an array. Save and add this file to
your project folder. Build and Run your project. Observe the graph of
the Fibonacci array by using the graph property of CCS V3.3.
Answer no. 02):-
#include <stdio.h>
int main()
{
int t1 = 0, t2 = 1, nextTerm = 0, n;
printf("Enter a positive number: ");
scanf("%d", &n); // displays the first two terms which is always 0
and 1
printf("Fibonacci Series: %d, %d, ", t1, t2);
nextTerm = t1 + t2;
while(nextTerm <= n)
{
printf("%d, ",nextTerm);
t1 = t2;
t2 = nextTerm;
nextTerm = t1 + t2;
}

Digital Signal Processing Lab Page 2


Question no. 03):-
Create a project in CCS V3.3. Include all necessary files to your project.
Create a new C source code file. This code should set the LED on the
C6713 DSK board corresponding to the switch being pressed. Add this
file to your project.
Answer no. 03):-
#include<dsk6713.h> /* General functions */
#include<dsk6713_dip.h> /* Functions for DIP */
#include<dsk6713_led.h> /* Functions for LED */
void main() {
DSK6713_init();
DSK6713_DIP_init(); /*Initialize DIP switches */
DSK6713_LED_init(); /*Initialize LEDs*/
while(1){ /*DSK6713_DIP_get(‘switch number’); Retrieve the DIP switch
value */
if(DSK6713_DIP_get(0)==1){ /* DSK6713_LED_on(‘LED number’); Set the LED */
DSK6713_LED_on(0); }
else{ /* DSK6713_LED_off(‘LED number’); Clear the LED */
DSK6713_LED_off(0);}

if(DSK6713_DIP_get(1)==1){
DSK6713_LED_on(1);}
else{
DSK6713_LED_off(1);
}
if(DSK6713_DIP_get(2)==1){
DSK6713_LED_on(2);}
else{
DSK6713_LED_off(2);}
if(DSK6713_DIP_get(3)==1){
DSK6713_LED_on(3);}
else{
DSK6713_LED_off(3);}
}
}

Digital Signal Processing Lab Page 3

You might also like