LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Angular encoder measurement using cRIO without FPGA

Hello All,

 

I am relativily new to Labview and most of my experience had previously been with their DAQ hardware, but now I am working with a NI cRIO-9073. The current software package that I have is the full development suite with the Real Time and Soft Motion modules.

 

I am attempting to create a program that will output the position and velocity of an angular encoder using the NI 9411 module. The trouble that I am having is that all of the examples that I am finding use either the DAQ Assistant, DAQmx or FPGA of which I do not have access to with my current setup.

 

I have been able to create a Digital Input channel for the angular encoder and have adjusted the Specialty mode to Quadrature but now I am at somewhat of a loss on how to process the signal further to get the output I am looking for. Since I switched the specialty mode to quadrature I now have two position channels and two matching velocity channels in the project dropdown under the N9411 module.

 

The angular encoder that I am using is an Automation Direct TRD-SH2500-VD model.

 

Any help would be greatly appreciate!

 

Thanks!

0 Kudos
Message 1 of 7
(4,263 Views)

You're trying to read like you would with a counter, correct?  The DAQ examples use the counters on the cDAQ chassis to perform the task and the cRIO creates their own counters in the FPGA module?

 

If so, you'll need that FPGA or a counter module.  The scan engine will only let you use the modules you have for I/O up to 1kHz.  I suppose you could try to write a software counter with that slow cycle rate in RT if you really wanted to

0 Kudos
Message 2 of 7
(4,249 Views)

@natasftw wrote:

You're trying to read like you would with a counter, correct?  The DAQ examples use the counters on the cDAQ chassis to perform the task and the cRIO creates their own counters in the FPGA module?

 

If so, you'll need that FPGA or a counter module.  The scan engine will only let you use the modules you have for I/O up to 1kHz.  I suppose you could try to write a software counter with that slow cycle rate in RT if you really wanted to


cRIO chasses have counters similar to cDAQ chasses, and these can be used in the same way (DAQmx tasks).  However, the number of counters is limited, so for cRIO engineers often create counter equivalent functionality for encoder measurement in the FPGA hardware.

 

You can also set the module to use the Quadrature Specailty Digital Configuration mode as Triumph_Engineer has done.  I'm not sure if this uses the chassis counters like a DAQmx task or if the 9411 module's hardware actually has counters inside itself to support this (I see that trying to configure a whole bunch of 9411's on a single chassis for quadrature and for counter inputs doesn't provide me any complaints in the LabVIEW Project Explorer...).

 

 


@Triumph_Engineer wrote:

I have been able to create a Digital Input channel for the angular encoder and have adjusted the Specialty mode to Quadrature but now I am at somewhat of a loss on how to process the signal further to get the output I am looking for. Since I switched the specialty mode to quadrature I now have two position channels and two matching velocity channels in the project dropdown under the N9411 module.


When configured to the Quadrature Specialty Digital Configuration mode, a 9411 will be used entirely for quadrature encoded signal input, and a 9411 has enough inputs for two quadrature signal sets, so you get two sets (a Position0 and Velocity0 and a Position1 and Velocity1).  Reference this connection diagram.



0 Kudos
Message 3 of 7
(4,207 Views)

Hey Triumph_Engineer,

 

From what I could tell the Automation Direct TRD-SH2500-VD is an incremental quadrature encoder, is that right? If so, you are in luck, that's exactly what the Quadrature speciality digital block is designed to handle.

 

The two position and velocity channels are there because each module can handle up to two quadrature encoders. Position is in counts and velocity is in counts / second. See https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000PAjbSAG&l=en-US for a wiring diagram and https://www.ni.com/docs/en-US/bundle/ni-compactrio-device-drivers/page/target6devicehelp/quad_rt.htm... for some help on the configuration options.

 

Does that help? Let me know if you have any further questions.

 

Sebastian

 

 

0 Kudos
Message 4 of 7
(4,199 Views)

cRIO chasses have counters similar to cDAQ chasses, and these can be used in the same way (DAQmx tasks).  However, the number of counters is limited, so for cRIO engineers often create counter equivalent functionality for encoder measurement in the FPGA hardware.

 

You can also set the module to use the Quadrature Specailty Digital Configuration mode as Triumph_Engineer has done.  I'm not sure if this uses the chassis counters like a DAQmx task or if the 9411 module's hardware actually has counters inside itself to support this (I see that trying to configure a whole bunch of 9411's on a single chassis for quadrature and for counter inputs doesn't provide me any complaints in the LabVIEW Project Explorer...).

 


Just to clear this up, specialty digital blocks are implemented on the FPGA. There are no dedicated counters in a cRIO chassis nor does the 9411 have any counters.

 

The pre-built fixed personality bitfiles have, if I recall correctly, two specialty digital blocks. For a hybid mode compile, you can have any many blocks as you want assuming there is sufficient space on the FPGA.

Message 5 of 7
(4,192 Views)

@speleato wrote:

Just to clear this up, specialty digital blocks are implemented on the FPGA. There are no dedicated counters in a cRIO chassis nor does the 9411 have any counters.

 

The pre-built fixed personality bitfiles have, if I recall correctly, two specialty digital blocks. For a hybid mode compile, you can have any many blocks as you want assuming there is sufficient space on the FPGA.


That was my mistake.  I was comparing some cDAQ and cRIO chasses recently and I mistakenly recalled that they both had chassis counters listed in their specs.

 

Thanks a lot for the explanation on Specialty Digital Configurations.



0 Kudos
Message 6 of 7
(4,188 Views)

Thank you everyone for the input!

 

Sebastian, You are correct the encoder that I am using is a quadrature. I verified that my wiring was correct for my modules and using the equation provided in the NI article https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x1riCAA&l=en-US I was able to create a functional VI that outputs the correct angular position measurement. I verified the measurement using an angular encoder fixture in the lab.

 

Now that I am able to collect the correct angular position I am having some trouble getting a velocity measurement. I attempted to perform this using two different methods. One uses the Velocity0 channel from the NI 9411. I took the counts/sec value that is outputed by the channel and converted it to degrees/sec using the equation reference previously and then converted that to radians/sec. But when I run the code and actuate the encoder the program only read a value of 0.

 

The second method that I attempted was using the equation velocity=deltaPosition/deltaTime. To do this I converted the position to radians and linked it to a shift register. I then set it up so that the current position was subtracted from the previous via the shift register. For deltaTime I set up two tick counters, one outside the while loop and one inside, linked to a shift register and then subtracted the values same as with position to get the time it took for the loop to execute. I then divided these two delta values to get the velocity and linked to a indicator. However when I executed the code I had the same issue as with the previous method where only a value of 0 was displayed.

 

I have attached a snippet of my code below for reference.

 

Not sure what could be causing the problem. Maybe the loop execution time or maybe the Velocity time base that I set for the Velocity channel (256 µs)?

 

Thanks again for the help and input!

0 Kudos
Message 7 of 7
(4,170 Views)