by Jouni Verronen, OH8RO
PIC prosessors have become very popular control devices. One particularly useful feature is the flash program memory, which is electrically erasable. So you can have reprogram-compile-load-test-erase cycles in very svift repetition.
These two assembler sources are examples of code for loading division ratios serially to a synthesizer IC. They are for a 433 MHz RX with 70 MHz IF 12.8 MHz xtal oscillator and VCO above the signal frequency. The code should work in newer processors as 16F870 and 16F628 with minor changes.
The prosessor goes to sleep after loading the synthesizer, new loading with reset. Remarks in the code are in Finnish thus far.
As to the hardware there is nothing fancy needed exept the standard circuit with RC-clock (8k2 / 82p) and reset. A good starting point in PICs is the material by David Tait, which is found at various sites in the net.
On division ratios
The reference frequency to the phase detector is fo / R. fo is the frequency of the reference xtal oscillator. VCO frequency fv = Ntot * fo / R = ( N * 128 + A ) * fo / R The main division ratio Ntot is loaded in N and A components. The values can be in the range: R : 8...16383. A : 0...127 N : 16...2047
For R and N two 8 bits words must be used in 16F84 as they can be more than 255. These are related as:
R = 256 * Ry + Ra and N = 256 * Ny + Na To calculate the components: Ny = int(N/256) Ry = int(R/256) Na = N - 256 * Ny Ra = R - 256 * Ry
These numbers are loaded in the following order, msb first :
0 prescaler bit, 128/129 Ry 6 bits Ra 8 bits 1 control bit, was R Ny 3 bits Na 8 bits A 7 bits 0 control bit, were N,A
Let's calculate one example:
fo = 12.8 MHz fi = 70 MHz fs = 434.750 MHz If we choose channel spacing = phase det.reference as 25 kHz, then R = 12800 / 25 = 512 => Ry = 2 => Ra = 0 Now VCO is above: fv = fs + fi = 434.750 MHz + 70 MHz = 504.750 MHz Ntot = 504750 / 25 = 20190 fv = Ntot * 25 kHz = (N * 128 + A) * 25 kHz Ntot / 128 = 20190 / 128 = 157.73 => N = 157 A = 20190 - 157 * 128 = 94 Ny = 0 Na = 157These numbers are in desimal form in the assembler code and can be edited.
Back to the FrontPage