LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make or define register or buffer?

Solved!
Go to solution

Hi, I am facing a problem in defining register. I have 8 bit register in which first 4 bits are for ODR selection and 2nd 2 bits for range selection and last 2 bits for performance selection. I want to make cases for all but it is very difficult to make combination. is there any way to make 4 bit buffer  for ODR, 2 bit buffer for range and same 1 1 bit for performance, and then from all these buffer make a register. i tried it but i didn't succeeded. Help please.

Download All
0 Kudos
Message 1 of 9
(3,157 Views)
Solution
Accepted by Hussam_KUT

Hi Hussam,

 

it's all about simple bit stuffing:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(3,148 Views)

Thank you for kind reply. I tried this method but i am not succeeded. can you please share the VI you made for example?

0 Kudos
Message 3 of 9
(3,105 Views)

Hi, Thank you for your response. I tried the method but i didn't succeeded. I have attached the problem which i want to get solution. 

0 Kudos
Message 4 of 9
(3,096 Views)

Attach what you tried but did not succeed with.  It should be easy to recreate the VI shown in the picture.  If it didn't work, then you must have done something wrong and attaching your VI we can point out the error.

0 Kudos
Message 5 of 9
(3,093 Views)

Thank yo. I have attached two vi's. One is for fixed ODR which i am using and result ok. The other is for variable ODR and Range which has problem. 

Download All
0 Kudos
Message 6 of 9
(3,090 Views)
Solution
Accepted by Hussam_KUT

Neither 208 fits in 4 bits nor 250 in 2 bits. So how we could set these values?

208 (base 10) = 1101 0000 (base 2)

250 (base 10) = 1111 1010 (base 2)

Your specifications are wrong or at least incomplete.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 7 of 9
(3,064 Views)

Hi, thank you for your reply.

1- I have attached the snap in detail. Infact, it is 8 bit register in which for ODR first 4 Bits are reserved, 2nd 2 for range and last two for full scale range and operation. but the last two bits has to be kept zero.

2-   For these ( 208 (base 10) = 1101 0000 (base 2), 250 (base 10) = 1111 1010 (base 2) ) you can see the table i have attached in snapshot. may that will help to clear it. 

hope that it will make way to solution.

0 Kudos
Message 8 of 9
(3,058 Views)
Solution
Accepted by Hussam_KUT

So GerdW's code is working, but before calculation you need to "translate" your settings to the actual values contained in the tables.

For example, 208 Hz must be translated to 5, 250 dps to 0; 833 Hz would translate to 7, etc.

I suggest you to create two enum typedefs with U8 representation, one with possible frequencies, the other with possible dps.

See my attached example for the full scale.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 9 of 9
(3,043 Views)