Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

Repeated Single Pulse Generation w/ Variable Timing on 660X

I am trying to generate a single pulse with a delay and width specified through Matlab.  Our version of Matlab does not appear to have this capability so I am currently programming the registers on the NI PCI-6602 card in C.  I can produce one pulse by setting the mode register to 0xB659.  I am starting the pulse with the arm command.  However, I can only put out one pulse...even when I try to disarm and rearm.  I need to be able to put out this pulse multiple times, but I can't use PWM or a pulse train for this scenario due to variable timing and how we need to calculate the delay times.  What do I minimally need to do after the first pulse to be able to push out another single pulse (registers to reset, bits to set or clear)?  Right now I am just trying to disarm and rearm on the command register.

 

Also...I believe I am unable to use DAQmx drivers, because we are compiling MatLab Simulink code which is then downloaded to a target PC and run on a real-time operating system.  We are specifically using Simulink in conjunction with xPC Target (another MatLab utility).  If it is possible to package the DAQmx driver code and make the calls from Simulink, then your suggestion might be possible.  I am not quite sure on how to do this or if it is possible, but maybe you or other engineers might.  I understand that NI works very closely with MathWorks.

0 Kudos
Message 1 of 3
(6,951 Views)
 
Hi schm-
 
You should be able to accomplish this by manually reloading the counter (via Gi_Load) and then re-arming.  I'll assume you're using the method shown in the MHDDK  660x example gpct_ex4.cpp.  To be safe, I would recommend performing these steps (assuming your pulse specs for delay from trigger and pulse width are loaded into the LoadA and LoadB registers, respectively):
 

board->G0_Mode_Register.writeG0_Load_Source_Select(0);  //select LoadA as load source.  counter MUST be disarmed for this to have any effect
board->G0_Command_Register.writeG0_Load(1);  //load the counter from LoadA
board->G0_Command_Register.writeG0_Arm(1);

I haven't tested this, but it should work.  Give this a try and let me know if you have any issues.

Thanks-

Tom W
National Instruments
0 Kudos
Message 2 of 3
(6,924 Views)

Tom -

Thanks for replying.  I finally got the hardware to work and its exactly the way as you stated.  I had some unrelated coding issues that were preventing more than one pulse from coming out.

Jeff

Message 3 of 3
(6,919 Views)