12-10-2012 09:30 PM
Hi,
Are there any differences between SoftMotion's express VIs and the function blocks? I plan to drive a servomotor via an NI 9505. The NI examples show how to use the function blocks, but I've been advised to use the Express VIs instead, to work around strange behaviour when using a simulated axis (http://forums.ni.com/t5/LabVIEW/SoftMotion-quot-Update-Buffer-quot-VI-refuses-to-take-more/m-p/22508...
Thanks!
Solved! Go to Solution.
12-11-2012 12:16 AM
Hi JKSH,
If I were starting a new application, I would use Express VIs over function blocks. Here are a list of things to consider when choosing:
I looked at your other post and it looks like you are encountering one of the subtleties of asynchronous calls. In point 1 above, I mentioned that function blocks are rising edge sensitive on the execute line. In both your modified example and the original example, the 'Update Buffer' function block is executed when the 'space available' becomes greater than or equal to the 'Size of the Contour Data.' In the original example, the table size is 40, but in your example, it is 100. Let's trace the flow through the example:
So what was wrong with your modification? You made the table size 100 points. If you look at the steps above, you'll see that in the example, we put 40 points into the buffer before taking any points out. If you increase the table size to 100, that means that there will be 60 spaces available. However, 60 is still greater than 'size of contour data' (which is 20) and so the 'execute' input of the 'Update Buffer' function block never goes false; we always have more space available than the 'size of contour data.' Since 'execute' is rising edge sensitive, we're never actually putting new data into the buffer and therefore you only get out the two cycles that you originally put in. I agree that this is tricky, but it is exactly as function blocks are supposed to operate and is definitely something to think about when using the asynchronous API.
Thanks,
12-11-2012 02:12 AM
Hi PaulRB,
You answered both my questions so thoroughly and clearly, plus you gave additional info that I didn't even think of looking for. Thank you so much!
I was making the wrong assumption that the function blocks "execute when true", rather than "execute on rising edge".
Yes, I think I will stick to the synchronous express VIs for now; this application is quite small, and the synchronous model fits nicer with LabVIEW's dataflow model. I'd just like to clarify: Is it correct to say that, once I initialize my buffer and start the continuous contour move, the "start" VI won't return until the buffer runs dry? So, unlike the function blocks' single-chain layout, I should call the "start" VI in parallel with the loop that calls "Update Points"?
12-11-2012 05:15 PM
Hi JKSH,
You are correct. You should call the 'Start' VI in parallel with the 'Update Points' VI. The 'Start' VI doesn't even have to be in a loop (and in fact probably shouldn't be in a loop) because it will block forever as long as you never let the buffer run dry. The 'Update Points' VI should be run in a loop and should be called before your buffer is empty, but not until you have enough space in your buffer.
Thanks,