motorsfere.blogg.se

Creating a sine wave in mplab xc8
Creating a sine wave in mplab xc8










creating a sine wave in mplab xc8

However, the accuracy of the digital signal will be far greater. That's doable in analog if you're careful. The DSP multiply-accumulate hardware will allow each contribution to be added with its own gain easily.ĭigitally derived signals like that won't drift in frequency or amplitude, and will have better signal to noise ratio. That's a lot, and will allow lots of different sines to be added each sample. At 40 MIPS, you have 1000 instruction cycles every sample at 40 kHz sample rate. This is well within the capability of even low end DSPs, like the Microchip dsPIC line. They can all use the same 1/4 wave sine table, just index into it at different increments per sample to get the different frequencies. Another problem with the analog approach is that the frequencies and amplitudes will drift.Ī much better way to do this is to generate all the sine waves in a processor and add them up digitally. The analog approach will definitely not be compact. Your first sentence mentions you want a whole bank of these things, and you want the design compact.

creating a sine wave in mplab xc8

You mentioned this is a audio application, so I can't imagine a good reason for all the analog. Nowadays doing this in analog is silly except perhaps for some very specialized or high frequency applications. This doesn't answer what you asked, but I think relevantly addresses the problem. I'm still not sure what I'll use in the final circuit as AGC, suggestions are welcome. Here is the circuit I've been working from, it's from the National Semiconductor LM386 Low Voltage Audio Power Amplifier datasheet-Īnd this is what my implementation looks like, I don't have a suitable incandescent bulb so I've just replaced it with a 1KΩ pot.

creating a sine wave in mplab xc8

Is this a suitable approach for making a compact analog sine wave oscillator?Īlso, how would you suggest I control the frequency, which component value should be changed to achieve this? - I've tried messing with all the resistors to change the pitch, but they all seem to be interdependent. I'll be using the oscillators to do some additive audio synthesis, maybe some FM and I'll probably need some of the oscillators as LFOs. As I'm working from a single power supply and I'm trying to keep the design small, I've been using the LM386n-1 IC. I've started by making a Wien Bridge oscillator. I'm making a bank of analog sine wave oscillators and I'm interested in keeping the design compact.












Creating a sine wave in mplab xc8