LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I generate a continous square signal (50% and 5V 50Khz) with GPCTR0 channel on a DAQ E series

Dear All,

 

I want to generate a square wave (50% ,5V 50Khz) with GPCTR0 channel by tradition DAQ function on the DAQ E series.

My DAQ Cards is 6070E, software is Labwindows7.1.

 

I first time to use GPCTR function, so I study the help and some samples on the internet.

But I also don't know how to generate my squre wave, Who can help me to make the sample program for me?

 

 

 GPCTR_Control(iDevice, ND_COUNTER_0, ND_RESET);

  .

  .

  .

  .
 Select_Signal (iDevice, ND_GPCTR0_OUTPUT, ND_GPCTR0_OUTPUT, ND_LOW_TO_HIGH);

 

 

Thanks very much for your help.

 

Joseph.

0 Kudos
Message 1 of 2
(3,102 Views)

Here some instructions taken from an application of mine:

 

                daqChk (GPCTR_Control (2, ND_COUNTER_0, ND_RESET));
                daqChk (GPCTR_Set_Application(2, ND_COUNTER_0, ND_PULSE_TRAIN_GNR));
                daqChk (GPCTR_Change_Parameter (2, ND_COUNTER_0, ND_SOURCE, ND_INTERNAL_20_MHZ));
                daqChk (GPCTR_Change_Parameter(2, ND_COUNTER_0, ND_COUNT_1, (unsigned long)val));
                daqChk (GPCTR_Change_Parameter(2, ND_COUNTER_0, ND_COUNT_2, (unsigned long)val));
                daqChk (Select_Signal (2, ND_GPCTR0_OUTPUT, ND_GPCTR0_OUTPUT, ND_LOW_TO_HIGH));
                daqChk (GPCTR_Control (2, ND_COUNTER_0, ND_PROGRAM));

It'been a long time since I wrote them, but as far as I remember the value of 'val' with respect to the source frequency defines the resulting frequency of the generated signal; that is:

 

The counter uses a base frequency (ND_INTERNAL_20_MHZ in my example)

Its output stays high for ND_COUNT_1 counts and low for ND_COUNT_2 counts; since I am passing the same value for those values the duty cycle will be 50%

Pulse train frequency is given by ND_INTERNAL_20_MHZ / (ND_COUNT_1 + ND_COUNT_2)

To obtain your 50 kHz frequency given the internal 20 MHz base frequency you should pass 200 as both count 1 and 2. If you use a different base frequency you must change those values accordingly.

 

You can download this example that shows a complete application for pulse train generation: it should be applicable to your hardware too.

Message Edited by Roberto Bozzolo on 11-26-2009 09:26 AM


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 2
(3,098 Views)