Showing results for 
Search instead for 
Did you mean: 

How to have Latching effect for DIO Module of cFP

Hi All,
  Am a newbie to LabVIEW, on this project which already dragged on for more than 3 months since my labVIEW parts arrived.
  I need to get the speed of my encoder, but due to budget, I can only afford a DIO card. It was recommended to use cFP by the nice NI staff, which was more expensive than if i used a PCI card, hence I cannot afford an additional counter Module for cFP to get around this problem.
  What I need is for the DIO to read a point on my encoder, hence it will go ON-OFF-ON-OFF depending on the speed of my conveyor. However, the problem is that cFP does not accept Latching, hence, in this program, when my boonlean ONs, the increment counter will keep adding 1 for the period of while loop. This results that although my DI point only blinks once, the increment counter may increment to 20, 30 + counts.
 How do I effect a latching effect on the DIO or that it blinks once, the increment counter only add 1 instead of depending on the while loop?
  I need help for that urgently. Attached is a picture of my program, the reading of belt speed part.
  Thanks a millionz!
0 Kudos
Message 1 of 5
Hi cFP,

Unfortunately you really need an encoder module to effectively read an encoder.  While you might be able to poll the DIO module if it's going really slowly, the truth of the matter is that you can't latch the values with the DIO modules, so you will be undersampling your encoder if you try to use it with the DIO module.  There's really know way around this, it's just that the DIO is meant for just that and the encoder module is meant for these types of applications.

Sorry, but the answer on this one is that you just can't, not unless you are moving your encoder really slowly.

Since it sounds like you need an encoder module, then check this out:

0 Kudos
Message 2 of 5

Hi Otis,

     I know this would be very easy with a cFP quad Unit module. However, there is no budget with this project. In fact, our initial idea was to use a DAQ card for the control of this oven which would allows us more easy ways to control, and within our budget with surplus. However it was suggested to us to use Fieldpoint as it is more robust which unfortunately comes with a price, hence, no choice we have to use a workaround method for this using the DIO module, as I also need Digital Input and Output, but there are still extra points on the DIO module.

  My encoder speed is very slow, hence it should be alright to count the number of pulses of the DIO on-off bits.

  My problem was that, every time the DI turns ON, the increment in the while loops increments many times and does not only increment 1 time. I only need it to increment 1 time, is there any method to reset it? It will also be good if I can use the DI to control a boonlean that latches or "latches" since field point does not accept latching commands.

  In fact, I am very stressed and troubled by the control of this equipment using labVIEW, till date, I have yet to find a suitable program architecture for it. I am finding labVIEW very easy to learn but very hard to apply and use. I have no doubts that this is a powerful program. I have seek technical support but it seems like it is not a very good channel for me currently as this project have been dragging too long, about 3 months, and I have terribly troubled NI for 3 months without much progress. I have a feeling that they are also frustrated with my many questions.  Smiley Sad

  I was told to look for a system integrator, but I do not have that budget, especially when the charges are not very low and they did say that this is not a simple program to do using labVIEW. Hence, I have no choice but to stick my head through this project which has technically failed due to the control in a way. Initially, my company was still thinking of using labVIEW to control of the automation systems we designed which are currently controlled by PLC at the moment.

I have modified my program a lot of times, using producer consumer, state machines, queued etc, but yet to get a good program architecture where the program performance from the fieldpoint does not lag, especially as my oven control includes Modbus commands that gives me framing error constantly which I cannot seem to make it good. I have tried to change the hardware settings, as well as the timeout limit etc, but there is always the framing error, which I think may be a reason why this response is so slow.

  I am at my ends with this project already, hence seeking advice on the forum.

0 Kudos
Message 3 of 5
Hi cfp,
on one side it's easy: you should store the DIO2 value in a shift register, just as time and counter, then increase counter only when DIO2=true and previous value=false.

On the other side, you need to make sure that there is no "bouncing effect" on the DIO2 false->true transition, i.e. there is no temporary reverting to a false state before the true state becomes stable. If there is such effect, you may filter out transitions too much close in time to the previous one. A similar treatment should be done to unstable true->false transitions.

LV 7.1, 2011, 2017, 2019
0 Kudos
Message 4 of 5

Hi pincpanter,


  Thanks a lot!! Such a smart method!! Thanks a million!!

   Smiley Happy



0 Kudos
Message 5 of 5