LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

angular position counter invert z index

Hi all,

 

thanks for your support in advance. Using labview 2013

 

My question: I want to determine the angular position of a machine with a incremental encoder and I use the VI which you get over here: http://www.ni.com/example/26721/en/.

I added the correct channels corresponding to my hardware with a property node (see picture).

 

My problem:

the channel with the Z index (light barrier) for zeroing. It sends zero when inactive (so most of the time) and -1 when active (light barrier passed).

So when I enable zeroing everytime the Z index phase is active ("a high b high" for example) the counter is zeroing. The counter seems to see the zero as the sign for active light barrier. But it is the -1.

What can I do?

On the hardware side: Change something with the wiring?

Or easier on the software side: I tried to find a way to invert the z index channel before starting the measurement. But i found no way to do this.

 

Thank you all.

 

Greetz

 

 

 

0 Kudos
Message 1 of 10
(3,827 Views)

I had a boss once who wired up the Z index of an encoder backwards and had the counter reseting for most of the revolution. The numerically controlled lathe was not happy about that.

 

1. When you say the output is 0 or -1, exactly what does that mean? Most encoders either generate logic level signals, typically 0 volts and +5 volts, or a 0 to +12 or 0 to +24 V signal. 

2. The counter inputs on NI DAQ devices typically expect 5 V logic signals and will not function correctly or may be damaged by negative voltages.

3. What is the manufacturer and model of your encoder? Can you post a data sheet?

4. What DAQ hardware are you using?

 

Once you have verified that the encoder output voltages are compatible with your counter, then you can work on getting the logic working. 

 

There are too many unknowns for anyone to start suggesting specific solutions.

 

Lynn

0 Kudos
Message 2 of 10
(3,760 Views)

Are 0 and -1 Voltages (i.e. 0v and -1v) or logic levels (i.e. 0 = True, -1 = False, or possibly 0 = False, -1 = True)?  If they are logic levels, you may just need a "logical inverter", i.e. a "Not" gate.

 

BS

0 Kudos
Message 3 of 10
(3,754 Views)

Thanks for the answers.

 

1. The outputs of the DAQmx-read function (Digital signal 1 channel 1 sample) is zero most of the time and -1 when passing the light barrier not the voltages. Sorry for being inaccurate.

When I use the DAQmx-read function with Digital Bool (at the zeroing channel), a display element (LED) is turned on most of the time and turned out when passing the light barrier. This explains the problem with continually zeroing.

2. Since I had nothing to do with the hardware wiring, I will check the wiring together with our electrician.

3. The encoder is the model IH740 from global encoder (IH 740 250R33-00300). The link to the data sheet: http://www.globalencoder.com/xist4c/download/web/IH740_uplId_2013__coId_1618_.pdf (couldnt attach it here. It said: "The contents of the attachment doesn't match its file type.")

4. DAQ Hardware is NI9421

 

The hint with the "Not" gate is good. But I dont know where to wire it to in the given program. I think I would have to change the DAQmx-read function itself then.

 

I will let you know, when we checked the wiring.

Thanks.

 

 

0 Kudos
Message 4 of 10
(3,719 Views)

Some things still are confusing me.

 

1. Where do you get a -1 as an output? DAQmx Read.vi can return a boolean, array of booleans, unsigned integers or digital waveforms. None of those produces -1.

2. What is the power supply voltage to the encoder?

3. How do you have the power supply, encoder and NI 9421 connected, including all power and ground connections?

4. The specifications of the enocder seem to be somewhat contradictory.  One place is says RS-422A and another place it says Logic Level (high) = Vcc - 0.7 V where Vcc can be 4.75 to 30 V.  Wikipedia says RS-422 has 0 to 5 V output and maximum levels (differential) of +/-6 V. The version of the encoder you have appears to not have the complimentary outputs so it cannot be differential.

5. The signal at the input of the 9421 must go above 11 V to be interpreted as High. This means that you must have a power supply of at least 11.7 V for the encoder.

