09-21-2010 12:18 AM
I am working on usb 6212 to generate pulses from this boad to drive stepper motor.i have to drive multiple stepper motors(using L298) through this board so i need many pins to genrate stepper motor driving sequence pulses.i have tried generating pulses using delay and switching the port pins alternately.but i am not able to generate high frequency pulses by doing so.will be gratefull to get ur help in solving my problem
satvir
09-29-2010 09:27 AM - edited 09-29-2010 09:36 AM
Look to my simple procedure (delphi)
procedure TForm1.Button2Click(Sender: TObject); var NumPoints:integer; der:integer; maxfreq:double; rate:real; begin rate:=1000; Error:=DAQmxCreateTask('',@cnt0Handle); MemoStatus.Lines.Add('Create cnt0 Task: status error'+IntToStr(Error)); Error:=DAQmxCreateCOPulseChanFreq(cnt0Handle,'Dev4/ctr0','',DAQmx_Val_FrequencyUnits_Hz,DAQmx_Val_Low,0.0,rate,0.50); MemoStatus.Lines.Add('Create COPulse: status error '+IntToStr(Error)); Error:=DAQmxCfgImplicitTiming(cnt0Handle,DAQmx_Val_AcquisitionType_ContSamps,nr_sample); Error:=DAQmxCfgImplicitTiming(cnt0Handle,DAQmx_Val_AcquisitionType_FiniteSamps,100); MemoStatus.Lines.Add('Cfg Implicit Timing: status error '+IntToStr(Error)); Error:=DAQmxGetDevCOMaxTimebase('dev4',@maxfreq); MemoStatus.Lines.Add('Cfg Implici Timing: status error '+IntToStr(Error)); MemoStatus.Lines.Add('Max Freq: '+FloatToStr(maxfreq)); Error:=DAQmxCreateTask('',@DOHandle); MemoStatus.Lines.Add('Create DO Task: status error '+IntToStr(Error)); Error:=DAQmxGetDevDOMaxRate('dev4',@maxfreq); MemoStatus.Lines.Add('Max Freq DO: '+FloatToStr(maxfreq)); Error:=DAQmxCreateDOChan(DOHandle,'Dev4/port0','',DAQmx_Val_ChanForAllLines); MemoStatus.Lines.Add('Create DO Chanel: status error '+IntToStr(Error)); Error:=DAQmxCfgSampClkTiming(DOHandle,'/Dev4/Ctr0InternalOutput',rate,DAQmx_Val_Rising,DAQmx_Val_AcquisitionType_FiniteSamps,nr_sample); MemoStatus.Lines.Add('Sample Clk Timing: status error '+IntToStr(Error)); Error:=DAQmxWriteDigitalU32(DOHandle,nr_sample,True,10.0,DAQmx_Val_GroupByChannel,@data[0],@writter,nil); MemoStatus.Lines.Add('Write Digital: status error '+IntToStr(Error)); Error:=DAQmxStartTask(cnt0Handle); MemoStatus.Lines.Add('Start Cnt0: status error '+IntToStr(Error)); end;
:
09-29-2010 11:31 PM
Are you using LabVIEW?