Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Error Receiving S&C message

Rank

Total Posts: 5

Joined 2014-11-25

PM

Hello All, I am developing a program in VB and am having trouble with implementing the combined SC device profile.

I am actively receiving HRM data, and have basically cut / pasted this code and modified for the device profile of a combined speed and cadence sensor. I appear to be connected to my device, but am only receiving data from the response event (0x40) with a response that is only 3 bytes in length.

Previously, I received HRM data with a Broadcast event (0x4E) so I am not sure what might be going wrong.

Here is a snippet of the channel set up:

#CREATE CHANNEL TO RECEIVE SPEED AND CADENCE DATA (SLAVE)--------------------------------
        
Dim SAC1_Channel As ANT_Channel ANTDevice_0.getChannel(1)

        
SAC1_Channel.assignChannel(User_ANT_ChannelUCNetNUm#ANT CHANNEL SET FOR SLAVE
        
SAC1_Channel.setChannelID(56463False1210#DEVICE NUM is 56463, 121 is DEVICE TYPE FOR SAC, 
        
SAC1_Channel.setChannelPeriod(8086#PERIOD FROM SAC DEVICE PROFILE
        
SAC1_Channel.setChannelFreq(ucRF#ucRF = 57
        
SAC1_Channel.openChannel()


        
#CREATE ANT CHANNEL TO SEND SPEED AND CADENCE DATA FROM SENSOR (MASTER)
        
Dim SC_Transmit_ChannelNum As Byte ANT_ReferenceLibrary.ChannelType.BASE_Master_Transmit_0x10

        Dim SC_transmit_channel 
As ANT_Channel ANTDevice_0.getChannel(0)
        
Dim SCtranstype As Byte = (1#TRANS TYPE = 1 PER SAC DEVICE PROFILE

        
SC_transmit_channel.assignChannel(SC_Transmit_ChannelNumUCNetNUm#SET TO MASTER CHANNEL
        
SC_transmit_channel.setChannelID(56463False121SCtranstype#56463 is Ben's COMBINED S&C Sensor
        
SC_transmit_channel.setChannelPeriod(8086)
        
SC_transmit_channel.setChannelFreq(ucRF)

        
SC_transmit_channel.openChannel()

        
AddHandler SAC1_Channel.channelResponseAddressOf HandleSC #HANDLER TO RECEIVE DATA 
     
Rank

Total Posts: 5

Joined 2014-11-25

PM

Hi All, just to provide an update, I managed to figure out the error with my code.

Dim SC_transmit_channel As ANT_Channel ANTDevice_0.getChannel(0


This section of code needed to be:

Dim SC_transmit_channel As ANT_Channel ANTDevice_0.getChannel(1


Apparently you need to assign the same channel number to both the slave and master device when initializing the channels. I am not sure I understand the underlying reason behind this, but as soon as i made the switch i started receiving data!