07-12-2013 11:16 PM
I think your code is very misguided and confusing. It is peppered with useless events for controls on the subVI front panel which is never visible anyway. While I personally would probably do the event handling in the main VI, here's a working version of doing the event handling in the subVI. Seems to work just fine. Let me know if you have any questions. (LabVIEW 2012).
07-12-2013 11:18 PM - edited 07-12-2013 11:34 PM
1cecream wrote:I thought I might warn you that Altenbach's original "MotorControlSpeed(with_event)MOD2" also has some kind of error that I didn't quite understand. What I found was that if I press OFF on the speed selection control, a value of (1/4)64 is inputted into the knob, and if I press 1/4, a value of (1/2)128 is inputted into the knob (i.e the two are out of sync by 1 increment). Not necessarily solving the issue, I was able to put a quick fix to this by manually rearranging the buttons in the speed selection cluster control (I am using this solution for my top-level and SubVI compilation). I still have no idea why this was occurring in Altenbach's original VI, because the initial arrangement of the clutser controls (0-OFF, 1-1/4, 2-1/2, 3-/3/4, 4-FULL) was right.
That's because we also allow "no selection" for the radiobutton control. Here 0 is no selection and everything is shifted up one. You need to insert +1 or -1 in the right places to adapt to that (the code I just posted does that).
as a start, try to add a "-1" as shown in the picture below. 😉
07-13-2013 12:07 AM
Hi Altenbach,
Thank you for this!!! After looking at your VI and the remarks you made I completely understand why the increment is needed there now; in fact I was wondering why even after I rearranged the cluster control the "OFF" selection would not activate for the "Motor PWM Speed" event card. Additionally, I clearly misunderstood the use of reference nodes which Is why so many superflous elements existed in my VI. I would have wanted to keep the event structure portion of the code as part of the top-level VI, but because I'll be using this particular event structure for many controls, I figured it would be beneficial to change it to a SubVI should I need to modify anything in the future.
Again thank you for your time & consideration!