|
A Numerically Controlled Oscillator (NCO) is a key component to many Digital Signal Processing (DSP) systems. Here's a small one I hope you enjoy.
Just hit the up/down button on the left to increase/decrease the frequency. There are 7 settings.
0Hz 75Hz 150Hz
25Hz 100Hz 175Hz
50Hz 125Hz
Frequency resolution of 25Hz
N = 8 output bits (1 byte) (phase resolution)
W = 3 frequency control word (phase step) bits
Fclk = 6.4kHz
F = 2แต ร Fclk / 2แดบ
Blue waveform: Output
Green waveform: First 4 bits
Orange waveform: Clock
An NCO is an oscillator that is completely controlled by digital logic. It works by recursively adding digital numbers using binary adders in a feedback loop. This is called a phase accumulator. Think of "phase" as the stored digital number, which can represent the actual phase (time component) of a signal. Normally, it is paired with some kind of Phase to Amplitude converter (PAC). In my AWG circuit, I do just that: https://everycircuit.com/circuit/6214446053326848
The phase accumulator consists of 2 parts: phase register and frequency control register.
The phase register (the right 2 counters) stores the current binary number (i.e., phase). This stored number is added with the phase step binary number stored in the frequency control register (left counter). The result is re-stored in the phase register. The phase step is sometimes called the "tuning word," and it determines the amount added to the current phase and thus controls the frequency. The adders for each bit are in the center (center logic gates).
Here's a sample of what happens
Phase register Freq. Register
00000000. 100. Add 4
00000100. 100. Add 4
00001000. 100. Add 4
00001100. 100. Add 4
00010000. 101. Add 5
00010101. 101. Add 5
00011010. 101. Etc....
Do you see how the phase increases faster when it's added by a larger phase step? This skip counting action is how the frequency goes higher or lower.
These digital numbers can represent address (like on a look-up table (LUT) for DDS), or they can be displayed on 7-segment displays, or sent directly to a DAC for a variable sawtooth wave signal (which is what I did).
That's a lot of info! Comment below with questions...
|