LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data from RS232 (HEX) split in Bits, then change to number

Hello,

i'v a problem. I get from the rs232 10 Bytes. This Bytes i have to split in 80 Bits with all zeros. Then i'll parts of Bits like 1 to4 change in number for example: 0010->2. The next is Bitgroup 5 to 10 for example and so on. What is a good solution for this? I'v create many vi's but no works fine. My problem is, that i looses the zeros by changig Hex to Number. Can you help me, please!

Thanks, Thomas
0 Kudos
Message 1 of 15
(4,670 Views)
I am not sure I understand the problem of "losing zeros by changing hex to number."

Your example (0010>2) shows going from binary to decimal or hex. Where exactly are you losing the zeros?

Ed


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 2 of 15
(4,648 Views)
What you are describing makes very little sense, maybe because of a language barrier.

What operation is "split in ..." (logical OR, replace elements, etc.)

Missing leading "zeroes" is just a cosmetic formating issue. Do you loose othere kinds of zeroes?

It would help tremendously if you could attach an example VI with controls containing some typical values as defaults. Also make a note showing the desired correct output.
0 Kudos
Message 3 of 15
(4,644 Views)

@thomla wrote:
... Bits like 1 to 4 change in number for example: 0010->2. The next is Bitgroup 5 to 10 for example and so on.


It is going to be possible, but to avoid confusion about "and so on":
Do you mean that you want to get numbers for 4 bits, 6 bits, 4 bits, 6 bits, 4 bits, 6 bits etc. for the 10 bytes?
=====================================================
Fading out. " ... J. Arthur Rank on gong."
0 Kudos
Message 4 of 15
(4,640 Views)
Hi Thomas,

As you can read before my reply, you wasn't so understood.
If I understand you correct, the attached VI should resolve your question and problem.

Hope It Gives You Meaning ...
0 Kudos
Message 5 of 15
(4,628 Views)
Trying to cross the language barrier :
I understand that you want to decode decimal digits coded into nibbles (4 bytes), as two digits for each byte.
If so, the solution is rather straight forward, using logical operators, as in the attached vi.

CC
Chilly Charly    (aka CC)
0 Kudos
Message 6 of 15
(4,630 Views)
And to stick more closely to your question, with an added string to U8 initial conversion...

CC
Chilly Charly    (aka CC)
Message 7 of 15
(4,628 Views)
Hello,

here is a vi, what i'v create. The upper function can change hex to bit but only for 4 Bytes and not for 10 Bytes. I think the reason is the variable. But i have 10 Bytes...what could i do?

the function below change the hey-ascii in bit-ascii. after this i try to split of the string in part-strings. Then i need a correct conversion in number for example Bit 1 to 4 with 0001->1

i hope it helps.

Thanks Thomas
0 Kudos
Message 8 of 15
(4,620 Views)
Hi chilly charly,

Its a great VI. So simple and smart and doing the work ...

Keep On, we are all learning from you the "Veterans".

The Bush-Man
Message 9 of 15
(4,614 Views)
Here's one possibility. See attached (LabVIEW 7.1).
0 Kudos
Message 10 of 15
(4,609 Views)