# Is PIC right for my project?

#### Bob D.

##### New Member
I worked in embedded micro programming for 14 yrs, but I've been in retirement for 12 years and I'm sure much has changed. Also my skills are very rusty by now. I came across a little home project that needs a micro computer, and I wonder if one of the PICs would fit the bill. I want to build a device that stabilizes the VFO on an old ham radio I have. I believe the program would be very simple, But the micro would need the following requirements:

A timer capable of counting an external signal of 5 to 5 1/2 MHz.
An additional timer that can be used as a time base (basically making a frequency counter).
A D/A converter to drive a varactor diode (although an I/O pin pulsing a capacitor might work).

Do any of the PIC models have this capability?

Also, what kind of development tools are available? I would need to set breakpoints and read regs and memory, also program parts.

BTW, since this is just a home project, the budget is tight!

Bob, ND9B

#### Pommie

##### Well-Known Member
If you google "Pic frequency meter" you'll get lots of examples. First one.

You'll need to install (the free) MPLABX and the XC8 C compiler - I'm assuming you're comfortable with C.

A nice pic with analogue out is the Pic16F18857 - 28 pins but only a 5 bit DAC. Have a browse and see what you think. You maybe more comfortable with an 18 series chip.

Mike.
Edit, you can always use the PWM module to generate a 10 bit output voltage.

#### JimB

##### Super Moderator
Bob, I think you are looking for a "huff and puff" type circuit.
I have one somewhere which I have used successfully on a couple of radios of my own.

The circuit is not my original design, it came from the website of a now defunct company called Cumbria Designs.
The original circuit used a 16F88 (from bad memory), I adapted it to use a 16F628A.

Let me see if I can find the circuit.

Jim GM3ZMA

#### augustinetez

##### Active Member
Here's the Cumbria 16F88 Stabiliser

The code is written in ASM

There was also an earlier 16F628 version

#### JimB

##### Super Moderator
Looks like Terry beat me to it.
Also he has links to the original info, which is good as I was starting to get very confused looking back at my files.
It looks like the 16F628 version came from Cumbria, it was not a modification of mine after all.
But be aware there is an error in the 16F628 version, the schematic shows the output to the varactor on the RB0 port of the PIC, the code directs the output to port RB4.

JimB

##### Active Member
A nice way to do a VFO is to use a simple processor and a DDS module.

Module cost, shop around, I have purchased in past DDS modules for < $3. They produce sine and are xtal controlled for accuracy and high resolution. Interface simple, bit bang a simple serial interface, some with SPI/I2C. Use Arduino Nano for a board, another$ 3. And a blue mode LCD display,
2 x 16 or 2 x 20 or 4 x 20 max of $10. https://www.ebay.com/itm/132111901790?hash=item1ec27ba45e:g:PfsAAOSwCU1YtsCZ an example, shop around The new Arduino IDE supports debugging. Regards, Dana. #### Pommie ##### Well-Known Member Most Helpful Member The new Arduino IDE supports debugging. Can you elaborate on that? Mike. #### Ian Rogers ##### User Extraordinaire Forum Supporter Most Helpful Member Arduino 2 is still in beta and has been for quite some time.. The debug option does look very appealing but I not sure how usable the IDE is, I use Pic's and I don't know if they are compatible.. #### danadak ##### Active Member Can you elaborate on that? Mike. It is beta at the moment. I have not yet tried it. Regards, Dana. #### rjenkinsgb ##### Well-Known Member Most Helpful Member Also, what kind of development tools are available? I would need to set breakpoints and read regs and memory, also program parts. Many PICs can do what you need easily, as others say. Re. debugging - At the low end, the PICkit 3 / 4 or similar would work fine, or at the high end the ICD units are rather faster but pricier. The newer (last decade or so?) PICs have a built in hardware debug system as well as in circuit programming; using MPLab and one of the interfaces, you can set breakpoints, step the program, view registers etc. My personal favourites are the DSPIC33E512GP502 for high performance, with numerous built in peripherals and clock to 120MHz or higher, 768K flash and 48K RAM.. Also some of the mid range PIC18 series and down to the PIC16F18313 which is an eight pin, 32MHz one including a debug interface. Many recent devices also have "Peripheral pin select", where many hardware peripherals have programmable connections to the physical pins, so you can set the ones you want to whichever pins you want. Both the specific types above have that capability. #### danadak ##### Active Member This has full debug, thru USB, and a rich set of analog peripherals, and hundreds of reference projects. IDE (PSOC Creator) and Compiler free. On chip resources catalog, attachment. From simple logic to LUT to 74HC (some parts) to DDS, DSP, PWM, Counter, Quadec, SAR, DelSig, analog muxes, Vref, OpAmps, Comparators, DAC, WaveDAC.... You route signals to/from internal resources and out / in from pins with a tool. Has a state machine wizard, DMA wizard, DSP filter wizard, .....many facilities in IDE. The window second from right is the chips catalog of internal resources. Board with Debug starts at$ 10.

Here is example of a DSP filter, all onchip, it used very few resources onchip leaving the rest for other tasks
(see right hand window, resources used / left) -

https://www.cypress.com/documentati...oc-5lp-prototyping-kit-onboard-programmer-and

You can do custom internal functions, using schematic capture (in IDE) and/or Verilog. A couple of examples -

Regards, Dana.

#### Attachments

• Component List (2).doc
178.5 KB · Views: 0
Last edited:

Replies
3
Views
727
Replies
1
Views
1K
Replies
7
Views
2K
Replies
6
Views
3K
Replies
11
Views
1K