Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
ARM?? Cortex?? M4 Cookbook

You're reading from  ARM?? Cortex?? M4 Cookbook

Product type Book
Published in Mar 2016
Publisher Packt
ISBN-13 9781782176503
Pages 296 pages
Edition 1st Edition
Languages
Author (1):
Dr. Mark Fisher Dr. Mark Fisher
Profile icon Dr. Mark Fisher
Toc

Table of Contents (16) Chapters close

ARM Cortex M4 Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
A Practical Introduction to ARM CORTEX C Language Programming Programming I/O Assembly Language Programming Data Conversion Multimedia Support Real-Time Signal Processing Real-Time Embedded Systems Embedded Toolchain Index

Generating a sine wave


Sinusoidal signals are commonly used in signal processing applications and generating these waveforms provides an interesting project that is the focus of this recipe. A common approach is a direct method that stores the sinusoidal waveform samples in a look-up-table (LUT). This recipe is called dacSinusoid_c5v0.

Getting ready

First, we need to calculate the (12-bit) DAC values that will be stored in the LUT. We'll attempt to generate a 50 Hz sinusoidal signal and use a spreadsheet (for example, Microsoft Excel) to calculate the following values:

Smpl. No

Theta Rads

floor((sin(theta)+1)*4095/2)

0

0

2047

1

0.31415927

2680

2

0.62831853

3250

3

0.9424778

3703

4

1.25663706

3994

5

1.57079633

4095

6

1.88495559

3994

7

2.19911486

3703

8

2.51327412

3250

9

2.82743339

2680

10

3.14159265

2047

11

3.45575192

1414

12

3.76991118

844

13

4.08407045

391

14

4.39822972

100

15

4.71238898

0

16

5.02654825

100

17

5.34070751

391

18

5.65486678...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime