04-09-2008 05:04 PM
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.
04-14-2008 10:55 AM - last edited on 03-01-2024 06:59 PM by migration-bot
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-
04-14-2008 12:02 PM
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