Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom scale with Create Channel CI Position Angular Encoder

Hi!

In my application I use angular encoders for position measurement. I programatically create channel (task) using DAQmx Create Virtual Channel, CI Angular Encoder instance. Prior to that I use DAQmx Create Scale to create custom scale for the measurement, to convert from degrees directly to meters. The problem is that when I use the task (Start Task for instance) I get the following error message:

Error -200378 occurred at DAQmx Start Task.vi:4

Possible reason(s):

Measurements: Custom scale specified does not exist.

Custom Scale: RowCounter

Task Name: _unnamedTask<66>

Maybe somebody can help me out with this one.
I use the same principle to create custom scales for AI measurements, and everything works without any problems. I know the scale is created properly, as I tried saving the custom scale to max after I create it. I then used the scale without a problem when I wired it as a constant to the custom scale input of the DAQmx Create Virtual Channel vi. It only gives me problems when I create it dynamically, using Create Scale vi.

Some technical info: I use USB-6210 Daq card for signal acquisition.

I will appreaciate any help!

Jernej

0 Kudos
Message 1 of 9
(6,262 Views)
 

I was also in the process of creating also a conversion, here is a link to the place that talks about how to make that conversion, I hope that it helps http://digital.ni.com/public.nsf/websearch/022EF0C2D86CD7F28625704C007B1E5D?OpenDocument 

0 Kudos
Message 2 of 9
(6,240 Views)

Oops, I meant scale not conversion....sorry first time posting

 

0 Kudos
Message 3 of 9
(6,239 Views)
Hi,

Can you attach a simplified version of your code, where I can replicate the error code.
Jaime Hoffiz
National Instruments
Product Expert
0 Kudos
Message 4 of 9
(6,226 Views)
Hi!

First, thank you all for the replies. I did a work around for the problem in my application by saving the scale in the program and then using the saved scale. This worked well, though the code became a bit messy because of that. After your replies I tried to make a simplified version of the code, to show where the problem was, and the thing worked fine. I went back to my code and I noticed I used a numeric value  as the input to the pre-scaled units  input of the  CreateScale.vi. The number I used was equivalent to the one specified in help (Degrees (10146)), but it looks like the numeric representation I used was not correct (thoug I used one of the integers, but I changed it already so I dont know exactly if it was I32 or something else). I changed the code such that the input is now the default ring constant and everything works fine.

I am still confused why the code worked when I first saved the scale and used the same scale later......

Kind regards
Jernej
0 Kudos
Message 5 of 9
(6,210 Views)
I am back again.... It looks like I jumped to conclusion to fast. As I said, I made some changes and my program started working. Then I turned the program and labview environment, and when I tried running it again, it stopped working. Bellow I attach the simplified version of my code. Maybe someone can check it out ...

Jernej
0 Kudos
Message 6 of 9
(6,208 Views)

Hi Jernej,

Very good programming, the code is organize like it should. Looking at the code like it is I don’t see any problems and it should run with now problems. Just make sure that you intention is to use the arm start trigger of the counter.: “When you configure an Arm Start Trigger, a counter task does not respond to any Start Triggers until after the Arm Start Trigger occurs. You can configure this trigger to occur on a digital edge. The Arm Start Trigger is separate from a Start Trigger and is typically used in advanced counter/timer applications. You might use an Arm Start Trigger to synchronize multiple tasks, such as counting edges and pulse generation. The Start Trigger then would be used to start the acquisition or generation.”

What DAQ card do you have?  What is the error message that you get? Where does the code stops? print-screens, error code numbers, chronology of events before the code stops are very useful debugging tips.

Jaime Hoffiz
National Instruments
Product Expert
0 Kudos
Message 7 of 9
(6,202 Views)
Hey!

The error message I get is as follows:

Error -200378 occurred at DAQmx Start Task.vi:4

Possible reason(s):

Measurements: Custom scale specified does not exist.

Custom Scale: RowCounter

Task Name: _unnamedTask<66>

I use
USB-6210 Daq card for signal acquisition. The error occurs right after the DAQmx Start Task.vi on the counter task.
As I said, the code runs sometimes without problems and then sometimes it returns an error. I noticed that if I run the CustomScaleProblem.vi on its own it runs ok. When I open the project with mine application, from where I extracted
CustomScaleProblem.vi part, and then try to run the CustomScaleProblem.vi, it stops working. It looks like when I open the project it allocates some space which is in conflict with the scale part of the code. Then if I close the Labview environment and open CustomScaleProblem.vi and run it, it runs again without any problem. Well, for now I did a work around the problem by saving the scale in the program and then using it. This approach works fine.

About the arm start trigger. I use it because I dont want the counter to start counting before the AI task starts. I noticed that if I use the AI as a start trigger, and I move the encoder before AI starts, the counter will not start with 0, but will start with a number indicating the encoder movement before the AI start. Is that the right approach if I want the encoder to start
counting from 0 when AI starts?

Thanks and kind regards

Jernej



0 Kudos
Message 8 of 9
(6,187 Views)
 

Hi Jernej,

I ran the code in my computer with a 6251 and it ran OK, I think you hit the nail in the head, as a suggestion you can create the scale in the project window, by right-clicking: my computer-DAQmx Scale, after the scale is done, you can drag and dropped on the block diagram, and wire the “purple box” (DAQmx Scale Name) to the input on the DAQmx create channel.vi.

Your approach sound correct, but instead of digging into your code, I would point you to some examples that synch counters and analog inputs hopefully one will help. NI-DAQmx: Retriggerable AI Using Counter and an Analog Trigger, NI-DAQmx: Creating an Analog Input Task with Multiple Measurement Types in LabVIEW, DAQmx - Retriggerable AI Using Retriggerable Counter. Remember that these examples are not specific to your problem but the best way of learning is to practice.

 
Jaime Hoffiz
National Instruments
Product Expert
0 Kudos
Message 9 of 9
(6,180 Views)