annuler
Affichage des résultats de 
Rechercher plutôt 
Vouliez-vous dire : 

data stream cannot into for loop (motor canopen control)

Résolu !
Accéder à la 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?

Tout télécharger
0 Compliments
Message 1 sur 11
3 559 Visites

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 Compliments
Message 2 sur 11
3 547 Visites

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 Compliments
Message 3 sur 11
3 539 Visites

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 Compliments
Message 4 sur 11
3 501 Visites

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 Compliments
Message 5 sur 11
3 493 Visites
Solution
Accepté par ytm1056147860

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

Message 6 sur 11
3 489 Visites

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 Compliments
Message 7 sur 11
3 480 Visites

@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 Compliments
Message 8 sur 11
3 470 Visites

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 Compliments
Message 9 sur 11
3 462 Visites
Solution
Accepté par 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 Compliments
Message 10 sur 11
3 457 Visites