BECKHOFF DK9222-0213-0063 User Manual

Page 6

Advertising
background image

XFC

Oversampling

Application Note DK9222-0213-0063

TwinCAT sample

In the file DK9222-0213-0063_TwinCAT_sample.zip, the TwinCAT sample program is given as SMTPE_Timecode.pro.

With the code of the program sample, six steps are provided to extract the time information out of the SMPTE frame:
– Conditioning the EL3702
– Detecting the transitions
– Analysing the transitions
– Identifying high and low bits
– Analysing the bitstream
– Extracting the bits

1 | Conditioning the EL3702

The EtherCAT Oversampling Terminal EL3702 listens to the SMPTE output signal and provides an array of values to the TwinCAT
PLC. By default the cycle time of the PLC is set to 1 ms and the oversampling rate of the EL3702 is set to 100. Therefore the
signal is split into samples with a size of 10 µs, and 40…50 samples for each timecode bit can be analysed.

2 | Detecting the transitions

In the array Tab_EL3702_Doublecycles the two last cycles are stored: the samples of the current cycle (n) and the cycle
before that (n-1). In each PLC cycle, the program edits the current cycle samples (n). The samples of n-1 are used to compare
the current state of the timecode input with the past state. In that way it is possible to check whether a change of sign has
occurred in the periods n-1 to n. When the sign is changing, a transition is detected.

IF Tab_EL3702_Doublecycles[ i-1] * Tab_EL3702_Doublecycles [ i ] < 0
(* The analog signal change
s sign --> there is an edge *)
OR Tab_EL3702_Doublecycles [ i-1 ] <> 0 AND Tab_EL3702_Doublecycles [ i ] = 0 THEN

3 | Analysing the transitions

Tab_EL3702_DoublecyclesTrig is an array that shows only the transitions of the timecode signal. Only the transitions of the
last cycle samples (n) are managed/handled. Tab_EL3702_Doublecycles contains the samples, generated by the EL3702, of
the last 2 PLC cycles. Only transitions of the past cycle are checked, marked in red in the figure below.

New Automation Technology

BECKHOFF

6

For application notes see disclaimer on the last page

Advertising