Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure multiple buffers and execute them sequentially?

I would like to build up a path follower using at least two buffers. I wish to write data into the buffers in advance and then execute them sequentially. How can I do?
I have tried the case for using two buffers, and could only get the two buffers to work "sequentially",
which means that I could first write data into buffer 1, then execute it, then write data to buffer 2,
then execute it. Is there any way that I could use multiple buffers and exectue them as the sequence as
I want?

The following are the steps that I used for dual buffers:

buffer 1:
flex_set_op_mode
flex_configure_buffer
flex_write_buffer (check ready)
flex_start (check complete)
buffer 2:
flex_set_op_m
ode
flex_configure_buffer
flex_write_buffer (check ready)
flex_start (check complete)

I wish to achieve the following:
flex_configure_buffer (buffer 1 & 2)
flex_write_buffer (to buffer 1)
flex_start (buffer 1)
while waiting (flex_write_buffer (to buffer 2))
flex_start (buffer 2)

The purpose of my using two buffers is to try to prepare data for buffer 2 when we are waiting
for the execution of buffer 1 and we could execute buffer 2 almost immediately when buffer 1 was
done. Apparently, I have tried and with no luck to get it to work.
0 Kudos
Message 1 of 4
(3,280 Views)
It sound more that what you want to do is to write values to one buffer on the fly, in this way you can run through the points in your buffer and then write new points inot it as they are consumed by the trajectory. Refer to the Buffered Contour Rose example that ships with our NI-Motion 6.0 driver for more help on how to do this. You can also get it from:

http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=B45EACE3E66B56A4E034080020E74861&p_node=DZ52481&p_submitted=N&p_rank=&p_answer=&p_source=External

Best regards,

Alex Games
0 Kudos
Message 2 of 4
(3,280 Views)
Dear Alex:

Thank so much for your prompt reply.
As my buffer data are complete different sets of data, I need to write one set of data into one buffer, and execute them, then move to other place, and execute another set of buffer data. During the movement, there is some time for me to pre-setup the data for next buffer, therefore, comes to the need for executing one buffer, and prepare data for the next buffer on the fly. As there are operation mode changes in between, so I am not sure that the contour rose example would help. Do you have any better suggestion for my need?

Best regards

Jih-Jenn Huang
0 Kudos
Message 3 of 4
(3,280 Views)
You can always configure a buffer for indefinite continuous operation by setting the total points value in the configure buffer function to be the maximum value allowed. You can the use the check buffer function inside the while loop to monitor the backlog of your buffer in order for enough positions to be avaliable for the next set of points to be downloaded. As long as your sets of data are of a smaller size than the total buffer size this will have the effect you are desiring. You can always make your precalculations for the next set of points while the previous move is being executed, you just need to allow enough time between the beginning and the end of your first move for the next calculation to be done.
0 Kudos
Message 4 of 4
(3,280 Views)