Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Edge counting with digitial pause trigger

Hey there,

Now you shouldn't normally get any kind of error using this, however the Clear task does actually stop the task first.  And THEN clear the task.

I would suggest taking out the stop task.

AdamB

Applications Engineering Team Leader | National Instruments | UK & Ireland
0 Kudos
Message 11 of 52
(2,668 Views)

Hi Adam,

I have tried to run the program without stop task and just having clear task, but still i m gettin same error as @ task not specified @

 

Thanks

0 Kudos
Message 12 of 52
(2,663 Views)

Sounds like you have already cleared the task previous to this part of the code.

Have you traced through to see if this is repeated more than once?

AdamB

Applications Engineering Team Leader | National Instruments | UK & Ireland
0 Kudos
Message 13 of 52
(2,662 Views)
Hi,
 
Yes I have checked it. there is no repetition. I have attched my program for your reference.
 
Thanks

Message Edited by Support on 07-16-2007 10:53 AM

0 Kudos
Message 14 of 52
(2,658 Views)
Hi Adam,
 
I have written a VB program in generating a continuous/finite pulse in counter 0  and having the output of counter 0 as trigger source and it works fine. Thanks for your help. Now I am working to implement the program functionality based on our application. I do have some questions
 
1) When I select clear task , still I get the same error.
 
2) If I am using the program and if i tried to run it again, I get an message as source/terminal reserved. So I reset the device in MAX and it is fine. Is it possible for me to reset the device in the VB program itself? So that if I am closing my program the device should clear the reserved terminals.
 
Thanks
0 Kudos
Message 15 of 52
(2,635 Views)

Hi ,

I got another problem with generation of pulse. When I have continuous samples used in the function below:

DAQmxErrChk DAQmxCfgImplicitTiming(taskHandlepulse, DAQmx_Val_AcquisitionType_ContSamps, numSampsPerChannel)

it is working fine, it generates the pulse. But when I try Finite samples it is not working properly. There is no pulse being generated.

Have attached the program for reference.

Thanks

Message Edited by Support on 07-16-2007 10:53 AM

0 Kudos
Message 16 of 52
(2,631 Views)
Hi there,
 
What you need is to change the stop button code to this.
Private Sub cmdstop_Click()
If taskIsRunning = True Then
        DAQmxErrChk DAQmxStopTask(taskHandle)
        DAQmxErrChk DAQmxClearTask(taskHandle)
        taskIsRunning = False
    End If
    cmdstart.Enabled = True
End Sub
You need to set the task is running to false at this stage to stop the code from trying to sample the counter again.
 
That should solve the problem
Thanx
 
AdamB
Applications Engineering Team Leader | National Instruments | UK & Ireland
0 Kudos
Message 17 of 52
(2,629 Views)

Hello.

Thanks a lot. That fix the problem, Still I have some problems in the program

1) I need to reset the device everytime in MAX explorer to clear the reserved space, is there anyway to reset the device when I close the application?

2) I tried to use Finite and Continuous samples , as I quoted in my previous post. I would like to use finite samples by specifying number of samples. Is there any way to work around this issue?

3) I would like to reset the counter, Can I use this function < DAQmxResetCICountEdgesDir(taskHandle As Long, channel As String) As Long > or anything to work out

 

Thanks

 

 

0 Kudos
Message 18 of 52
(2,624 Views)
Hi there,
 
Sorry you keep posting after I read the first post and start answering so I miss the second lot of questions/problems.
 
1)  If you clear off the task correctly (not using both stop and clear) you shouldn't get that problem.  If however you do still get that problem.. then you need a way to progromatically reset the device.....
DAQmx.DAQmxResetDevice(deviceName As String) will work.
 
2) in what sense is it not working?  How many samples are you planning on outputting and at what rate? Do you get any errors?
Tha finite pulse train will use 2 counters to do this.  Effectively one is set up to gate the other.  If you have set this for counter 0 then ctr1 is used to gate it.  If you set up as 1 the ctr0 is used to gate it.  And so on in pairs. 0-1,2-3,4-5 etc.  Make sure the adjacent counter is free.
 
3) The only way to do this is to stop the task and then start the task again.
 
 
AdamB
Applications Engineering Team Leader | National Instruments | UK & Ireland
0 Kudos
Message 19 of 52
(2,620 Views)

Hi there

I m sorry about lot of questions 🙂 ok. Other things are working in the program and no problem with it except pulse generation.  As I have attached my program, I have not used adjacent counters in it. I have used Counter 0 for pulse generation and counter 2 for other task. So there is no problem with the setting of counters. But when i tried to use continuous and finite samples, Continuous samples seems to work fine. But finite sample is not taking pulse generated in counter 0 as trigger source ( I hope no generation of pulse at that point).  I would like to generate finite pulse say with 1 number of sample. Could you look at my program and suggest me regarding this issue?

Thanks a lot

 

0 Kudos
Message 20 of 52
(2,613 Views)