Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

Pulse train generation

Hi all,
 
I'm using a PCI-6229 under RTX environment. I would like to generate a pulse train.
I started with 660xRLP examples files and also with ESeriesRLP examples files but it doesn't work.
Is there any example file with the m series?
 
Your help is welcome.
FV1234
0 Kudos
Message 1 of 6
(8,667 Views)
Hi,
What software are you using?
Do you have a message error?

On RTX you can only use the Daqmx base and there is some restriction. It can be the origin of your issue.
It may be possible that the exemple uses some functions that are not supported by the RTX.

0 Kudos
Message 2 of 6
(8,658 Views)

Hi Fv1234-

There isn't a pulse train generation example for M Series in the C/C++ MHDDK.  I am busy with other commitments now and may not be able to create one for a bit.  I noticed in another thread that you were able to use the LabVIEW NI-DAQmx Base example to create a C-based example.  If this is an option for you, I would encourage you to do the same for pulse train generation.  The setup steps are somewhat involved (as I'm sure you noticed in previous examples).  If this is not an option, can you please post what you have so far so that I can offer some pointers?

Thanks-

Tom W
National Instruments
Message 3 of 6
(8,652 Views)

Hi Tom,

I give you my code to check it

BEGIN CODE

  boardGpct->G1_Load_A.writeRegister(0x00001000);
  boardGpct->G1_Load_B.writeRegister(0x00001000);
  boardGpct->G1_Command.writeG1_Load(1);
  
  boardGpct->G1_Input_Select.setG1_Source_Select (0);  // 20 MHz
  boardGpct->G1_Input_Select.setG1_Source_Polarity(0); //invert=1
  boardGpct->G1_Input_Select.setG1_Gate_Select (31);  // Logic Low
  boardGpct->G1_Input_Select.setG1_OR_Gate(0);
  boardGpct->G1_Input_Select.setG1_Output_Polarity(0); //active high=0
  boardGpct->G1_Input_Select.setG1_Gate_Select_Load_Source(0);
  boardGpct->G1_Input_Select.flush ();

  boardGpct->G1_Mode.setG1_Output_Mode(tTIO::tG1_Mode::kG1_Output_ModeToggle);
  boardGpct->G1_Mode.setG1_Gate_Polarity(1); // Enable inversion
  boardGpct->G1_Mode.setG1_Reload_Source_Switching(tTIO::tG1_Mode::kG1_Reload_Source_SwitchingAlternate);
  boardGpct->G1_Mode.setG1_Loading_On_Gate(tTIO::tG1_Mode::kG1_Loading_On_GateNo_Reload);
  boardGpct->G1_Mode.setG1_Loading_On_TC(tTIO::tG1_Mode::kG1_Loading_On_TCReload_On_TC);
  boardGpct->G1_Mode.setG1_Gating_Mode(tTIO::tG1_Mode::kG1_Gating_ModeEdge_Gating_Active_High);
  boardGpct->G1_Mode.setG1_Gate_On_Both_Edges (tTIO::tG1_Mode::kG1_Gate_On_Both_EdgesBoth_Edges_Disabled);
  boardGpct->G1_Mode.setG1_Trigger_Mode_For_Edge_Gate(tTIO::tG1_Mode::kG1_Trigger_Mode_For_Edge_GateGate_Starts_TC_Stops);
  boardGpct->G1_Mode.setG1_Stop_Mode(tTIO::tG1_Mode::kG1_Stop_ModeStop_On_Gate);
  boardGpct->G1_Mode.setG1_Counting_Once(tTIO::tG1_Mode::kG1_Counting_OnceNo_HW_Disarm);
  boardGpct->G1_Mode.flush ();

  boardGpct->G1_Command.setG1_Up_Down(tTIO::tG1_Command::kG1_Up_DownSoftware_Down);
  boardGpct->G1_Command.setG1_Bank_Switch_Enable(tTIO::tG1_Command::kG1_Bank_Switch_EnableBank_X);
  boardGpct->G1_Command.setG1_Bank_Switch_Mode(tTIO::tG1_Command::kG1_Bank_Switch_ModeGate);
  boardGpct->G1_Command.flush();

  board->IO_Bidirection_Pin.writePFI13_Pin_Dir(tMSeries::tIO_Bidirection_Pin::kPFI13_Pin_DirOutput);
  
  boardGpct->Interrupt_G1_Enable.getG1_Gate_Interrupt_Enable(0);
  boardGpct->Interrupt_G1_Enable.getG1_TC_Interrupt_Enable(0);
  boardGpct->Interrupt_G1_Enable.flush();

  board->G1_DMA_Config.writeG1_DMA_Reset(1);
   
  board->G1_DMA_Config.setG1_DMA_Enable(0);
  board->G1_DMA_Config.setG1_DMA_Int_Enable(0);
  board->G1_DMA_Config.setG1_DMA_Write(0);
  board->G1_DMA_Config.flush();

  board->Analog_Trigger_Etc.setGPFO_1_Output_Enable(tMSeries::tAnalog_Trigger_Etc::kGPFO_1_Output_EnableOutput);
  board->Analog_Trigger_Etc.setGPFO_1_Output_Select(tMSeries::tAnalog_Trigger_Etc::kGPFO_1_Output_SelectG_OUT);
  board->Analog_Trigger_Etc.flush();

  boardGpct->G1_Command.writeG1_Arm(1);

END CODE

Thanks for your help

FV1234

 

0 Kudos
Message 4 of 6
(8,633 Views)

Hi Fv1234-

I came up with a quick example based on the NI-DAQmx Base implementation.  It shows how to set up the counter for continuous pulse train generation on counter 0.  In the example I just set up and arm the counter and then spin briefly in a loop to allow time to confirm the pulse train is indeed available on PFI12.  Give this a try and let me know how it works out for you.

Thanks-

Tom W
National Instruments
Message 5 of 6
(8,616 Views)

Hi Tom

Thanks you so much for your help.

I posted another question in another thread. I would like now to measure a duty cycle. I put a square wave with 20% of duty cycle. Sometimes, my measure start with the low level and sometimes with the high level. In fact, I measure 20% or 80%. If I configure a semi-period channel with MAX, I always have the wrigth measure.

Thanks,

FV1234

0 Kudos
Message 6 of 6
(8,599 Views)