LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problems with shift register

Here it is in LV8.0.

 

It's good that you requested the older version as the code I originally posted had a missing state..  😮

There should be 3 states:  initialize, doNothing & increment

 

 

 

0 Kudos
Message 11 of 33
(1,332 Views)

ANKU wrote:

Hi Jeff,

 

Thank you for all the suggestions, i will work on them. I am new to labview and am working on trying to improve my optimization skill in programming.

 

I am using labview 8.0, so can you send me the code in version 8. I would really appreciate it.  I will run the code and let you know how it works. I need to check to see if i get 10 and 40 and then twice 01. If all this number comes then that would give me one pass cycle.  So i need to keep checking the number of times i get these set of numbers. So that is the reason why i am adding the counter outputs.

 

 


In 8.0,

 

I also dicsonected the type def (When posting to the board either add the typedefs or dicsonnect them first please- they open a lot better for us that way ) Smiley Wink


"Should be" isn't "Is" -Jay
Message 12 of 33
(1,326 Views)

Good cleanup job, Jeff.

 

Totally agree with disconnecting typeDefs (or including them with the post) .

0 Kudos
Message 13 of 33
(1,311 Views)

Hi Jeff,

 

Your code is definately much more cleaner than what i did originally and also easier to understand.

 

But my problem still stands, since we are intializing the SR's to 0 the counter is not counting up more than 1. So the counter for checking 01 is always counting only till 1. If i remove the intial value of 0 the counter for 01 starts at 1. I made a few changes to the code. I used a second index array for the number 01, as it is the 3 element in the array. Also the input to the Add is one from the counter for 0X10 and 0X40 and one from the counter for 01.

 

Can you say if i am missing some wire in the code that is causing the SR to start from 1 ?

 

Thank you

 

0 Kudos
Message 14 of 33
(1,295 Views)

The problem with your 01 isn't the SR's, but in your comparison i'd say. 🙂

What is it you're trying to achieve? Count the number of 1's in data slot 2? As the VI looks there's only one 1 as the Data 3 array is 1 element and thus you only check (loop) the (internal) Data array 1 time.

 

Run your code in Highlighted Execution with Remember data values and you'll see how it actually works, it's a great tool for debugging.

 

/Y

Message Edited by Yamaeda on 04-07-2010 10:30 AM
G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 15 of 33
(1,291 Views)

Hi,

 

Yes i am trying to count the number of 01 in the data slot 2. This data3 is connected to another code wich is generating this array continously. So the data 3 is changing continously. I have to check  if i get the number 00X10 and 00X40 from data slot 1 and the number 01 twice from data slot 2. If i get this then i get a pass cycle. So i used shift registers to count the number of times i get these three numbers and then add them to give me the correct number of pass cycles.

 

the other SR start counting from 0 but the SR for the number 01 is starting from 1. I dont know why. Maybe i am missing some control or wire. I am not able to figure out where its missing.

 

Thank you

 

 

0 Kudos
Message 16 of 33
(1,287 Views)

Hi,

 

Good, now we're making progress. 🙂 This external data feed, does it collect all data and then run this function or do you run it each time you get new data? If it's the latter, then you cannot use initialized SR's as they'll reset each time they're called.

The SR for 01 starts from 1 since the previous test is true and it has already added one. That or you've made 1 a default value in the indicator.

 

As i said, use the Highlight Execution and Retain Wire values (close to the Run button) to see what's actually happening in your code. Placing some Breakpoints can be helpful also.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 17 of 33
(1,282 Views)

Hi,

 

I run this code everytime the external data get a new set of numbers. I cannot collect all the data and then check it. This code needs to be dynamic, i need to check everytime a new data comes in. So i guess initializing the SR does not work. What could be the solution to this problem ? How can i make sure the SR for 01 start from 0 ?

 

 

0 Kudos
Message 18 of 33
(1,276 Views)

The code you posted already have a Data 3 element, clear that and "Make Current Values Default" from Edit menu. Since the default value has a '1' in element #2 it'll always cause 01 to increase by 1 the first time.

 

See if this helps.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 19 of 33
(1,272 Views)

ANKU wrote:

I run this code everytime the external data get a new set of numbers.


So you call this VI from another VI that collects the data, right?

 

Call me crazy, but I'd still go with the ActionEngine.  Or a few of them if you want to split the tasks.

The one I posted earlier is a simplified version of what you need, but us was done to illustrate how it can be implemented.  

 

I'm reading your post and although I kind of follow what you say, I can't get a global picture of what you want to do (or why).  There might be other solutions out there.  For instance, what is the significance of counting how many 01's you have.  Is 01 hex-data that was read?  I'm simply trying to get a feel for what the rest of the code might look like and how it would call this vi.. 

 

Maybe I need to re-read the entire thread...  😞

0 Kudos
Message 20 of 33
(1,259 Views)