• AVR Freaks

AnsweredHot!NCO

Author
lewjoubert
New Member
  • Total Posts : 24
  • Reward points : 0
  • Joined: 2004/07/22 14:28:09
  • Location: Gold Coast Australia
  • Status: offline
2020/08/25 23:43:33 (permalink)
0

NCO

Hi all, I have a problem with a NCO and I'm hoping someone can assist.
I'm using a PIC16F18326 / 20MHz xtal. Everything runs fine.
The best resolution I can get is 7.65Hz, I was hoping for 1Hz as outlined in various Microchip documents.
I have configured PPS to output the NCO on RC4. The only frequency control I can get is by adjusting values in NCO1INC register which adjusts frequency in multiples of 7.65Hz. NCO1CLK<1:0> adjusts frequency OK between Fosc and HFintOSC.
Writing values to INC1ACC has no effect.
I am not making use of the NCO interrupt... should I be?
What am I missing, can a resolution of 1Hz be achieve?
Any/all help will be greatly appreciated.
Regards,
Lew.
 

A monkey in silk is a monkey no less - Rodriguez.
#1
mpgmike
Super Member
  • Total Posts : 480
  • Reward points : 0
  • Joined: 2014/01/23 17:27:06
  • Location: NJ
  • Status: offline
Re: NCO 2020/08/25 23:53:13 (permalink) ☼ Best Answerby lewjoubert 2020/08/26 03:21:52
0
Assuming you got NCO1CON settings correct, you change frequency output by modifying NCO1INCL, NCO1INCH, and (if it's 20-bit resolution) to NCO1INCU.  These would be your LOW, HIGH, and UPPER bytes of your 20 bits:
xU HH LL.

I don't need the world to know my name, but I want to live a life so all my great-grandchildren proudly remember me.
#2
lewjoubert
New Member
  • Total Posts : 24
  • Reward points : 0
  • Joined: 2004/07/22 14:28:09
  • Location: Gold Coast Australia
  • Status: offline
Re: NCO 2020/08/26 03:28:25 (permalink)
0
Thanks mpgmike,
I'll double check NCO1CON settings.
I don't find any difference in writing to the individual 'INCU/H/L registers as writing to the all encompassing NCO1INC
register. Changing frequencies no problem, just can't get that 1Hz resolution!

A monkey in silk is a monkey no less - Rodriguez.
#3
mpgmike
Super Member
  • Total Posts : 480
  • Reward points : 0
  • Joined: 2014/01/23 17:27:06
  • Location: NJ
  • Status: offline
Re: NCO 2020/08/26 06:07:36 (permalink)
+1 (1)
Sounds like you're using Fosc/4 for NCOCLK.
 
There is a trade-off with NCO; you can reach frequencies =< CLOCK/2.  Using a faster clock = higher frequencies.  The counter point is that resolution = CLOCK / 2^20.  In other words, great resolution using LFINTOSC, but max freq = 15.5k.  Look at the Clock choices; 31k >> 16MHz.  Use the slowest clock that will meet your target frequency range to get the best resolution.

I don't need the world to know my name, but I want to live a life so all my great-grandchildren proudly remember me.
#4
Jump to:
© 2020 APG vNext Commercial Version 4.5