HP (Hewlett-Packard) B Network Router User Manual


 
Specifying a Sample Rate
This program demonstrates:
how to set the digitizer trigger (sample) source
how to set the sample rate
In this example, a 1 kHz square wave is sampled at a rate which includes
the 11th harmonic. All samples are post-arm.
SAMPLE.C
*RST;*CLS /* reset and clear the digitizer */
CONF1:ARR:VOLT (50),10,(@3) /* set 50 readings, 10V range */
ARM:SOUR1 IMM /* arm when put in wait-for-arm state */
TRIG:SOUR TIM /* set trigger source to timer 1 */
TRIG:TIM1 20E-6 /* set sample period to 20 us */
READ? /* put digitizer in wait-for-arm state */
/* and retrieve the readings */
Comments 1. Sample Period and Sample Count. The period at which to sample a 1
kHz signal and include the 11th harmonic is determined by:
period = 1 / 4(f
c
) = 1 / 4(11 kHz) = 22.7 µs
where f
c
is the frequency of the 11th harmonic (11 kHz). Because of the
trigger source used in this program (TIMer), the sample periods available
are 1, 2, 4, through 1E8, 2E8, 4E8 multiples of the reference clock (the
internal 20 MHz oscillator set by the CONFigure command). Therefore,
given the 22.7
µs sample period calculated, the actual sample period used is
20
µs.
The number of samples to take is computed by:
sample count = signal period (fundamental)/actual sample period
= .001/.000020 = 50
54 Usin
g
the Di
g
itizer Chapter 2