08-17-2007 05:09 PM
08-22-2007 05:29 PM
08-26-2007 07:41 AM
08-26-2007 08:00 AM
08-27-2007 09:17 AM
Short answer: you can delete the three "thin" looking subVIs ("portsem acquire", "portsem check", "move release"). Unless you are making a block for the NXT-G software, you can basically ignore the motor semaphore stuff.
So the three "thin" looking subVIs all have to do with a semaphore mechanism that controls access to the motors. Since both LabVIEW and NXT-G allow for parallel programming (in fact, make it quite easy to do things in parallel. just drop things that way), you may need to account for two pieces of code wanting to use the same motor ports at the same time.
For example, say you drop two NXT-G "Move" blocks in parallel (use on of the extra sequence wires coming out of the Start block). Lets say the first is configured to go forward 360 degrees and the second is configured to go backward 360 degrees. Say the forward block fired first and turned the motor on forwards, then starts waiting it to reach 360 degrees. Almost immediately afterward, the other block fires and turns the motor on going backwards. Since no one is going to turn the motor on going forwards again, the first block would never finish. The motor semaphore VIs make it so if someone wants to use the same ports as your block, your block will be signaled so that it can abort its execution and yield control to the more recent block. The result is a system where the most recent request wins, and aborts all other motion on that port. Now... that's only if the motor semaphore VIs are used correctly in your block. If you plan on releasing an NXT-G block that controls the motors, please consider using the motor semaphore mechanism within it. The best examples come from the Sync_Time and Motor_Time VIs.
Hope this helps,
Brady Duggan
National Instruments