LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Use absolute encoder to get positioning

Hi all friends, 

i am relatively new in labview, and sorry in advance if i ask something very silly. 

 i am writing this to seek help for absolute encoder data acquisition. 

The DAQ set i am using is NI USB-6218 BNC which has 8 digital inputs. 

The absolute am using is ACE 128, data sheet is http://www.bourns.com/pdfs/ace.pdf

I am connecting the 8 output pins of the encoder to the 8 digital input pin P0.0-0.8 

and then i am using  DAQ Assitant 8 times he input and then convert it to decimal numbers and save it to a text file. 

 

attached is what i have. 

 

it seems that it works well, but however when i look through the text file, i found that there are a lot of errors in the decimal numbers. 

 

can anybody help me to figure out why it happens??

 

Thank you very much 

0 Kudos
Message 1 of 17
(3,380 Views)

The problem I see is that you are essentially sampling each channel at different times. Differential encoders work by sampling ALL of the channels at the SAME time.

 

What you you are doing now is sampling each channel one after the next. If your encoder position changes at all in the middle of that sampling stream, you will get errors.

 

Try changing your code so that you are sampling the entire port at once instead of individual channels. 

0 Kudos
Message 2 of 17
(3,356 Views)

Hi BFeigum, 

 Thank you very much for your reply. 

So you mean that the DAQ assistant works in such a way that it reads value one after another? Therefore the reading of the 8 digital input is not done at the same time. 

 can this problem be solved by using one DAQ assistant instead of 8? But if that, how can i split the readings and convert to the decimal numbers?

 Thanks in advance and hope to hear from you! 

 

Best regards, 

Melvin 

 

0 Kudos
Message 3 of 17
(3,336 Views)

Boolean Array to Number in the Boolean palette.

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

0 Kudos
Message 4 of 17
(3,333 Views)

Thank you for the recommendation!  I am going to  go through  them soon!  

 

Best Regards,

Melvin  

0 Kudos
Message 5 of 17
(3,330 Views)

Hi, 

 sorry for bother you again. 

I have changed the program a bit. instead of using 8 DAQ Assistant, i just use one DAQ Assistant to get all 8 digital input, and then i use the bollean Array to number function and output it.

 However, there are still a lot of errors in the output file. 

if you compare http://www.bourns.com/pdfs/ace.pdf with  the attached output file 123.lvm 

i hv attached the vi also. 

can suggest why it happens?

 

 

Thank you very much ! 

 

Best regards, 

Melvin 

0 Kudos
Message 6 of 17
(3,312 Views)

sorry, see attached 

0 Kudos
Message 7 of 17
(3,311 Views)

I still see 8 DAQ assistants in your VI, not 1.

 

I don't see where you used boolean array to number.

 

Your text file looks just fine.  It has lots of numbers in it.  I don't see any errors.

 

So what are the errors that you claim to be getting?

0 Kudos
Message 8 of 17
(3,300 Views)

@melvinfeng wrote:

Hi all friends, 

i am relatively new in labview, and sorry in advance if i ask something very silly. 

 i am writing this to seek help for absolute encoder data acquisition. 

The DAQ set i am using is NI USB-6218 BNC which has 8 digital inputs. 

The absolute am using is ACE 128, data sheet is http://www.bourns.com/pdfs/ace.pdf

I am connecting the 8 output pins of the encoder to the 8 digital input pin P0.0-0.8 

and then i am using  DAQ Assitant 8 times he input and then convert it to decimal numbers and save it to a text file. 

 

attached is what i have. 

 

it seems that it works well, but however when i look through the text file, i found that there are a lot of errors in the decimal numbers. 

 

can anybody help me to figure out why it happens??

 

Thank you very much 


im confused when you say...."I am connecting the 8 output pins of the encoder to the 8 digital input pin P0.0-0.8", thats not truly a correct statement?

 

8 inputs is a port( line0:7)....

 Digital - SW-Timed Input.png

 

look for the example in the \examples\DAQmx\Digital Input\Digital - SW-Timed Input.vi (change the example data format to decimal output)

and i dont know if you want to write the data continuous or only when changed to the file?

0 Kudos
Message 9 of 17
(3,294 Views)

According to page 2 of the data sheet, the output is Gray coded.

I do not see a Gray to binary conversion in your VI. Is this what you expect?

0 Kudos
Message 10 of 17
(3,266 Views)