06-08-2011 01:13 AM
Hi,
I am currently using NI 9411 to measure the position(counts) of an encoder using FPGA programming. I have attached a vi of which I managed to get a digital waveform however, when I turn the encoder clockwise, it seems that the counts seems incorrect as my encoder is 2000 per revolution which means it can count up to 2000 but it gone beyond 2000. May I know whats the problem and regarding the reading of waveform, it seems weird. Can anyone help me with this??
06-09-2011 06:36 AM
Hi Afai,
Please post only once. We will reply you as soon as possible.
You mentioned that your encoder is 2000 count/rev, which means 1 revolution or 360 degrees are actually 2000 counts. If you have more than 2000 count, it means it has rotated more than 360 degrees right?
Sincerely,
Krisna
06-09-2011 07:59 PM
Hi Krisna,
So sorry that i posted 2 times. Yup, more than 2000 means more than 360 degree. Do you know a way in which I could make this correct as in the maximum count i could go up to is 2000?
06-09-2011 10:39 PM - edited 06-09-2011 10:40 PM
hi afai,
I am not sure why you want to do that, but I guess you can use quotient & remainder to do that, the example below is limiting number up to 5 only:
06-09-2011 10:54 PM
I am currently programming it using FPGA
06-09-2011 10:59 PM
I am so sorry i am not sure what you are trying to tell me. I need to do that because when i convert the counts, it go to way beyond 360 degree. Do you know how to convert the counts to degree?
06-10-2011 01:45 AM
Hi Afai,
My previous reply was centered to answer this question:
"Do you know a way in which I could make this correct as in the maximum count i could go up to is 2000?"
--> above code should work in FPGA, the algorithm to make it count only to a maximum number (in the example i put 5)
Do you know how to convert the counts to degree?
--> its easy, your encoder spec said that, 2000 counts per rev.Which 1 rev is 360 degrees, simple math should give you: 2000/360 = 5.55 degrees in each count.
06-10-2011 02:06 AM
Hi krisna,
Thanks for your reply and making me understand. But do you know how can i implement the algorithm you gave it to me as in where should i modify it? Thanks
06-10-2011 07:22 AM
Hi Afai,
You should try the example that I attached previously. You can implement the same algo in FPGA as well, just replace constant 5 with 2000 and you are good to go. Divide by 360 if you want to convert it to degree.