08-29-2008 02:08 PM
08-29-2008 03:39 PM
Which BCD? "Regular" or "Packed". Also, how would you want to display it? As a string of zeros and ones (characters), or as a Boolean array, or as a numeric indicator? How are you reading the register?
You can look at the example here for a start. If you change the display format of the "bcd" indicator to binary and set the minimum field width to accomodate the largest value you have (be sure to select pad with zeros on the left) you'll get a numeric indicator displaying BCD. Note that the example only works up to 99 since it only performs the integer quotient operation once. Still, you can easily modify it to suit your needs.
08-29-2008 04:30 PM
08-29-2008 04:50 PM
09-02-2008 11:24 AM
smercurio_fc wrote:
25 would be the hexadecimal value. 25 Hex = 37 decimal. To have a numeric indicator display in hex, right click on the indicator and select "Format and Precision". Select "Hexadecimal". You may also want to have the radix displayed so you know the number shown is hexadecimal. With the Properties dialog open this is accessible in the "Appearance" tab. Select the "Show Radix" checkbox. You can also display the radix by right-clicking on the indicator and selecting "Visible Items -> Radix".
This seems to have gotten me very close to solving my problem. Thanks for clearing up my BCD Hex confusion. I guess I need to read up on that more. Your solution however is not working for me because when I choose hexadecimal from the options, it doesn't pick it. It remains at decimal. The same is true with octal and binary. I cannot choose anything other than decimal. Any suggestions on how to make the dial read hex would be appreciated.
09-02-2008 12:00 PM
09-02-2008 12:13 PM
09-02-2008 12:21 PM
Remember that this setting is only a display setting. The number is whatever value you assign it.
If you are receiving your values as a string, you can use the Hexadecimal String to Number primitive to convert the string to the value you want.
If that doesn't help, you should post the code or at least an image of it.
09-12-2008 01:18 PM
Hi Orion,
The number to string conversion functions will be best suited to convert an integer to BCD for display purposes. If the goal is to have a meter on the Front Panel which you can display BCD numbers and yet not have the "1A", "1B", etc... hex numbers appear, then you can use the VIs below to convert to and from BCD. I also wrote a BCD Test VI that demonstrates how these conversion VIs are used.
Please note that the least significant nibble of the Integer In parameter will never be greater than 1001 (9). Therefore, integer values 10-15, 26-31, 42-47, etc... are invalid and will never appear as the Integer In parameter. If you put these numbers into the BCD Test VI, they are not converted properly because they have no BCD counterpart. This is because the least significant nibble in these is greater than 1001.
I hope this helps,
- Erik
09-12-2008 01:36 PM