Download Innovative Experiments using Phoenix

Transcript
Figure 3.2: Rising-to-falling edge delay
The multi_read_block function examines only the channel list - it does
not care which channel has been set by calling select_adc(). The channel list
is maintained internal to the memory of the micro-controller which controls
the Phoenix box - if an application adds a channel to the list, a call to
multi_read_block() later from another application will result in that channel
also getting digitized. Programs like CROs must remove all channels from
the list while starting and then add the required ones.
3.6 Time Measurement Functions
The Phoenix library includes several functions which can be invoked to measure time periods. Most of these functions basically measure time delays
between rising/falling edges on the various Digital Input pins or Analog Comparator Input. Say you wish to compute the on time of a square wave applied
to digital input pin D0 (see gure 3.2); you can simply connect the PWG
socket to D0 and execute:
> > > p.set_frequency(1000)
> > > p.r2ftime(0, 0)
500
The function accepts two digital input pin numbers (which can be the same
or dierent) and returns the time in microseconds between two consecutive
rising and falling edges.
Similarly we can measure the falling edge to rising edge time also using
the 'p.f2rtime(0,0) call. From which we can calculate the period of the wave
and the duty cycle. The arguments can be dierent. For example you can
measure the time between a rising edge on one Input to a rising edge on
another Input.
28