LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Numeric Format with "dB" causes strange Increment and Decrement behavior

To reproduce this, drop a numeric control in LabVIEW (Version 8.2 and later).
Right click on the numeric control and select properties
Select the "Format and Precision" tab
Select the "Advanced editing mode" radio button
Change the Format string to "%#_gdB" and press OK.
Type "-123" into the numeric control.
Place the cursor inbetween the 2 and 3.  Press the up arrow.  The normal response of the numeric is to increment the number to the left of the cursor, in this case the 2.  The expected number is -113.  However, with the "dB" in the format string, the number becomes -11.3.  This caused a problem with a Signal Generator whose power output (in Decibels) was controlled by this instrument.  in 2 keystrokes, the power went from -80dB to 0dB and almost damaged some equipment.
The work around is to remove the dB from the format string or put it in parenthesis.  However, this seems like a bug.  If someone from National Instruments determines this is a bug, please post the CAR# to this thread.  Otherwise, it would be nice to have this behavior explained.



0 Kudos
Message 1 of 4
(2,803 Views)
Interesting behavior. I confirmed this with 8.2. What's more interesting is that the behavior is not consistent. If you use "Hz" the control works as you expected it to work. If you use "A", and perform the same steps, pressing the up arrow gets you "NaN". I tried putting a space before the "dB", and it made no difference. At first I thought that the "d" was being misinterpreted, but the result from using "A" made no sense. Very odd.

Lesson learned from your experience: Always make sure to check the values that you want to set before you actually set them. You should have 2 layers of checking. The lowest level checks the values against the instrument's capabilities. In other words, making sure you don't try to program a level of 100 when the instrument can only handle 10. A higher level should check values against usage limits. This is where you put in the valid ranges for how you're using the instrument. For example, even though the instrument may be able to go to 13 dBm, in your testing you may only want a maximum setting of, say, -20 dBm. In my code I write a wrapper VI around each driver function to implement this. This requires extra code, but it can save your butt in many instances. Smiley Very Happy
0 Kudos
Message 2 of 4
(2,790 Views)

Hello SWalpole,

Thank you for contacting National Instruments.  I have confirmed this behavior in LabVIEW 8.2 and LabVIEW 8.5.1.  I have created a Corrective Action Request for this issue.  The CAR number is 119048.  I do apologize for this inconvenience and we will work to resolve this in future versions of LabVIEW.  Thank you for your patience.  If you have any other questions please just let us know.

Thanks!
Bob H
Applications Engineer
National Instruments
0 Kudos
Message 3 of 4
(2,751 Views)
0 Kudos
Message 4 of 4
(2,691 Views)