LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate pulse and measure angular position simultaneously?

Hello friends,
 
  I do controlling of stepper motor through NI USB 6229 device. For that I generate pulses and analog outputs and it works properly. But in my experiment i need to add some measurement devices also like rotary encoder, force transducer etc.,. I make a flat sequence loop in a for loop for controlling the stepper, and i add rotary encoder input outside the flat sequence loop. While ruuning the program it shows an error" The device is reserved"
 
 
What is the problem? How to overcome that problem?
 
Thanks and regards,
Kirupasankar S,
India.
0 Kudos
Message 1 of 8
(5,733 Views)
Hello Kirupasankar,

Is there an error code that is attached with the error message?

Causes of NI-DAQmx Error 50103 "The Specified Resource is Reserved"

Please take a look at this KnowledgeBase, is this the error that you are getting?

It is unclear what you are doing in the code and were you are doing the read/write function. With the USB-6229, there is only one ADC on the board so you are only able to run one analog input task at a time, where it will multiplex through the different channels.

Send me more information on the code and what you are trying to do, in terms of the tasks you have created in your code.


Regards,
  Sandra T.

Applications Engineer | National Instruments
0 Kudos
Message 2 of 8
(5,716 Views)
hello Sandra,
 
Thanks for ur guidance. I try to control the stepper motor in terms of pulses and its direction by sending analog voltage. My setup has some other instuments like angular encoder, temperature sensor, foce transducer etc., . The instuments datas must be read continuously and pulses and analog send by some calculated values. Doing that operation in USB 6229, first i do control the stepper as i wish. While come across data aquisition of angular encoder the above problem i faced.
 
           I attach the whole folder that I work. I connect the pulse output at PFI 12,and its ground, encoder input to {A-phase - PFI3, B phase PFI11, Z phase- PFI4), and analog output to AO 0 and its ground.
 
How do to simultaneously aquaire data from encoder and send pulses? Please Help Me!!
0 Kudos
Message 3 of 8
(5,701 Views)
Hello Kirupasankar S,

It can be difficult to determine what parts of your code you are having problems with when you post a large folder with many projects and VIs in it. That being said, I am assuming that you were referring to Voltage.vi as your main program. Is that correct?

I would recommend a couple things at this point. First, I would suggest that you consider the state machine architecture for your program. This topic is discussed in more detail in this document, but basically it allows you to use LabVIEW to implement a state diagram through the use of Case structures and a While loop. This model is especially effective when you have a set sequence of steps that you would like to continuously execute (like the stepper motor). Looking at your code, you could pretty easily replace your Sequence structure with a Case structure where you determine the next case (or state) from the current case, the user inputs and the data acquired from the hardware. There are several demonstrations of state machines in the examples that come with LabVIEW, including one called "State Machine Test Sequencer.vi" which you may find useful. You can find these examples in the NI Example Finder, which you can open by clicking on Help and selecting Find Examples... Once you have the example finder open, you can use the "Search" tab to find examples on a variety of topics.

Now, in regards to your question about position measurement and pulse train generation, I have posted a VI that should help you troubleshoot this application. This VI is shown in the image below and is attached as source code. It is a combination of three example programs. These three programs perform an angular position measurement, a pulse train generation and an analog waveform generation (from top to bottom in the image). I just cut and pasted the examples together into one program and ran that. It worked on my M Series Multifunction DAQ device and it should work on your USB-6229 as well. This example program will help determine if your hardware is working correctly and should give you a good building block for your entire application. Let me know if you have any questions.


Message Edited by Matt A on 04-17-2007 12:13 AM


Matt Anderson

Hardware Services Marketing Manager
National Instruments
0 Kudos
Message 4 of 8
(5,678 Views)

Hello Matt A.,

  Thanks for your guidance. I need to generate the Finite Number of Pulses, But the VI generates the Continuous Pulses. While Change to Finite generation, the same Error 50103 "The Specified Device was Reserved" was shown by Labview. I read from online help and i am unable to solve the problem. Please give a guidance.

 

Thanks and regards,

Kirupasankar S

0 Kudos
Message 5 of 8
(5,665 Views)
Hello Kirupasankar S,

I have modified the code to create a finite pulse train and posted it with this modification. Once again, all I did was cut and paste example programs together to utilize their functionality. This example is simply a combination of the examples called Measure Angular Position.vi, Gen Dig Pulse Train-Finite.vi and Cont Gen Voltage Wfm-Int Clk.vi. I would strongly recommend that you browse the NI Example Finder to become familiar with the programming structure of NI-DAQmx and the general methodology for performing DAQ.

The program I posted, as shown in the image below, does three things. First, it generates a finite digital pulse train. Then, in parallel it generates an analog voltage waveform and measures angular position using a counter. The notes in the Block Diagram should still be applicable, as I have coped them from the shipping examples as well. I have tested this code on my PCI-6251 M Series device and it runs without error. However, you are receiving the error because you are attempting to perform a finite pulse train generation in parallel with your angular position measurement. As discussed in this KnowledgeBase, the finite pulse train generation requires two counters since one acts as the gate for the other. Therefore, ctr0 and ctr1 are in use in the finite pulse train generation when you attempt to access ctr1 for the angular position measurement. You cannot simultaneously perform a finite pulse train generation and an angular position measurement (or any other counter operation) because the NI USB-6229 only has 2 counters. Both of these counters are used for the finite pulse train generation.

However, you can perform your finite pulse train generation, then clear that DAQmx task and perform other counter operations. That is what I have done in the example code and that is why it does not produce an error. Let me know if you have any questions about this example.


Message Edited by Matt A on 04-18-2007 11:04 AM


Matt Anderson

Hardware Services Marketing Manager
National Instruments
0 Kudos
Message 6 of 8
(5,654 Views)
Hello Matt,
 
 
Thanks for your Guidance. I am understand the VI . But I am not complete the full program. After Completing the program I send VI for checking.
Thanks a lot.
 
 
Regards,
Kirupasankar S
0 Kudos
Message 7 of 8
(5,594 Views)

HI

I have:

PCI 6251M to acquire data

PCI 1427 (to acquire image with camera uniq UF1000)

Labview 8.00

Frame grabber BNC 2090

High power BI-Phase Current Simulator to generate external trigger. (ASI 701B)

 

In my program i need to do different things in the same time:

1)i need to reshape signal from simulator (I use lv_retirg-pulse-gen0.vi for do it ). Signal from ASI 701B is connected with pin PFI0 (input). And counter is setted on pin Counter0.

2)Read spikes from simulator and acquire data (channel's spike  (ai0 is connected with output Counter 0))

3) Acquire images  with my camera. Camera is connected to pin counter 1 and it need to start when spikes are generated.

 

I found different problem:

a)I have error 50103 on Daqmx StartTask.vi in camera line

b) if i try to resolve problem with error 50103 or camera doesn't stast but i have reshape and i can read spike

                                                                        or camera starts but i cannot have reshape and i cant' read spike

                                                                        or camera starts when reshape and reading spike stopped (this option it's not  considerable because i need to do those operations in the same time)

 

Moreover i try to introduce in camera line daqmx_trigger to set trigger for start camera, using same source of counter0 (PFI0), so that camera starts when spike begin, but doesn't do what i need.

 

 

 

 

 

I hope  you can understand what i'd like to do.

Thank for your attention

Mariangela

0 Kudos
Message 8 of 8
(5,160 Views)