This article applies to:
DolphinAPI
I am using radio_getRSSI but I would like to convert the values to dBm. How can I do it with the API ?
You can use the radio_rssiToDbm_asm. In your source code add the definition of the function as shown below:
definition
/************************************************************************************************************************//*! Calculates dBm from RSSI based on the calibration values in radio init specified by array u8RssiCalib. \param RSSI signal where the LSB bit is the LNA \return dBm value, <b>Number of nested functions:</b> -\n <b>Typical execution time:</b> -us \note This value is supposed to be interpreted as a negative value although the function returns an unsigned value \sa radio_getRSSI **************************************************************************************************************************/ uint8 radio_rssiToDbm_asm(uint16 u16RssiLna);
With the result uin16 value call the function radio_rssiToDbm_asm and you will get the dBm result. This function is already defined in the API Version 2.2.0.0.
EXAMPLE CODE:
This example shows how to get the LongTerm RSSI and transmit it through the UART.
#include "EO3000I_API.h"
#include "EO3000I_CFG.h"
#include "stdio.h"
#include "string.h"
uint8 radio_rssiToDbm_asm(uint16 u16RssiLna);
void main()
{
uint16 pu16StRssi, pu16LtRssi;
uint8 u8Buff[30];
uint8 u8dBmLtRssi;
mainInit();
radio_enableRx(1);
while(1)
{
radio_getRSSI (&pu16StRssi, &pu16LtRssi);
u8dBmLtRssi = radio_rssiToDbm_asm(pu16LtRssi);
sprintf(u8Buff,"Long Term RSSI: %u dBm\n", (uint16)u8dBmLtRssi);
while (uart_sendBuffer(u8Buff, strlen(u8Buff))!=OK);
time_wait(500);
}
}
// Generated with DolphinStudio 2.0.0.13 which was compiled on Jun 2 2010 05:10:30 //Generated on 24.01.2011 14:48 by DolphinStudio 2.1.1.0 #ifndef _EO3000I_CFG_H_INCLUDED #define _EO3000I_CFG_H_INCLUDED #include "EO3000I_API.h" //! Function Prototypes void radio_init_asm(RADIO_INIT_PARAM u8PowerUp); void startupInit(); void mainInit(); //*********************UART PARAM*************************** //! UART Rx/Tx buffers allocation #define RX_RING_SIZE 34 #define TX_RING_SIZE 34 extern volatile uint8 xdata u8RxRing[RX_RING_SIZE]; extern volatile uint8 xdata u8TxRing[TX_RING_SIZE]; extern uint8 uart_param[]; //*********************RADIO PARAM*************************** #define RADIO_BUFF_NUM 10 #define RADIO_MATURITY_TIME 100 //! Radio buffers allocation extern volatile uint8 xdata u8gRadioBuff[RADIO_BUFF_NUM][RADIO_BUFF_LENGTH]; //! Radio tx buffers additional allocation for state extern volatile uint8 xdata u8gRadioBuffTXState[RADIO_BUFF_NUM]; //! Radio flags extern volatile uint8 idata u8gFlags[RADIO_BUFF_NUM]; //! buffers Rx subtelegrams counters. Index indicates the buffer number. extern volatile uint8 idata u8gRadioBuffsRxSubtel[RADIO_BUFF_NUM]; //! buffers Tx subtelegrams counters. Index indicates the buffer number. extern volatile uint8 idata u8gRadioBuffsTxSubtel[RADIO_BUFF_NUM]; //! buffers time stamp counters. Index indicates the buffer number. extern volatile uint8 idata u8gRadioBuffsTimeStamp[RADIO_BUFF_NUM]; //! buffers received bytes counters. Index indicates the buffer number. extern volatile uint8 idata u8gRadioBuffsBytes[RADIO_BUFF_NUM]; //! buffers dBm values. Value indicating signal strength upon telegram reception. extern volatile uint8 xdata u8gRxRadioBuffsDbm[RADIO_BUFF_NUM]; //! Tx buffers time to send subtelegram. Index indicates the buffer number. extern volatile uint8 idata u8gTxRadioBuffsTimeToSend[RADIO_BUFF_NUM]; //*********************FILTER PARAM*************************** //! Max. number of filters #define FILTER_NUM 4 //! Filter buffer allocation for value of filter extern volatile uint32 xdata u32gFilterValue[FILTER_NUM]; //! Filter buffer allocation containing FILTER_TYPE (Bit 0..1 and FILTER_KIND Bit 7) extern volatile uint8 xdata u8gFilterCfg[FILTER_NUM]; extern uint8 filter_param[]; //*********************IO PARAM*************************** extern uint8 code io_param[]; #endif //_EO3000I_CFG_H_INCLUDED
//Generated on 24.01.2011 14:48 by DolphinStudio 2.1.1.0
#include "EO3000I_CFG.h"
//*********************API INIT***************************
//Note: Function is called from startup.a51. Global variables are not yet initialized!
void startupInit()
{
pwr_enableXTAL(DEFAULT_DELAY);
io_init(io_param);
}
//Note: Function is called from main()
void mainInit()
{
radio_init_asm(CFG_ALL);
radio_init(RADIO_BUFF_NUM, RADIO_MATURITY_TIME);
UART_INIT(uart_param, SET_ALL_PARAM);
isr_timer0Init();
misc_init();
pwr_selectXTAL();
ISD51_INIT(BAUD_57600);
}
//*********************UART PARAM***************************
//! UART Rx/Tx buffers allocation
volatile uint8 xdata u8RxRing[RX_RING_SIZE];
volatile uint8 xdata u8TxRing[TX_RING_SIZE];
uint8 uart_param[] = {
BAUD_9600, //IDX_BAUD
RX_RING_SIZE, //IDX_RX_RING_SIZE
TX_RING_SIZE, //IDX_TX_RING_SIZE
};
//*********************RADIO PARAM***************************
//! Radio buffers allocation
volatile uint8 xdata u8gRadioBuff[RADIO_BUFF_NUM][RADIO_BUFF_LENGTH];
//! Radio tx buffers additional allocation for state
volatile uint8 xdata u8gRadioBuffTXState[RADIO_BUFF_NUM];
//! Radio flags
volatile uint8 idata u8gFlags[RADIO_BUFF_NUM];
//! buffers Rx subtelegrams counters. Index indicates the buffer number.
volatile uint8 idata u8gRadioBuffsRxSubtel[RADIO_BUFF_NUM];
//! buffers Tx subtelegrams counters. Index indicates the buffer number.
volatile uint8 idata u8gRadioBuffsTxSubtel[RADIO_BUFF_NUM];
//! buffers time stamp counters. Index indicates the buffer number.
volatile uint8 idata u8gRadioBuffsTimeStamp[RADIO_BUFF_NUM];
//! buffers received bytes counters. Index indicates the buffer number.
volatile uint8 idata u8gRadioBuffsBytes[RADIO_BUFF_NUM];
//! buffers dBm values. Value indicating signal strength upon telegram reception.
volatile uint8 xdata u8gRxRadioBuffsDbm[RADIO_BUFF_NUM];
//! Tx buffers time to send subtelegram. Index indicates the buffer number.
volatile uint8 idata u8gTxRadioBuffsTimeToSend[RADIO_BUFF_NUM];
//*********************FILTER PARAM***************************
//! Filter buffer allocation for value of filter
volatile uint32 xdata u32gFilterValue[FILTER_NUM];
//! Filter buffer allocation containing FILTER_TYPE (Bit 0..1 and FILTER_KIND Bit 7)
volatile uint8 xdata u8gFilterCfg[FILTER_NUM];
uint8 filter_param[] = {
FILTER_NUM, //IDX_FILTER_MAX
FILTER_ALL_AND //IDX_FILTER_OPERATOR
};
//*********************IO PARAM***************************
uint8 code io_param[] = {
0x07, //IDX_GPIO_CONF
0x00, //IDX_GPIO0_CONF
0x0E, //IDX_GPIO0_PULL_CONF
0x01, //IDX_GPIO0_DIR
0x00, //IDX_GPIO1_AN
0xC0, //IDX_GPIO1_CONF
0x03, //IDX_GPIO1_DIG_CONF
0x80, //IDX_GPIO1_DIR
0x7F, //IDX_GPIO1_PULL
0x04, //IDX_GPIO2_CONF
0x00, //IDX_GPIO2_DIR
0x00, //IDX_GPIO0
0x00, //IDX_GPIO1
0x00 //IDX_GPIO2
};
// I/O Configuration overview
//
// Pin: Interface Direction Pull Init Value
// SCSEDIO0: Digital I/O Out None 0
// SCLKDIO1: Digital I/O In Up 0
// WSDADIO2: Digital I/O In Up 0
// RSDADIO3: Digital I/O In Up 0
// ADIO0: Digital I/O In Up 0
// ADIO1: Digital I/O In Up 0
// ADIO2: Digital I/O In Up 0
// ADIO3: Digital I/O In Up 0
// ADIO4: Digital I/O In Up 0
// ADIO5: Digital I/O In Up 0
// ADIO6: UART In Up 0
// ADIO7: UART Out None 0
// WXIDIO: Digital I/O In Up 0
// WXODIO: Digital I/O In Up
// WAKE0: Digital I/O In None
// WAKE1: Digital I/O In None
FAQ Single Template
Finden Sie den richtigen Händler für unsere Module, Komponenten und Endprodukte in Ihrer Region!

Der EnOcean-Newsletter informiert Sie regelmäßig über spannende Projekte aus den Bereichen IoT und Smart Building sowie über aktuelle Veranstaltungen und neue Produkte.
© 2025 EnOcean GmbH. Alle Rechte vorbehalten.