From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

Performing SDO 0x6064 (Position Actual Value) at the end of a timed loop (+ save the value)

Hello,

 

my program uses a timed loop. In the timed loop the actual position is retrieved at a certain time. My timed loop is repeated after 0.1 s. At the end of period n and before the beginning of period n+1 the program should retrieve the actual position and save the value for a comparison between actual position after period n and actual position after period n+1.

Is there a clever way to solve this task? Thank you for your help.

 

Sincerely

 

Guni

0 Kudos
Message 1 of 7
(2,341 Views)

timed loop, ok.

But use a functional variable (GetSet.vi) to accumulate your data with a time stamp.

Then in a paralleled loop with a lower speed, you unpile the functional variable to a file or database.. up to you.

Benoit

0 Kudos
Message 2 of 7
(2,339 Views)

Thank you for your Answer.

Should I retrieve SDO 0x6064 multiple times in the timed loop to get the value which comes closest to the loop End? I only want to know the value at the end of the loop. How can I get this value without retrieve the actual position multiple times?

Thanks.

 

Guni

0 Kudos
Message 3 of 7
(2,293 Views)

Do you have a sample code?

0 Kudos
Message 4 of 7
(2,291 Views)

Hi Guni,

 

I only want to know the value at the end of the loop.

Do you want to read that SDO "at the end" of each iteration (aka as last operation in the loop)? Then use DATAFLOW to call that ReadSDO function as last one per iteration.

Do you want to read the SDO at/after the last iteration of the FOR loop? Then use DATAFLOW to call ReadSDO right after the loop.

 

Why do you need a TimedLoop for serial communication (CAN is serial!) and (most probably) on a Windows computer?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 7
(2,289 Views)

I use the programm for motor control. In the first picture (Case 4/5) are the calculations which are used for the realisation of the movement (second picture: Case 4/31).

In the timed loop the aktual position is retrieved with SDO 0x6064, but the retrieval time is not defined. I need the measured position at the end of every period.

 

Guni

0 Kudos
Message 6 of 7
(2,285 Views)

Hi Guni,

 

OMG!

 

  • Why do I see just local variables in your images? No control terminals, no indicator terminals, just local variables… THINK DATAFLOW! Use wires and shift registers!
  • Why do you need to stack such huge case structures inside other case structures? Have you heard about state machines? Have you tried any of those free available frameworks (like JKI state machine)?
  • Why are those images scaled so differently? One is too small, the other too large…
  • Why do you need to open and close those SDOs so often? Why not open the SDO reference once at init stage and use it throughout your whole program?

 

I need the measured position at the end of every period.

What is the end of a "period"?

Simple solution: create a new state "get position", which is called after every "period"!

 

Before doing that simple step you need to rewrite your VI to use a proper statemachine architecture. Good luck on that!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(2,280 Views)