LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Modifying PWM of 6602 in CVI while running

Hi,
 
 
I am trying to continuesly change the PWM signal off counter zero of a PCI-6602
I have the following at start which works:
 DAQmxCreateTask ("", &PWMHandle);
 DAQmxCreateCOPulseChanFreq (PWMHandle, "Dev2/ctr0", "", DAQmx_Val_Hz, DAQmx_Val_Low, 0.0, 50, exh_pos);
 DAQmxStartTask(PWMHandle);
 
But how do I modify the duty cycle without stoping and restarting it?
 
I am running a servo(20ms pulse) and in the Device Exlorer Test Panel, the duty cycle of 4 gives me something and in the programme, everything else the same, the duty cycle of 4 gives me a different position(and so I conclude a different PWM duty cycle) .
 
 
Thanks
Amin 
0 Kudos
Message 1 of 4
(3,309 Views)
I have found the following function
 
     DAQmxWriteCtrFreqScalar(PWMHandle   ,1,10.0,pwmfreq,exh_pos,NULL);
 
And this is what is done in one of the samples!
However during runtime it gives an error "no output in the channel" ?
 
Any leads?
 
Thanks

Message Edited by Amin Ahmadi on 05-31-2007 09:51 AM

0 Kudos
Message 2 of 4
(3,293 Views)
Hi Amin,
From your description, I don't see anything that would be causing this problem.  Is there an error code that goes along with the along with the "no output" text?  If you could post the error code and exact text of the error, that may help locate the problem.
Thanks,
Luke
Applications Engineer
National Instruments
0 Kudos
Message 3 of 4
(3,277 Views)
Thanks Luke, I did figure out what to do with it,
 
For the record and benefit of those wh might search later:
 
as I found from another thread a link to which I wish I had not lost here is what needs to be done:
 DAQmxCreateTask ("", &PWMHandle);
 DAQmxCreateCOPulseChanFreq (PWMHandle, "Dev2/ctr0", "", DAQmx_Val_Hz, DAQmx_Val_Low, 0.0, pwmfreq, exh_pos);
 DAQmxCfgImplicitTiming(PWMHandle,DAQmx_Val_ContSamps,1000);
 DAQmxStartTask(PWMHandle);
 
without the imlplicit timing function, it assumed a finite loop or something like that and therefore does not like to change the PWM duty cycle.
So it works now
0 Kudos
Message 4 of 4
(3,260 Views)