ClockMaster
8/8/2002
7
www.spincore.com
Programming Notes for ClockMaster
:
1. Using the PM02PC01 DLL
In order to change the output frequency of the ClockMaster
, we have
packaged a DLL (pm02pc01.dll) and a library file (pm02pc01.lib) that provide
a function with this capability. Use of this function is demonstrated below.
Provided Functions
int cm_set_freq(double frequency);
This function accepts desired output frequency as its input and returns a
0 if the call was successful.
double frequency – value of desired output frequency (in kHz).
2. Ordered Byte Output Description
All data transfers to the ClockMaster
are sent to the base address of the
I/O space defined for the card plus an offset of 0x0C. Data transfers
involve the sending of 8 bytes of data. The data transfer must take place in
the following manner. The top four bits of each output word must start at
0xF and toggle between 0xF and 0x0 for each byte output. The lower four bits
of each output word are the bits of the desired output word, starting with
the most significant 4 bits.
Example Output:
The following is an example of the output sequence to program the
ClockMaster
. Explanations are included in brackets in the middle of the
code. Use this method only if you are writing directly to the output port by
using an _outp or similar function and not using the provided functions and
drivers.
First, you must find the new data value to transfer based on the desired
frequency. The formula for finding the desire frequency is
Output Word = Desired Frequency (in MHz)* 2^32 / Clock Frequency (in MHz)
For example, if you wanted an output frequency of 19.6415 MHz on a 50 MHz
system
Output Word = 19.6415 * 2^32 / 50
= 1687192002.88768
≈
1687192003
= 0x649081C3
Section IV: Programming Information