C Program Generates Gated Sine Waves Digitally

June 22, 1998
The C program presented will generate gated-digital sine waves at a 10-Hz frequency (see the listing). Three parameters are user-defined at the head of the program—the output frequency (FO), the sampling rate...

The C program presented will generate gated-digital sine waves at a 10-Hz frequency (see the listing). Three parameters are user-defined at the head of the program—the output frequency (FO), the sampling rate (FS), and the number of samples to be saved to disk file “xxx”.

The sine function is synthesized by an undamped-biquad IIR digital filter. The sine waves are initiated by an impulse signal of a sampling period width (1/FS), whose impulse amplitude equals the sine-wave amplitude response of the filter (see the figure).

The sineOn( ) and sineOff( ) macros control the initiation of the gated sine waves. These are implemented as inline code in the for( ) loop in the program. A multitude of non-overlapping gated sine waves can be generated. Two such sine waves are shown in the figure. A multiple of sine frequencies (FO) can be generated with a suitable data structure.

Sponsored Recommendations

The Importance of PCB Design in Consumer Products

April 25, 2024
Explore the importance of PCB design and how Fusion 360 can help your team react to evolving consumer demands.

PCB Design Mastery for Assembly & Fabrication

April 25, 2024
This guide explores PCB circuit board design, focusing on both Design For Assembly (DFA) and Design For Fabrication (DFab) perspectives.

Unlocking the Power of IoT Integration for Elevated PCB Designs

April 25, 2024
What does it take to add IoT into your product? What advantages does IoT have in PCB related projects? Read to find answers to your IoT design questions.

Near- and Far-Field Measurements

April 16, 2024
In this comprehensive application note, we delve into the methods of measuring the transmission (or reception) pattern, a key determinant of antenna gain, using a vector network...

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!