Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Interpreting Speed and Cadence Data from Message Contents

Rank

Total Posts: 5

Joined 2014-11-25

PM

Hello All,

I am actively receiving a response under the case Broadcast_Data_0x4E from my speed and cadence sensor (combined), though I cannot make sense of the data.

I am using the device profile as a guide but am having trouble with understanding the LSB/MSB concept and how it relates to grabbing the proper data for calculating speed and cadence.

Do I need just the MSB, just the LSB or a combination of the two? If a combination is required, do I add them?

When viewed in visual studio, the contents of the response are decimal values (not hex).

Here is the code if it helps:

Select Case CType(response.responseIDANT_ReferenceLibrary.ANTMessageID)

            Case 
ANT_ReferenceLibrary.ANTMessageID.BROADCAST_DATA_0x4E

                
If SC_A_Connected 0 Then
                    MsgBox
("Speed and Cadence Sensor Connected, Device Num: " response.messageContents(2).ToString())
                    
SC_A_Connected 1
                End 
If

               
#GET SPEED AND CADENCE DATA
                
ANT_LastRev_A ANT_CurRev_A#USE PREVIOUS DATA
                
ANT_StimeLast_A ANT_STime_A #USE PREVIOUS DATA
                
ANT_ClastRev_A ANT_CcurRev_A #USE PREVIOUS DATA
                
ANT_CadenceTimeLast ANT_CadenceTime #USE PREVIOUS DATA

                
ANT_CadenceTime response.messageContents(0).ToString() & response.messageContents(1).ToString() #CADENCE LSB & MSB
                
ANT_CurRev_A response.messageContents(6).ToString() & response.messageContents(7).ToString()#CADENCE REV COUNT LSB & MSB
                
ANT_STime_A response.messageContents(4).ToString() & response.messageContents(5).ToString() #SPEED EVENT TIME LSB & MSB
                
ANT_CcurRev_A response.messageContents(2).ToString() & response.messageContents(3).ToString() #SPEED REV COUNT LSB & MSB




                
Speed_test_A 2.1 1024 * (ANT_CurRev_A ANT_LastRev_A) / (ANT_STime_A ANT_StimeLast_A#[m/s]
                
Cadence_test_A 60 1024 * (ANT_CcurRev_A ANT_ClastRev_A) / (ANT_CadenceTime ANT_CadenceTimeLast#[RPM] 
     
Avatar
RankRankRankRank

Total Posts: 296

Joined 0

PM

The device profile should be all you need to read and understand in order to decode.
It found it to be very concise.
LSB/MSB means "least significant byte" and "most ...", terms that relate to byte order, i.e. interpreting of multi byte values when reading from a byte stream like the ANT message content. Wikipedia should give you the necessary info to understand this.
OMB