arjun

Streaming Two Quadrature Encoders On A Lj U6

Recommended Posts

Hi,

I'm trying to understand how to get the MSW for two quadrature channels streamed into a U6. I have done this for a single quadrature encoder and there are no issues.

Two quadrature inputs need 4 timers to be used, so I've set up four Timers 0 thru 3 in Mode 8 ( quadrature).

So far so good.

The LSW of the quadrature count is then read from the special stream channels 200 (Timer0) and 202 (Timer2) .

I have created channels with a timing of 0 in the DF channel table.

The confusion begins when one needs to read the MSW of Timer0 and Timer2

The MSW is available in the special Channel No 224 ( TC_Capture), which has to be read after the LSW.

So, for a single quadrature counter, the stream channel list would be (200,224), and data from these "registers" would be stuffed ino the DF channels with the corresponding channel nos.

The channel table then looks like this:( and works if you want to stream a sigle quadrature encoder)

Name Device Device Number I/O Type Channel Timing

ChA1 LabJack 0 A to D 200 0

ChA2 LabJack 0 A to D 224 0

One then can obtaine signed 32bit 2's complement using the data from ChA1 and ChA2.

However, when we need to stream two quadrature encoders, the stream list would be (200,224,202,224) and set by these statements:

AddRequest(ID, LJ_ioADD_STREAM_CHANNEL, 200, 0, 0, 0)

AddRequest(ID, LJ_ioADD_STREAM_CHANNEL, 224, 0, 0, 0)

AddRequest(ID, LJ_ioADD_STREAM_CHANNEL, 202, 0, 0, 0)

AddRequest(ID, LJ_ioADD_STREAM_CHANNEL, 224, 0, 0, 0)

How then do I read ( and distinguish between ) the MSW corresponsing to Timer0 and Timer2? What DF "Channel" do I assign to the TC_Capture of Timer2?

Any help will be much appreciated!

Regards

Arjun

Share this post


Link to post
Share on other sites

Hi,

I'm trying to understand how to get the MSW for two quadrature channels streamed into a U6. I have done this for a single quadrature encoder and there are no issues.

Two quadrature inputs need 4 timers to be used, so I've set up four Timers 0 thru 3 in Mode 8 ( quadrature).

So far so good.

The LSW of the quadrature count is then read from the special stream channels 200 (Timer0) and 202 (Timer2) .

I have created channels with a timing of 0 in the DF channel table.

The confusion begins when one needs to read the MSW of Timer0 and Timer2

The MSW is available in the special Channel No 224 ( TC_Capture), which has to be read after the LSW.

So, for a single quadrature counter, the stream channel list would be (200,224), and data from these "registers" would be stuffed ino the DF channels with the corresponding channel nos.

The channel table then looks like this:( and works if you want to stream a sigle quadrature encoder)

Name Device Device Number I/O Type Channel Timing

ChA1 LabJack 0 A to D 200 0

ChA2 LabJack 0 A to D 224 0

One then can obtaine signed 32bit 2's complement using the data from ChA1 and ChA2.

However, when we need to stream two quadrature encoders, the stream list would be (200,224,202,224) and set by these statements:

AddRequest(ID, LJ_ioADD_STREAM_CHANNEL, 200, 0, 0, 0)

AddRequest(ID, LJ_ioADD_STREAM_CHANNEL, 224, 0, 0, 0)

AddRequest(ID, LJ_ioADD_STREAM_CHANNEL, 202, 0, 0, 0)

AddRequest(ID, LJ_ioADD_STREAM_CHANNEL, 224, 0, 0, 0)

How then do I read ( and distinguish between ) the MSW corresponsing to Timer0 and Timer2? What DF "Channel" do I assign to the TC_Capture of Timer2?

Any help will be much appreciated!

Regards

Arjun

To resolve this issue, DAQFactory provides some special channels which can be used to request the MSBs. If you look at section 9.2.3 of the DF_LJ_AppGuide.pdf it explains this fully, but basically you would do:

AddRequest(0, LJ_ioADD_STREAM_CHANNEL, 200, 0, 0, 0)

AddRequest(0, LJ_ioADD_STREAM_CHANNEL, 224, 0, 0, 0)

AddRequest(0, LJ_ioADD_STREAM_CHANNEL, 202, 0, 0, 0)

AddRequest(0, LJ_ioADD_STREAM_CHANNEL, 226, 0, 0, 0)

Which then gives you a way to access the MSB from Timer2.

Share this post


Link to post
Share on other sites

You are correct, Sec. 9.2.3.of the DF_Labjack User Guide does indeed refer to this.

Your prompt help is much appreciated, and is one of the primary positive reasons for using Labjacks and DF!

Arjun

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now