Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

daqmx convert ticks negative

I am using the DAQmx 8.5 with .Net to get some counts samples. I am after ticks and I think that I am getting the nubmer that I want except when my encoder moves past the zero mark. I am getting a very high positive number and I want the negative number.

Is there an easy way to do this?
I tried to find documentation saying what the offest number was, but couldnt' find this, can anyone point me in the right direction?

Using vb.net 2005

Pretty much altered the "Measure the Angular Position Buffered Count Ext Clock" example.

code something like
:
dim t as new task
t.cichannels.createangularencoderchannel("dev2/0", "", x4, false, 0, ahighbhigh, 20000, 0, ticks)
t.timing.configuresampleclock("/dev2/pfi28", 20000, rising, hardwaretimedsinglepoint)
dim cr as counterreader
me.label.text = cr.readsinglesampledouble

-----------

How do I get the neg value instead of a larg postive value?

Thanks for any help,
CM

0 Kudos
Message 1 of 3
(3,555 Views)
Hi Kaxten,

Welcome to the forums. I think you only need to read the value with a different datatype:

me.label.text = cr.EndReadMultiSampleInt32

The current way you are reading it, is with a double, and therefore values below 0 are interpreted as the terminal count of the counter which, depending on your hardware, would be 32 bits. Then you read those 32 bits as anything.

Hope this helps,


Gerardo O.
RF SW Engineering R&D
National Instruments
Message 2 of 3
(3,546 Views)
Yep, I figured that last night and ment to post it back up, but forgot until you responded. Thanks and that is exactly what worked for me.

It came together when I realized I was getting an unsigned int back.

Thanks again for the response,

CM
0 Kudos
Message 3 of 3
(3,541 Views)