LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

make sequence on case+for structure

Hello,

I made a code that will send CAN frames one after second in define order. I did this as an enclosed picture, however this structure does not always work.

 

What can be the cause, does this form is incorrect?

 

Message Edited by zaqap on 08-13-2008 05:24 AM
0 Kudos
Message 1 of 11
(3,627 Views)

Hi zaqap,

what doesn´t always work? What do you make in the other cases? The second subvi icon tells me that it has to do with a wait function, why do you use another wait in the loop?

Mike

Message 2 of 11
(3,619 Views)

Hi Mike,

in the other cases there is a following frames and the problem consist in that sometimes program sending all frames and sometimes only one(first). The wait function wait for next state to occur an object

 

Zaqap 

0 Kudos
Message 3 of 11
(3,608 Views)

Hi Zaqap,

did you check if you have an error in your error cluster? I guess if you have an error, then you don´t send your data.

Mike

0 Kudos
Message 4 of 11
(3,589 Views)

I check it, no errors..

0 Kudos
Message 5 of 11
(3,580 Views)
Why are you using a for-loop for that? Just place the Write-Wait pairs in sequence. The metronome wait seems to serve no purpose.
Message Edited by smercurio_fc on 08-13-2008 09:07 AM
0 Kudos
Message 6 of 11
(3,577 Views)

Hi zaqab,

               Can you post your code? 

0 Kudos
Message 7 of 11
(3,568 Views)

Hi,

sequence stucture doesn't work with this,  metronome give CPU time to handle other task. In attachment I post sample code

0 Kudos
Message 8 of 11
(3,550 Views)

Offhand I see no procedural issue. In the first iteration of the loop an 8-byte array is sent. In the second a 5-byte array. I'm suspecting the problem is really with your instrument. Are you sure you are waiting enough time after sending the 8-byte array before sending the 5-byte array? Perhaps the instrument is still busy moving.

 

Side notes:

  • Normally when using an event structure one places the buttons inside the event case. This way they're not free-floating, and they will be read and reset by the event structure.
  • The mechanical action for "Stop Motor" is different than the other buttons. Is this intentional?
  • Not having the up/down controls visible for the numeric control makes it look like an indicator, so that may confuse some people.
  • You really need to clean up your wiring.
  •  Passing out the "ObjDataOut" from each event case is pointless since you're not using a shift register, so the value read at the beginning of the loop at the loop tunnel is the one that will always be used. Either use a shift register or don't pass it out. 
0 Kudos
Message 9 of 11
(3,544 Views)

smercurio_fc wrote:

Side notes:

...


One more note:

 

  • It seems all your event cases differ only by the value of the array. Most likely, you could consolidate all the duplicate code so the event frames only contain the array. The second call in the case of current interest could be handled in the timeout case, for example or some other state machine code.

 

Can you rewrite the code to replace all the instrument IO with a simple indicator so we can run it without needing your hardware?

0 Kudos
Message 10 of 11
(3,542 Views)