pll_mc145156

Library to manage the pll chip MC145156 from Motorola

Author Pavel Milanes Costa (CO7WT) - pavelmc@gmail.com, copyright © 2014, all rights reserved.
Adapted-by
Compiler >=2.4q3

Description

This library files implement the procedures to manage a PLL system using the
Motorola MC145156[-1|-2] chips



A PLL is a Phase Locked Loop, a kind of Controlled oscillator used in base/mobile/handheld
radios before the invention of the DDS chips.



A PLL is no more than a Voltage Controled Oscillator (VCO) that is controled by the phase
difference of it's output compared against a reference, usualy the comparison is made
after a programable division of the output of the VCO. In this case with a dual modulus prescaler



I assume that you know how all this work, if not please ask to google...



All you need is the reference frequency, by the datasheet this is calculated by the Xtal
the division ratio configured in the pins RA0..RA2, see datasheet page 14 (look for a table)
this will be called "PLL_R" and expressed in Khz



Then you need to know the simple division ratio of your prescaler, mine is 64 (64/65), this is
called "PLL_P"



From the math from the datasheet you need to calculate the register N and A, I solved that for you



Nt = (Desired_freq/Reference_freq); but also Nt = (N*P)+A



So, to calculate N and A registers (pll_N and pll_A in this lib) you need to know the desired freq
for example 145000Khz



Nt = 145000/5 = 29000; N = Nt/P
A = Nt - (N*P)



Next step is to send the info via SPI to the chip. For that you need three pins
in this case we use pll_clk, pll_dat and pll_ena aliases, and if your circuit need to send sw1 & sw2
you must define its value at load time in normal condition and then you can vary it


Sources

Motorola Datasheet


Notes

* Release date: 11 Nov 2014


Dependencies

No dependency found



Summary

Global variables/contants

Procedures

Private

Functions


API details

Global variables/contants

Procedures

Private

Functions


Related samples

Here are the list of samples which use this library:

18f14k5018f14k50_pll.jal