MPL3115A2 question:

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
1,882件の閲覧回数
rheal
Contributor I
So the 20 bit altitude value consists of 2 bytes with a 2-s complement signed number,   and 4 bits in the third byte representing fractions of a metre as an unsigned number.So if I go to Death Valley and the first two bytes are -30 metres  and the fractional bits in the 3rd byte amount to 0.6 metres,   does that make the total result to be -30.6 metres or -29.4 metres ?
0 件の賞賛
1 解決策
1,612件の閲覧回数
TomasVaverka
NXP TechSupport
NXP TechSupport

Hello,

The fractional component needs to be added to the integer component, so the result would be -29.4 meters.

Let’s consider another example:

OUT_P_MSB = 0xFF

OUT_P_CSB = 0xFF

OUT_P_LSB = 0xF0

The integer component is -1, the fractional component 0.9375 ((0xF0 >> 4) * 0.0625) and the resulting altitude -1 + 0.9375 = -0.0625 meters. 

You can find a simple example code for the MPL3115A2 working in the Altimeter mode in this document.

I hope it helps.

Regards,

Tomas

元の投稿で解決策を見る

0 件の賞賛
1 返信
1,613件の閲覧回数
TomasVaverka
NXP TechSupport
NXP TechSupport

Hello,

The fractional component needs to be added to the integer component, so the result would be -29.4 meters.

Let’s consider another example:

OUT_P_MSB = 0xFF

OUT_P_CSB = 0xFF

OUT_P_LSB = 0xF0

The integer component is -1, the fractional component 0.9375 ((0xF0 >> 4) * 0.0625) and the resulting altitude -1 + 0.9375 = -0.0625 meters. 

You can find a simple example code for the MPL3115A2 working in the Altimeter mode in this document.

I hope it helps.

Regards,

Tomas

