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: 

data stream cannot into for loop (motor canopen control)

Solved!
Go to solution

I want to use Canopen to control muti-axis,by using Canopen example code "CANopen Read Write CAN Frame",one axis is driven successfully.When I add for loop to input an array data,for loop in the WHILE loop is not function.Does anyone know the reason? or How to contorl muti-axis by canopen with NI9881?

Download All
0 Kudos
Message 1 of 11
(2,462 Views)

Your incoming arrays are empty.  When you auto-index on an empty array, there are no elements for the For Loop to act on.  Thus it executes zero times.

 

Put some data in your arrays and try again.

0 Kudos
Message 2 of 11
(2,450 Views)

I use NI9881 connected moter driver(load is no problom,There is nothing wrong with the wiring),and input the control word to command moter to my expect position,data stream still not work in the for loop.if there is no for loop,moter will respond.but I can't control two moter at once.that's very frustrate me.

0 Kudos
Message 3 of 11
(2,442 Views)

Did you look at the pictures you attached to your message?

 

You had highlight execution turned on.  The array wires going into your For Loop have the notation "#0" on them.  That means your arrays have ZERO elements in them.  When a For Loop is set to auto-index on an array such as that, it will iterate ZERO times.

 

Why are those arrays empty?

0 Kudos
Message 4 of 11
(2,404 Views)

sorry that I didn't make myself clear.

the picture I upload that is empty arrays ,yes.Because I was debug my code without load.

But I really add numbers in arrays tried agian.

This time I wire my load and Filled with numbers and the LOOP situation is still exists.

 

Thank you and look forward to your reply.

0 Kudos
Message 5 of 11
(2,396 Views)
Solution
Accepted by topic author ytm1056147860

You still have 3 arrays in there with no elements.  Those wires that appear to hold references for the CAN bus.

Message 6 of 11
(2,392 Views)

AAAAA~ The problem seems to be here.

When I run my code with load,NI9881'LED is enlighted that's means NI9881(Canopen module is good running ). 

Why the CAN bus signal cann't run normal on the wire? That's pretty strange!!!

0 Kudos
Message 7 of 11
(2,383 Views)

@ytm1056147860 wrote:

AAAAA~ The problem seems to be here.

When I run my code with load,NI9881'LED is enlighted that's means NI9881(Canopen module is good running ). 

Why the CAN bus signal cann't run normal on the wire? That's pretty strange!!!


"AAAA~"  What does that mean?

 

"enlighted"  Not an English word.  A bad translation from Japanese/Chinese?  I guess you mean "lit up".

 

"Why the CAN bus signal cann't run normal on the wire?"     I have no idea what you mean here either.

 

Did you investigate the problem I pointed out about empty arrays?

0 Kudos
Message 8 of 11
(2,373 Views)

I delete FOR LOOP before WHILE LOOP ,and CANopen wires is not empty,even though I still can't control muti-axis at once,but the empty LOOP problem is solved.

THANKYOU agian!

0 Kudos
Message 9 of 11
(2,365 Views)
Solution
Accepted by topic author ytm1056147860

Did you have any elements in your array called "NodeID".  With that empty, the 3 For Loops in series would have run 0 times causing all of those reference arrays to be empty.  And that would cause the For Loop in the While Loop to run 0 times.

0 Kudos
Message 10 of 11
(2,360 Views)