National Instruments 320682C Musical Toy Instrument User Manual


 
Chapter 10 Easy I/O for DAQ Library
© National Instruments Corporation 10-37 LabWindows/CVI Standard Libraries
FrequencyDividerConfig
short
error
=
FrequencyDividerConfig
(short
device
, char
counter
[],
double
sourceTimebase
,
double
timebaseDivisor
,
unsigned short
gateMode
,
unsigned short
outputBehavior
,
short
sourceEdge
, unsigned long *
taskID
);
Purpose
This function configures the specified counter to count the number of signal transitions on its
SOURCE pin or on an internal timebase signal, and to strobe or toggle the signal on its OUT pin.
To divide an external TTL signal, connect it to counter's SOURCE pin, and set the
sourceTimebase
parameter to USE_COUNTER_SOURCE.
To divide an internal timebase signal, set the
sourceTimebase
parameter to a desired valid
frequency.
Set the
timebaseDivisor
to the desired value. For a value of N and a pulsed output, an output
pulse equal to the period of the source or timebase signal appears on counter's OUT pin once
each N cycles of that signal. For a toggled output, the output toggles after each N cycles. The
toggled output frequency is thus half that of the pulsed output, in other words,
pulsedFrequency = sourceFrequency/N
and
toggledFrequency = sourceFrequency/(2*N)
thus, if N=3, the OUT pin would generate pulses as follows:
_ _ _ _ _ _ _ _ _ _ _ _
source _| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |
___ ___ ___ ___
pulsed _| |_______| |_______| |_______| |______
___________ ___________
toggled _| |___________| |_________
If
gateMode
is not UNGATED_SOFTWARE_START, connect your gate signal to
counter
's
GATE pin.