0 件の賞賛
%3CLINGO-SUB%20id%3D%22lingo-sub-266768%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EMPL3115A2%E3%81%AE%E8%B3%AA%E5%95%8F%3A%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-266768%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3Dutf-8%22%20%2F%26gt%3B%0A%3CTABLE%3E%3CTBODY%3E%3CTR%3E%3CTD%3ESO%E3%80%8120%20%E3%83%93%E3%83%83%E3%83%88%E3%81%AE%E9%AB%98%E5%BA%A6%E5%80%A4%E3%81%AF%E3%80%812%20%E3%81%AE%E8%A3%9C%E6%95%B0%E3%81%AE%E7%AC%A6%E5%8F%B7%E4%BB%98%E3%81%8D%E6%95%B0%E5%80%A4%E3%82%92%E5%90%AB%E3%82%80%202%20%E3%83%90%E3%82%A4%E3%83%88%E3%81%A8%E3%80%81%E3%83%A1%E3%83%BC%E3%83%88%E3%83%AB%E3%81%AE%E5%B0%8F%E6%95%B0%E3%82%92%E7%AC%A6%E5%8F%B7%E3%81%AA%E3%81%97%E6%95%B0%E5%80%A4%E3%81%A8%E3%81%97%E3%81%A6%E8%A1%A8%E3%81%99%203%20%E7%95%AA%E7%9B%AE%E3%81%AE%E3%83%90%E3%82%A4%E3%83%88%E3%81%AE%204%20%E3%83%93%E3%83%83%E3%83%88%E3%81%A7%E6%A7%8B%E6%88%90%E3%81%95%E3%82%8C%E3%81%BE%E3%81%99%E3%80%82%3C%2FTD%3E%3CTD%3E%E3%81%A7%E3%81%AF%E3%80%81%E3%83%87%E3%82%B9%E3%83%90%E3%83%AC%E3%83%BC%E3%81%AB%E8%A1%8C%E3%81%A3%E3%81%A6%E3%80%81%E6%9C%80%E5%88%9D%E3%81%AE%202%20%E3%83%90%E3%82%A4%E3%83%88%E3%81%8C%20-30%20%E3%83%A1%E3%83%BC%E3%83%88%E3%83%AB%E3%81%A7%E3%80%813%20%E7%95%AA%E7%9B%AE%E3%81%AE%E3%83%90%E3%82%A4%E3%83%88%E3%81%AE%E5%B0%8F%E6%95%B0%E3%83%93%E3%83%83%E3%83%88%E3%81%8C%200.6%20%E3%83%A1%E3%83%BC%E3%83%88%E3%83%AB%E3%81%A0%E3%81%A3%E3%81%9F%E5%A0%B4%E5%90%88%E3%80%81%E5%90%88%E8%A8%88%E7%B5%90%E6%9E%9C%E3%81%AF%20-30.6%20%E3%83%A1%E3%83%BC%E3%83%88%E3%83%AB%E3%81%AB%E3%81%AA%E3%82%8B%E3%81%AE%E3%81%A7%E3%81%97%E3%82%87%E3%81%86%E3%81%8B%E3%80%81%E3%81%9D%E3%82%8C%E3%81%A8%E3%82%82%20-29.4%20%E3%83%A1%E3%83%BC%E3%83%88%E3%83%AB%E3%81%AB%E3%81%AA%E3%82%8B%E3%81%AE%E3%81%A7%E3%81%97%E3%82%87%E3%81%86%E3%81%8B%E3%80%82%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-266769%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MPL3115A2%20question%3A%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-266769%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3Dutf-8%22%20%2F%26gt%3B%0A%3CP%3E%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF%E3%80%81%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%22%3E%E5%B0%8F%E6%95%B0%E9%83%A8%E5%88%86%E3%82%92%E6%95%B4%E6%95%B0%E9%83%A8%E5%88%86%E3%81%AB%E5%8A%A0%E7%AE%97%E3%81%99%E3%82%8B%E5%BF%85%E8%A6%81%E3%81%8C%E3%81%82%E3%82%8B%E3%81%9F%E3%82%81%E3%80%81%E7%B5%90%E6%9E%9C%E3%81%AF-29.4%E3%81%A8%E3%81%AA%E3%82%8B%E3%80%82%E3%83%A1%E3%83%BC%E3%83%88%E3%83%AB%E3%80%82%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%22%3E%E5%88%A5%E3%81%AE%E4%BE%8B%E3%82%92%E8%80%83%E3%81%88%E3%81%A6%E3%81%BF%E3%81%BE%E3%81%97%E3%82%87%E3%81%86%E3%80%82%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%22%3EOUT_P_MSB%20%3D%200xFF%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%22%3EOUT_P_CSB%20%3D%200xFF%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%22%3EOUT_P_LSB%20%3D%200xF0%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%22%3E%E6%95%B4%E6%95%B0%E9%83%A8%E3%81%AF-1%E3%80%81%E5%B0%8F%E6%95%B0%E9%83%A8%E3%81%AF0.9375%EF%BC%88(0xF0%20%26gt%3B%26gt%3B%204)%20*%200.0625%EF%BC%89%E3%81%A7%E3%80%81%E7%B5%90%E6%9E%9C%E3%81%A8%E3%81%97%E3%81%A6%E5%BE%97%E3%82%89%E3%82%8C%E3%82%8B%E9%AB%98%E5%BA%A6%E3%81%AF-1%20%2B%200.9375%20%3D%20-0.0625%E3%81%A8%E3%81%AA%E3%82%8B%E3%80%82%E3%83%A1%E3%83%BC%E3%83%88%E3%83%AB%E3%80%82%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CA%20_jive_internal%3D%22true%22%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fdocs%2FDOC-95378%22%20target%3D%22_blank%22%3E%E3%81%93%E3%81%AE%3C%2FA%3E%E3%83%89%E3%82%AD%E3%83%A5%E3%83%A1%E3%83%B3%E3%83%88%E3%81%AB%E3%81%AF%E3%80%81%E9%AB%98%E5%BA%A6%E8%A8%88%E3%83%A2%E3%83%BC%E3%83%89%E3%81%A7%E5%8B%95%E4%BD%9C%E3%81%99%E3%82%8B%20MPL3115A2%20%E3%81%AE%E7%B0%A1%E5%8D%98%E3%81%AA%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%20%E3%82%B3%E3%83%BC%E3%83%89%E3%81%8C%E8%A8%98%E8%BC%89%E3%81%95%E3%82%8C%E3%81%A6%E3%81%84%E3%81%BE%E3%81%99%E3%80%82%20%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%E3%81%8A%E5%BD%B9%E3%81%AB%E7%AB%8B%E3%81%A6%E3%82%8C%E3%81%B0%E5%B9%B8%E3%81%84%E3%81%A7%E3%81%99%E3%80%82%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%E3%82%88%E3%82%8D%E3%81%97%E3%81%8F%E3%81%8A%E9%A1%98%E3%81%84%E3%81%84%E3%81%9F%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%3C%2FP%3E%3CP%3E%E3%83%88%E3%83%BC%E3%83%9E%E3%82%B9%3C%2FP%3E%3C%2FLINGO-BODY%3E