From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

angle from degrees to a 14 bit BCD format

Solved!
Go to solution

I need to convert an angle from degrees to a 14 bit BCD format. i.e. 0 degrees all 0's, 359.99 degrees all 1's. What is the best way to go about this?

0 Kudos
Message 1 of 3
(2,075 Views)
Solution
Accepted by topic author venturer

Hi venturer,

 

angle(BCD14) = convert-to-u16( remainder( angle(degree) / 360 ) * 16384 )

 

Simple math, isn't it?

 

Btw.

This isn't called BCD. It's just a different number range (0-16383) for the same meaning (0-359.99°)...

Best regards,
GerdW


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

Hi venturer,

 

one small correction: you have to divide by 360 once:

check.png

Best regards,
GerdW


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