LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to get a decimal number of length more than 1 byte from three componnent decimal numbers

I had attached one VI which is the had the termination commands for the motor.The motor will provide the steps it ran only after giving the termination commands. in these the commands from 165-167 will provide the decimal numbers ie eg outputs for the commands which represents 50000 steps is given below

                                                      165--00

                                                       166--195

                                                        167--50

from 168-170 it will provide zero since i'am not using those axis 

 

so how can i modify the program to get the respective step counts from the component numbers. Please kindly help me.

                                                        

0 Kudos
Message 1 of 35
(3,636 Views)

How's this?

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 35
(3,627 Views)

here can you tell how the type cast function with the array subset provides the decimal number of length more than one byte from these three numbers. You gave 2 and 3 to subset array terminals. From the index 2 onwards 3 indices will be selected. but these three numbers , how they are joined and get a another number using type please explain if you re free to do.

0 Kudos
Message 3 of 35
(3,617 Views)

50000 written with 3 bytes is 00 C3 50 (00, 195, 50), and your return is an array of U8, or single bytes.

So, extracting those 3 bytes as an array of U8, and typecast it to a I32 you get 0000C350 (possibly with a byte order issue, you'll have to test that)

 

It's easy to show if you make a test vi with an array of U8 and typecast it to a I32 and show all as hexadecimal.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 35
(3,613 Views)

Hi perumpadapu,

 

why did you start a new thread instead of continuing in your old one?

 

Try this:

check.png

Get your 3 bytes, prepend a zero, typecast to I32. Your example yields 49970 instead of 50000 (50000d = C350h, but 49970d = C332h)...

Or use Join as suggested in your older thread...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 35
(3,608 Views)

but i need the final value as a decimal number. Is it possible with it? please kindly reply on available free time

0 Kudos
Message 6 of 35
(3,602 Views)

Blue threads are integers, decimal numbers.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 35
(3,594 Views)

I attaching a test VI for 50000 , but your solution never give the adequate result

0 Kudos
Message 8 of 35
(3,593 Views)

Gerd is right, you need to add an additional 0 byte to the start of the array.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 35
(3,590 Views)

Hi perumpadapu,

 

that's what you created:

check.png

Does it look like my example? Did you tried to debug that using highlighting?

Why did you insert that ArraySubset function? Why did you try to get bytes 1,2, and 3? From an array that only contains values at index 0,1, and 2?

 

Do you sometimes think before you start programming?

Do you sometimes read other peoples answers to your questions?

 

So many questions...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 35
(3,588 Views)