Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

pic16f877a: sine wave with lookup table problem.

Status
Not open for further replies.

nidhin84

Newbie level 1
Joined
Jul 10, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Kerala
Activity points
1,286
i cannot increase the frequency more than around 1kHz.

i am using 64 sampled look-up table. 20MHz crystal.

how can i increase the sample rate to get 10kHz sine wave. (that is sample rate at 1.5625 micro sec/sample)
 

i cannot increase the frequency more than around 1kHz.

i am using 64 sampled look-up table. 20MHz crystal.

how can i increase the sample rate to get 10kHz sine wave. (that is sample rate at 1.5625 micro sec/sample)

It depends on how you are controlling the loop that reads a table value, then outputs it to the analog out pin (DAC).

For the purpose of this discussion, I'll assume that you have a simple while loop running the following pseudo-code:
i = 0
while(TRUE)
{
analog_out = sine_table(i)
i = i +1
if i > 64 then i = 0
}

This code would execute as fast as possible. If your output sine wave is only 1 kHz, then your sample rate is 64kHz (you are putting out 64 points every 1 ms... 64 samples/0.001 sec = 64,000 samples/sec). If you cannot speed up the loop execution time, then you need to change the data in the LUT (LookUp Table). To go from 1 kHz to 10 kHz, you'll need to "play out" the sinewave 10 times faster, or output 1/10 of the number of points.

Reduce your LUT to 64/10 points (round down to nearest integer, 6). This will effectively increase your fundamental output frequency by a factor of 10. Since you are not outputting a "smooth" waveform, you will increase the power level in your harmonic frequencies, since it looks a bit like a square-wave.

If your code uses a different method of timing/playback sampling, then the answer will be different. Since you provided very little information about HOW you are sampling and outputting the signal, we are all left to just guess at your implementation.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top