Question

Write a program which produces a constant-amplitude square wave with a frequency of 440Hz (440 cy...

Write a program which produces a constant-amplitude square wave with a frequency of 440Hz (440 cycles per second).

Using the init function, the output is configured to use signed 16-bit values for the signal, so a value of 0x8000 represents the “bottom” of the signal range, 0x0 represents the “middle” and 0x7FFF is the “top”. The output sample rate (the rate at which these 16-bit values come out) is 48kHz. This is all the info you need to put the right sequence of values in r0 and branch to BSP_AUDIO_OUT_Play_Sample.

All code needs to be written in ARM Assembly.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

x(k) = 1:0.001:10;
x(k)= x(k)';
n = 10;
wave = zeros(size(x(k),1),1);
for i = 1:2:n
  wave = wave + cos(2*i*pi*x)/(2*i*pi);
end
plot(x(k),wave)

3) Code for sampling and gettting the sqaure wave of duty cycle

clc
close all;
clear all;
x=input('amplitude=');
z= input('Frequency= ');
duc=input('Duty Cycle= ');
z=z*2*pi;
t=0:.001:1;
p=x*square(z*t,duc);
plot(t,p);
axis([0 1 -3 3]);
title('Generation of Square Wave of Duty Cycle')

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
Write a program which produces a constant-amplitude square wave with a frequency of 440Hz (440 cy...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT