Writing the AcquireData Procedure

Just as you have written procedures before in other modules, you will write a procedure within your form. This procedure initializes the arrays with a dummy waveform. The first array will display a sin wave with increasing frequency. The second array will be filled with a sin wave that cycles m_iAcquire times.

To write the form procedure:

1.      From the form view, select Procedures from the form items combo box. The right combo box now displays a list of the form procedures, which is initially empty.

2.      Select Procedure Below from the Insert menu. A new procedure is created.

3.      From the Properties window, change the name to AcquireData and the description to Initialize arrays with a dummy waveform.

4.      Create the following procedure variables:

 

Name:

Parameter:

Type:

Dim:

adData1

Var

Double

1

Name:

Parameter:

Type:

Dim:

adData2

Var

Double

1

Name:

Parameter:

Type:

Dim:

i

None

Long

0

Name:

Parameter:

Type:

Dim:

iSize

None

Long

0

Your screen should now look similar to the following:

 

5.      Add the following code in the procedure code area:

iSize=sizeof(adData1)/sizeof(double)

for i=0 to iSize-1 do

! freq increase over samples

adData1[i]=sin((PI*i)/(iSize-i+1))

! m_iAcquire # of sin cycles

adData2[i]=sin ((PI*i*m_iAcquire*2)/iSize)

next