6. I think Bob Schor was referring to a hardware inverter placed between the encoder and the 9421. The kind of device required will depend on the encoder voltages.

 

Lynn

0 Kudos
Message 5 of 10
(3,697 Views)

To make things clear I added some things to the program which I posted above and added it here again.

 

The channel which the counter uses as zeroing channel is zero most of the time (in the diagramm) and -1 when passing the light barrier. I am not sure if the "digital to analog" VI is causing the -1. But the actual problem is that the light barrier is seen as active when it is not active (called zero-high behavior?). This fact can be seen when I use the Read function with digital bool.

Therefore the counter zeroes all of the time (except for when passing the actual reflector of the light barrier).

 

To fix this I talked with our electrician.

We made sure that the voltage which is coming from the encoder is 24V. So like you also said.

To invert the signal of the barrier he will add a hardware element which works as kind of "NOT" gate.

I will report if it works then.

 

 

 

0 Kudos
Message 6 of 10
(3,682 Views)

I think the Digital to Analog is creating the -1. The default settings favor that. I had a digital waveform test VI for another project and I modified it to simulate your conditions. To get 0 - 24 V output I had to change some of the defaults as shown below.

 

D to A.png

 

I do not fully understand why the full scale range input needs to be twice the actual voltage but it works that way. The graphs below show the analog waveform in Generated Signal and the result of making a digital waveform from a boolean array ane then using the Digital to Analog code shown above.

 

It certainly looks like your light barrier is generating True most of the time.

 

I do not have DAQmx so I cannot look at the availalble properties. Does a CI.Encoder property exist to tell the device to invert the polarity of the Z channel? If such a property exists, you may not need the external inverter (NOT gate).

 

Lynn

 

Digital signals.png

Message 7 of 10
(3,665 Views)

Thanks johnsold. You were right with the settings for the "digital to analog"-VI.

With changing the data type and fitting the data range the diagramm shows a one now (corresponding to true).

 

Still the main problem with the light barrier sending true leading to constant zeroing is not solved with this, right.

I already looked for a property node to invert the signal from the z channel. Since I couldn't find an option I was posting my problem here.

I think the only way will be to add the hardware "NOT" gate if I want to use the given DAQmx-read-counter function.

Otherwise I would have to program my own function which does this. This is possible of course. But wiring the "NOT" gate should be less effort and more failure safe.

 

I will report if it works or if other options appear.

 

Thank you for your effort.

 

0 Kudos
Message 8 of 10
(3,659 Views)

I agree that an external NOT gate sounds like the simplest option.

 

Lynn

0 Kudos
Message 9 of 10
(3,654 Views)

Hi all,

 

the not gate for the Z channel of my incremental encoder is wired now and it works: It sends active when the reflector of the light barrier is passed.

Therefore I can use a function based on the example I have spoken of in my first post (http://www.ni.com/example/26721/en/.).

 

A small hint for everyone who wants to work with incremental encoders:

For my demands the example above was not fast enough with DAQmx-read with only 1sample per loop. Since this would result in a magnitude of 20Hz since one loop lasts about 5ms at my used PC.

Therefore I had to use the read function with "Counter 1D DBL NSamples".

But when i wanted to do this I had to give the "DAQmx-timing-VI" a source for the sample rate. With a bit of research I got rid of this problem by using the internaloutput of a secound counter. This was inspired by  the example in "Figure 3" in the white paper http://www.ni.com/white-paper/4322/en/ .

To be able to select the InternalOutput-channel of my secound counter I had to follow this procedure: http://digital.ni.com/public.nsf/allkb/414C26FC95E8F37E862575A800672062 otherwise the I/O option name keeps missing.

A simplification of the result can be seen below.Counter DAQmx NSamples InternalOutput.PNG

 

Good luck and thanks again for the help. Any improvements are welcome.

 

0 Kudos
Message 10 of 10
(3,516 Views)