05-30-2007 10:09 PM
05-30-2007 10:16 PM
I'm not good reading words. Could you attach a simplified version of your code. It would make things much clearer to us. Looks like a race condition, though.
btw, what's a " front panel shared variable"?
05-31-2007 05:11 AM
05-31-2007 01:30 PM
05-31-2007 02:47 PM
HI Brian,
I ran into a similar situation with alarm events in DSC. THe value reported with the event was always stale (alarm would indicate HiHi and the value was below the threshold).
I ended up using data socket reads to grab the data and always had to read it twice to get the actual value.
I hope this helps,
Ben
05-31-2007 03:09 PM
Hi Ben-
I will try that. I switched to Datasocket writes, but that didn't seem to help.
Brian
06-01-2007 07:27 AM
I am now using Datasocket Reads instead, and am doing it twice before I write to the other variables. That seems to be working.
What is the difference between using a Datasocket Read by itself vs. Datasocket Open-Read-Close? Any issues with using the Read by itself?
06-01-2007 10:59 AM
06-01-2007 11:05 AM
In my case I only used the "read" flavor and opened the datasocket when the app started.
The "read twice" still smells like a bug to me.
Ben
05-17-2012 12:12 PM
OK, I apologize to all who no longer care about this thread for reopening it, but here we are 5 y later and I am also having this problem. It took about 15 h of staring at a screen and repeatedly starting and restarting my RT program before I finally could pinpoint the problem. I too share this problem of my updates being 1 s behind, but here is a more complete description:
I have a switch that the user can update through a front-panel hosted on a local laptop that is connected to a PXI chassis via ethernet. The control on the front panel is bound to an SV which is handled on the PXI chassis (there is no code on the host related to the switch other than the terminal itself). When the switch is directly operated by the user, there is no "apparent" problem (I say apparent, because there is likely a delay that is not observed by the user). The user can select a mode of operation in which the switch operates on a fixed duty cycle (x seconds high and y seconds low). When the user uses this, the state of the switch is stored in an object that is polled by the main VI. When time has elapsed in the current position, the switch is flipped via the same SV that is bound to the front panel control. Immediately following the VI which flips the switch on the SV, the state of the SV in question is polled to see if anything has changed. In this case, no change in state is registered the first time, so the switch state itself is never updated and the code rolls around again with the switch in the previous state and the time still elapsed. It sends (again) the same command to flip the switch and so we now have two changes in SV state that are queued up to be handled. This results in the switch flipping and then reverting 1 second later to it's initial state.
I can work around this, but this seems like undesirable (and undocumented) behavior of the SV (ok, maybe the undocumented thing is unfair since I may be too lazy to dig far enough
). Since the previous poster solved his problem via datasockets, would someone from NI (or anyone who is familiar with this issue) like to return to the original question and 1) explain whether this behavior is expected or not and 2) why? I actually like SVs, but this kind of thing frustrating.
Thanks, Matt