Close

numerically controlled?

A project log for Digital out signals over 100kHz

Experiments using Arduino compatible boards to generate signals 100kHz to 2MHz

bobubobu 02/28/2021 at 20:520 Comments

Many Microchip PIC16F family parts have a numerically controlled oscillator (NCO) peripheral.  Will this work to generate signal for testing IF filters?

The clock is still 16MHz divided by something.  The NCO peripheral has a state machine that dithers between 2 divisors.  This gives a blended frequency.  A frequency counter can't see the dither.  I'm not sure about tuned filters.  The NCO state machine consists of an accumulator and full adder.  A fixed integer is added to the accumulator every cycle.  The adder overflow generates the tick of the frequency output.

The NCO in PIC16F parts has a 20 bit accumulator and 16MHz clock.  For 50% duty, the overflow toggles the output.  Output frequency is half when in 50% mode.  So that means target overflow frequency is 910kHz for my application.  That's a divisor of 17 or 18 or somewhere in between.  The dithering will have to do it's job at these frequencies.  The NCO output will have some spectrum spreading.  The signal won't be a sharp line in frequency domain.  This could make filter testing more difficult.  It's still worth trying.  It seems like a great solution, if it works.

Microchip has several useful application notes on how to use NCO.  Most of these are related to precise PWM or generating a data clock.   I plan to get a Microchip development board for testing.  https://www.microchip.com/developmenttools/ProductDetails/DM164141  $12.25 is a reasonable price for a dev board.

The dev board is running a PIC16F18345 processor. This has NCO peripheral and a 32 MHZ internal clock.  It includes a USB to PIC16 programmer. I'll have to figure out what toolchain to use for Linux.  This isn't Arduino, but PIC isn't difficult.

gputils https://gputils.sourceforge.io/ says it supports PIC16F18345

Discussions