- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
sir/mam
can you plz help me to find sine or cosine angle in decimal range. like sine 30 in the range of 0 to 3954 etc.what is the formula to convert this?Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You defined -I think - your amplitude resolution i.e. 0~3954
but you did not define phase resolution (how many points per cycle), for 256 points: x = sin(2*pi*(0:255)/256); x = round(x*3954);- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you sir.but iam very sorry that i could not clear my idea. my question is :
"case theta_int is when 45 => sin_data_int <= to_signed(99,12); cos_data_int <= to_signed(1439,12);" i don't understand this logic sir. can u plz make me understand sir? thanks in advance.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Basically you need some background on NCO functionality. You create a LUT containing one cycle worth of sine/cos data. Then once you choose a frequency, you need to find out how to do the phase (such as your when 45), here 45 represents the value of an accumulator for phase that will point at the LUT at that moment.
phase starts with say zero then you increment it by some fixed value depending on frequency to be generated. if your sampling frequency is Fs and your accumulator is 2^12 then to calculate phase increment from frequency: f = Fs * inc/2^12 hence inc = f/Fs *2^12 Hence add inc modulo 2^12: 0 => inc => 2inc => 3 inc => ...etc then allow rollover. at each addition the result of adder points to LUT. You may use larger accumulator then use 12 MSBs of its result. This gives better phase resolution for same given LUT. Alternatively you can use larger LUT...- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you very much sir.i have generated NCO code.but i can't understand how do i use it in sine/cosine look up table,i mean do i use port map for this case. plz help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you have code for NCO then I assume you mean you have code for phase accummulator. Then all you have to do is portmap your accummulator result to theta_in and get sin/cos data from LUT.
If your accummulator width is wider than LUT address bits then discard some LSBs of accumulator.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page