From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ENcoder Index Z

Pls find attached my code,the encoder index z which is for absolute positioning is always "0"

May i know why it is always 0 and how to fix this?

0 Kudos
Message 1 of 12
(3,617 Views)

Nothing attached.

0 Kudos
Message 2 of 12
(3,616 Views)

pls check now,attached

0 Kudos
Message 3 of 12
(3,612 Views)

Still nothing.

0 Kudos
Message 4 of 12
(3,587 Views)

Its there,i just downloaded,opened.All files are there

0 Kudos
Message 5 of 12
(3,583 Views)

Okay.  I see it.  You edited the original message.  It had scrolled off the screen and I had only seen the new message saying it was attached, but it wasn't, not on that message anyway.

0 Kudos
Message 6 of 12
(3,579 Views)

It looks like the FPGA code is where all the real work is happening.

 

The only issue I see at first glance is in the timed while loop hwere you have the Encoder Index ORed with False.  In the True case, you add one to the value in the shift register.  But in the false case, you have nothing.  The tunnels are set to Use Default if Unwired. which means your Z index Position and the shift register will go back to 0 (the default for an integer.)  You probably want to have that integer wired through the False case.

 

This is the most obvious thing to me.  I haven't taken the time to figure out if all the rest of the code would function properly.

 

EDIT:  Check your False- False case in the structure above.  Youu have unother unwire use default tunnel there as well which seems like ti would also be wrong.  You have either a zero or a default value of zero going out of that tunnel into a shift register. 

0 Kudos
Message 7 of 12
(3,573 Views)

You have gone through the right part of the code.

When the index z is true i want to add 1 to the output,when false i do not wanna do anything.This is the logic i used. Also there is a LED display directly connected to the Mod 3 Index Z .I see that it is always not blinking which means the index z is always zero.That's why the OR throws 0 as ouput and the false condition alone is executed.

0 Kudos
Message 8 of 12
(3,569 Views)

Are you sure you are getting a pulse into that channel?  (Check with an o-scope.)  A z-index is only 1 pulse per rev, so it is going to off far more often than it is on.  I don't know how fast you are spinning and how quickly your host VI can get the status of your FPGA controls to be able to display them to you.  You may be getting trues in there and the update rate on the display just doesn't let you seem them.

 

You certainly need to have that wire going through otherwise you are going to be 0 nearly all the time, and your index display will only be 1 at those moments when the input is True.

 

I'm concernted about how you are just reading the digital value.  If you run really slow, then you'll have that loop run fast enough to see multiple trues before it goes false again.  (Does your code account for that?)  Try using the digital trigger that should be available on your module to have a value occur on a rising or falling edte.  I do see you have feedback nodes on the boolean wire, so maybe you are already accounting for that in FPGA code.  But you only have that on your A and B channels.  Nothing for the Z channel.  You also have a bunch of boolean logic nodes in there that never get used.  If they aren't being used, then delete them to clean up the code.)

0 Kudos
Message 9 of 12
(3,559 Views)

Thanks so much for such nice explannation.

 

All that i am trying there is,

1.Get Encoder position from Mod3/Index z

2.Count value from Phase A & B.

 

I request you,if you can correct my logic for the 2 points mentioned above as i see my present code not giving proper results.

0 Kudos
Message 10 of 12
(3,556 Views)