LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert hex number to mac address with colons

Solved!
Go to solution

This might be a simple thing to do but I can't make it happen 😞

 

So I need to make a mac address with colons. At first, the Address is  divided in two sections.

First the constant part C87248 and the second part as a running number from 0 to appr. 16000000

The outcome should look like this C8:72:48:00:00:00

 

The .vi is going to be used in teststand 3.5.

The running number is an input parameter and .vi should return the mac address as a string so that teststand could read it.

 

These hex conversions in labview drives me crazy. I'm able to convert the address to format

C872 4800 0000 but I can't reformat it the way i want it.

 

 

0 Kudos
Message 1 of 7
(6,572 Views)

Hi sebulban,

  Please tell me whether the Hex address is a string or an integer...How it is stored in testStand variables?

 

 

Thanks and regards,

srikrishna

Regards,
Srikrishna


0 Kudos
Message 2 of 7
(6,567 Views)
Solution
Accepted by topic author sebulban

This should do it, although it's probably not the most efficient way.

 

 

build mac address.png

 

MC

 

0 Kudos
Message 3 of 7
(6,556 Views)

Thanks ! That works just fine 🙂

0 Kudos
Message 4 of 7
(6,544 Views)

mac.png

Omar
0 Kudos
Message 5 of 7
(6,530 Views)

And here is yet another solution.

 

Note: Right click on the Search And Replace function and check Regular Expression.

 

To MAC Address.png

 

Edit: Added the 6 constant to length input of number to hex

=====================
LabVIEW 2012


0 Kudos
Message 6 of 7
(6,521 Views)

Speed is probably not important for something like this. But out of curiosity I did a comparison of all three techniques above. I ran the algorithms 10M times each.

 

MaxCrunch 250mS

Omar II 1586mS

SteveChandler 1590mS

Altenbach: <46pS (Only he has not yet posted his version Smiley Very Happy)

=====================
LabVIEW 2012


0 Kudos
Message 7 of 7
(6,511 Views)