LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a hall sensor simulator using NI USB-6221

Solved!
Go to solution

Hello.

 

I'm trying to create a hall sensor simulator using the NI USB-6221.

The idea is to have three digital outputs that outputs a digital pulse train according to six different steps.

See the table below.

 

Capture.PNG

 

And it's interesting to have this working at e.g. 5000 RPM's (meaning 2 milliseconds between each step).

My question is, is this even possible with the NI USB-6221?

 

I tried creating a simple state machine, driving the outputs according to a predefined table.  But it became evident that this is much too slow.  The NI USB-6221 uses around 10-15 ms to output a digital value from LabVIEW.

 

Thanks for any ideas on how to do this.

 

0 Kudos
Message 1 of 5
(3,086 Views)

Hi ojohnsen,

 

yes, that should be possible.

The 6221 supports two AO, two DO and 8 PFI pins, all capable of outputting waveforms (AO, DO) or timed pulses (PFI)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(3,077 Views)

Hi GerdW.

 

Thanks for your answer.  Can you give some hints on how you would go about doing this then?

Since it has only two counters, I cannot set three generated output signals with 120 degree phase shift.

Are you thinking about creating pulse sequences on three outputs, and looping these?

 

BR,

Øystein.

0 Kudos
Message 3 of 5
(3,066 Views)
Solution
Accepted by topic author ojohnsen79

Looking at the data sheet.

 

http://sine.ni.com/ds/app/doc/p/id/ds-10/lang/en

 

Under Digital I/O you can see that the maximum clock rate of the digital lines on Port 0 is 1MHz.  This means you can go from a high to a low once every 1 micro second.  Your hardware is capable.

 

The software side of things you need to realize that to change the digital line from a high to a low that quick you will need to be using some kind of timing that doesn't involve Windows.  Windows (and other operating systems) aren't deterministic.  So instead of being in a loop changing from one state to the other, put in the buffer of the DAQ card a series of digital states, and then tell the DAQ hardware to play them at a specified rate.  Then your timing is done by the hardware, not by your software.

 

Search the example finder for Digital - Continuous Output for an example on how to do this.

Message 4 of 5
(3,029 Views)

Hi Hooovahh.

Thanks for your answer.  I found a solution, and you are right, the solution actually was exactly as you suggest.

First setting up a continous counter task to a certain output pin, and then setting up a second task outputting a buffered pattern using the first counter task as hardware timing.

It's then possible to change the "RPM's" of the simulated hall sensor pattern just by real-time changing the frequency of the hardware timing.

0 Kudos
Message 5 of 5
(3,011 Views)