Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

Quadrature encoder programming using DDK or DAQmx base

First - setG0_MSeries_Index_Enable is the correct name for bit 4.  I was looking at some older documentation that call the same bit _Index_Mode,

Second - I'm guessing that you need to adjust the G0_MSeries_Index_Phase value.  This Z index behavior of your encoder will vary depending on type.  There is a good description in the M Series Help file.  For the encoder I am using I set the Index_Phase to 0 for A low, B low.  All of your other settings (from your 17Oct post) look good.  Those are the only three changes I made to my LabVIEW program.  Other than that, it could be signal connections (just need A, Z, and B):

 Counter/Timer Signal   Default Connector 0 Pin Number (Name)* 
CTR 0 SRC 37 (PFI 😎
CTR 0 GATE 3 (PFI 9)
CTR 0 AUX 45 (PFI 10)
CTR 0 OUT 2 (PFI 12)
CTR 0 A 37 (PFI 😎
CTR 0 Z 3 (PFI 9)
CTR 0 B 45 (PFI 10)


 

0 Kudos
Message 11 of 14
(6,626 Views)
Ok my mistake!

I did not look carefully enough at my Z pulse. In fact the Z index is active low! That explains my previous founding of allways having CTR0 to reset when the Z channel was enable. It was the correct behavior since the Z channel was always high!

It doesn't look like I can select the Z channel polarity by software, right ?

I'll add NAND gate on my print to fix this 🙂

Thanks Malcolm

Chris
0 Kudos
Message 12 of 14
(6,621 Views)
The provided hack does not work as is for DAQmx base 2.1 (and probably 2.0)

You have to modify the "MSeries.Global.vi" manually to
add the "MSeries.Typedef.CTRTaskABZ.ctl" to the "MSeries.Typedef.CTRTask.ctl"

Also you have to also modify the "MSeries.CTR.Preread.vi" as follow:
change the case "CountEdges" into "CountEdges", "Position"

that's should be it

Lets hope that NI will kindly add this modification to the next release of DAQmx base 🙂

Chris
0 Kudos
Message 13 of 14
(6,311 Views)
Can anybody help me with programming M-series DAQ board for quadrature encoder ?
I have PCI-6259 DAQ device and I'm writing programm under QNX6 operating system.
The only more or less suitable example I found in nimseries DDK, is
"Count pulses from an external source using an external signal to control
the count direction" (nimseries\Examples\gpctex2.cpp).
But this example is not working correctly with Quadrature Encoders
(encoders with  two shifted on 90 degrees phases A&B).
i.e. in case of using this example code I get some extra count while encoder is on vibrant motor
What initalization procedure I need to work with Quadrature Encoders?
(something like "simpleEventCountConfigGPCT0 (...)" function in
gpctex2.cpp)
0 Kudos
Message 14 of 14
(6,073 Views)