LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert a normal number to binary?



@C. Minnella wrote:
Really minor, but I think I would replace the Quotient & Remainder with a divide, and you could even use a floating point type for the speed control.
Well, I figured rounding down to the neares 0.1 rpm out of 20000 rpm would not make much of a difference ;). I don't think we need anything orange here. 😄
0 Kudos
Message 101 of 129
(1,392 Views)
So I converted the displays over to I64.
 
And I know this may be the same time I have made the same mistake and asked about it for the millionth time in this thread but i still just dont "get it" im sorry.
 
1. You guys all mentioned custom probes. I searched the help file and it mentions custom probes, but I still cant figure out how to make one.
 
2. Im thinking it may be the probe im using but let me ask this anyway: The response form the controller consists of "twos compliments" or one large number consisting of one bit for the first digit and one bit for the second digit correct? I have examined the answer string in hex and I have identified which "indexes" are the bits I want to grab, reform into one 2 bit number, multiply by a scaling multipler, and then dispaly in decimal.
 
So i look with the standard probe at what it is produced AFTER the string to byte array block. They seem to be 0-255. Now im resonably sure this is because its an 8 bit number.  Im not really sure what the difference is between a U8, I8, etc. Now it does seem that when I join the numbers that it dosent quite work, but how can I really know if the probe is not in the right units?
 
Help me out here.
0 Kudos
Message 102 of 129
(1,363 Views)
To create a custom probe, right-click on the wire and select "custom probe...new..." base it on an existing probe, but change the display to the desired format.
 


@Vr6Fidelity wrote:
So I converted the displays over to I64.

Why??? I32 is sufficient.


@Vr6Fidelity wrote:
 Im not really sure what the difference is between a U8, I8, etc.
Now, that's really a prerequisite for any programming job of this flavor. Maybe you want to relax over the weekend and do some easy reading on programming fundamentals. "I" is a signed integer,meaning the first bit distiguishes between positive and negative, while the remaining bits are the number, U is unsigned. 8 is the total number of bits.
 
I8 can be in the range of -128...127
U8 can be in te range of 0...255
 
If you join numbers, the possible sign only makes sense for the higest byte. If things are expected to be little endian, you need to reverse the bytes. You simply need to start thinking on a bit level. It is really simple: only two states each!
 
Under the hood, everything is just a collection of bits. Only you know how they need to be interpreted. (For example if you have 32 bits, it could be a string with 4 characters, an I8 array with 4 elements, a U16 array with two elements, A I32 integer, A SGL floating point number, A cluster of two U8 and one I16 numeric, etc.etc. mix& match!)
 
Here's a good start:
 


 

Message Edited by altenbach on 08-03-2007 08:12 AM

0 Kudos
Message 103 of 129
(1,359 Views)

The numbers still add up to crazy high values like for example the speed at 30,000 reads 532,000 or so.

 

 

0 Kudos
Message 104 of 129
(1,345 Views)
Can you show us the raw response string you get and number you want to get out of it.
 
Maybe you need to do a factor of 10 here too?
Maybe you need to swap the bytes?
 
 
0 Kudos
Message 105 of 129
(1,334 Views)

Everything is working now, thanks to all of you. Smiley Very Happy

 

 

0 Kudos
Message 106 of 129
(1,324 Views)

Quick question, Everything is working well now and I am very pleased.

The voltage value that I am reading is changing a 2KHZ and since I am sampling it at the relativly slow speed of 4S/Sec It is a bit "Jittery"

I would like to make a running average of the last 10 samples. I know I need to use a shift register somehow, build an Array, sum the array elements and then divide by the number of array elements.

How do i make an array where the new value written "bumps" the bottom value out of the array?

I was thinking something along these lines? How do i make it have 10 points and the bumping action?

0 Kudos
Message 107 of 129
(1,316 Views)
If you have the full version of LabVIEW, you can just use the Point by Point Mean function.
0 Kudos
Message 108 of 129
(1,307 Views)
Im just a lowly base customer.  Smiley Sad
0 Kudos
Message 109 of 129
(1,302 Views)
I broke it. Smiley Sad
 
I SWEAR I touched nothing!!!! I just pasted this into my other data quisition VI and poof, something went south with the event structure. How do I fix it?
0 Kudos
Message 110 of 129
(1,293 Views)