PU2CLR QN8066 Arduino Library 1.3.0
Arduino Library for QN8066Devices - By Ricardo Lima Caratti
Loading...
Searching...
No Matches
TX RDS Setup

Functions

void QN8066::rdsSendRT (char *rt)
 Sends RDS Radio Text Message (group 2A)
 
void QN8066::rdsSetPI (uint16_t pi)
 Sets the Program Identification (PI)
 
uint8_t QN8066::rdsGetPI ()
 Gets the Program Identification (PI)
 
void QN8066::rdsSetPTY (uint16_t pty)
 Sets the Program Type (PTY)
 
uint8_t QN8066::rdsGetPTY ()
 Gets the Program Type (PTY)
 
void QN8066::rdsSetTP (uint16_t tp)
 Sets the Traffic Program.
 
uint8_t QN8066::rdsGetTP ()
 Sets the Traffic Program.
 
char * QN8066::rdsGetPS ()
 Gets the Program Station (Station Name).
 
uint8_t QN8066::rdsGetError ()
 Gets TX RDS error setup.
 
void QN8066::rdsClearBuffer ()
 Clear RDS register (Buffer)
 
void QN8066::rdsSetSyncTime (uint8_t syncTime)
 Sets the wait time for the QN8066 to be available to send the next RDS block.
 
void QN8066::rdsSetRepeatSendGroup (uint8_t count)
 Sets the number of time that a group will be sent at once.
 
void QN8066::rdsSetMode (uint8_t mode)
 Sets RDS Mode Selection.
 
void QN8066::rdsSet4KMode (uint8_t value)
 Sets RDS 4K Mode .
 
void QN8066::rdsSetInterrupt (uint8_t value)
 Sets RDS interrupt.
 
void QN8066::rdsInitTx (uint8_t countryId=0, uint8_t programId=0, uint8_t reference=0, uint8_t pty=1, uint8_t rdsSyncTime=60, uint8_t rdsRepeatGroup=5)
 Sets some RDS parameters.
 
void QN8066::rdsSetPI (uint8_t countryId, uint8_t programId, uint8_t reference=0)
 Sets the Program Identification (PI)
 
void QN8066::rdsTxEnable (bool value)
 Transmitter RDS enable.
 
uint8_t QN8066::rdsSetTxToggle ()
 RDS transmitting ready.
 
bool QN8066::rdsGetTxUpdated ()
 RDS TX Updated.
 
void QN8066::rdsSetFrequencyDerivation (uint8_t freq=6)
 Sets RDS frequency deviation.
 
void QN8066::rdsSetTxLineIn (bool value=0)
 Audio Line-in enable control.
 
void QN8066::rdsSendGroup (RDS_BLOCK1 blockA, RDS_BLOCK2 blockB, RDS_BLOCK3 blockC, RDS_BLOCK4 blockD)
 Sends a RDS group (four blocks) to the QN8066.
 
void QN8066::rdsSetStationName (char *stationName)
 Sets the station name.
 
void QN8066::rdsSendPS (char *ps=NULL)
 Sends the Program Service Message.
 
void QN8066::rdsSendRTMessage (char *rt)
 Sends RDS Radio Text Message (group 2A)
 
int32_t QN8066::calculateMJD (uint16_t year, uint8_t month, uint8_t day)
 Calculates the Modified Julian Date.
 
void QN8066::rdsSendDateTime (uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t min, int8_t offset)
 Sends the RDS Date Time information.
 

Detailed Description

Function Documentation

◆ rdsSendRT()

void QN8066::rdsSendRT ( char *  rt)
inline

Sends RDS Radio Text Message (group 2A)

It is a synonym to rdsSendRTMessage. This function repeats sending a group this->rdsRepeatGroup times.

Parameters
rt- Radio Text (string of 32 character)

Example

#include <QN8066.h>
QN8066 tx;
void setup() {
tx.setup();
tx.setTX(1069); // Set the transmitter to 106.9 MHz
tx.rdsTxEnable(true);
delay(100);
tx.rdsSendRT("IT IS AN EXAMPLE..."); // transmits the message "IT IS AN EXAMPLE..." this->rdsRepeatGroup times
}
void loop() {
}
QN8066 Class.
Definition: QN8066.h:846
void setup(uint16_t xtalDiv=1000, bool mono=false, bool rds=false, uint8_t PreEmphasis=0, uint8_t xtalInj=0, uint8_t imageRejection=1, uint8_t txSoftClipThreshold=0, uint8_t oneMinutOff=3, uint8_t gainTxPLT=9, uint8_t txFreqDev=125, uint8_t rdsLineIn=0, uint8_t rdsFreqDev=60, uint8_t inImpedance=1, uint8_t txAgcDig=0, uint8_t txAgcBuffer=1, uint8_t txSoftClip=0)
QN8066 initial configuration.
Definition: QN8066.cpp:291
void setTX(uint16_t frequency)
Sets the TX mode.
Definition: QN8066.cpp:659
void rdsTxEnable(bool value)
Transmitter RDS enable.
Definition: QN8066.cpp:1566
void rdsSendRT(char *rt)
Sends RDS Radio Text Message (group 2A)
Definition: QN8066.h:1056

References QN8066::rdsSendRTMessage().

◆ rdsSetPI() [1/2]

void QN8066::rdsSetPI ( uint16_t  pi)
inline

Sets the Program Identification (PI)

The Program Identification (PI) code is a critical component of the RDS (Radio Data System) protocol.

It is used to uniquely identify the radio station transmitting the RDS data. The PI code is a 16-bit

value (4 hexadecimal digits) assigned to each station.

PI Code Structure

The PI code is a 16-bit binary value (4 hexadecimal digits), and its structure is as follows:

a) Country Identifier (First 4 Bits) - The first 4 bits of the PI code represent the country identifier.

This helps to differentiate stations in different countries. For example, the code 0x1 might represent

one country, while 0x2 represents another.

b) Program Type (Next 4 Bits) - The next 4 bits indicate the program type. This categorizes the type of content

being broadcast, such as music, news, sports, etc.

c) Program Reference Number (Last 8 Bits) - The last 8 bits provide a unique reference number for the specific

station or program.

You can set the PI code using the rdsSetPI. The are three ways of setting PI code:

rdsInitTx(countryId, programId, reference); rdsSetPI(countryId, programId, reference);

rdsSetPI(piCode);

See also
rdsInitTx

Example

#include <QN8066.h>
QN8066 tx;
uint8_t countryId = 0x1;
uint8_t programId = 0x2;
uint8_t reference = 0x34;
void setup() {
tx.setup();
tx.setTX(1069); // Set the transmitter to 106.9 MHz
...
tx.rdsInitTx(countryId, programId, reference); // You can use this
...
tx.rdsSetPI(countryId, programId, reference); // Or this
...
tx.rdsSetPI(0x1234); // Or this
}
void loop() {
}
void rdsInitTx(uint8_t countryId=0, uint8_t programId=0, uint8_t reference=0, uint8_t pty=1, uint8_t rdsSyncTime=60, uint8_t rdsRepeatGroup=5)
Sets some RDS parameters.
Definition: QN8066.cpp:1520
void rdsSetPI(uint16_t pi)
Sets the Program Identification (PI)
Definition: QN8066.h:1108
Parameters
pi- PI Code
See also
rdsSetPI, rdsInitTx, rdsTxEnable, rdsGetPI, rdsSetPTY, rdsGetPTY, rdsSetTP, rdsGetTP rdsSetSyncTime, rdsSetRepeatSendGroup

◆ rdsGetPI()

uint8_t QN8066::rdsGetPI ( )
inline

Gets the Program Identification (PI)

Parameters
pi- PI Code
See also
rdsSetPI, rdsInitTx, rdsTxEnable, rdsGetPI, rdsSetPTY, rdsGetPTY, rdsSetTP, rdsGetTP rdsSetSyncTime, rdsSetRepeatSendGroup

◆ rdsSetPTY()

void QN8066::rdsSetPTY ( uint16_t  pty)
inline

Sets the Program Type (PTY)

Parameters
pty- Program type
See also
The table of PTY Program Type for RDS and RDBS can be checkd here: https://en.wikipedia.org/wiki/Radio_Data_System
rdsSetPI, rdsInitTx, rdsTxEnable, rdsGetPI, rdsSetPTY, rdsGetPTY, rdsSetTP, rdsGetTP rdsSetSyncTime, rdsSetRepeatSendGroup

◆ rdsGetPTY()

uint8_t QN8066::rdsGetPTY ( )
inline

Gets the Program Type (PTY)

Parameters
pty- Program type
See also
rdsSetPI, rdsInitTx, rdsTxEnable, rdsGetPI, rdsSetPTY, rdsGetPTY, rdsSetTP, rdsGetTP rdsSetSyncTime, rdsSetRepeatSendGroup

◆ rdsSetTP()

void QN8066::rdsSetTP ( uint16_t  tp)
inline

Sets the Traffic Program.

Parameters
tp- tp Code
See also
rdsSetPI, rdsInitTx, rdsTxEnable, rdsGetPI, rdsSetPTY, rdsGetPTY, rdsSetTP, rdsGetTP rdsSetSyncTime, rdsSetRepeatSendGroup

◆ rdsGetTP()

uint8_t QN8066::rdsGetTP ( )
inline

Sets the Traffic Program.

Parameters
tp- tp Code
See also
rdsSetPI, rdsInitTx, rdsTxEnable, rdsGetPI, rdsSetPTY, rdsGetPTY, rdsSetTP, rdsGetTP rdsSetSyncTime, rdsSetRepeatSendGroup

◆ rdsGetPS()

char * QN8066::rdsGetPS ( )
inline

Gets the Program Station (Station Name).

◆ rdsGetError()

uint8_t QN8066::rdsGetError ( )
inline

Gets TX RDS error setup.

◆ rdsClearBuffer()

void QN8066::rdsClearBuffer ( )

Clear RDS register (Buffer)

Clear and Flushes the RDS Buffer.

◆ rdsSetSyncTime()

void QN8066::rdsSetSyncTime ( uint8_t  syncTime)
inline

Sets the wait time for the QN8066 to be available to send the next RDS block.

The default time is 60ms, but depending on the microcontroller you are using, it may be necessary to reduce this time.

Parameters
syncTime- time in ms
See also
rdsSetPI, rdsInitTx, rdsTxEnable, rdsGetPI, rdsSetPTY, rdsGetPTY, rdsSetTP, rdsGetTP rdsSetSyncTime, rdsSetRepeatSendGroup

◆ rdsSetRepeatSendGroup()

void QN8066::rdsSetRepeatSendGroup ( uint8_t  count)
inline

Sets the number of time that a group will be sent at once.

The default value is 5.

Parameters
count- number of times
See also
rdsSetPI, rdsInitTx, rdsTxEnable, rdsGetPI, rdsSetPTY, rdsGetPTY, rdsSetTP, rdsGetTP rdsSetSyncTime, rdsSetRepeatSendGroup

◆ rdsSetMode()

void QN8066::rdsSetMode ( uint8_t  mode)

Sets RDS Mode Selection.

if 0, Received bit-stream have both RDS and MMBS blocks (ā€˜Eā€™ block);

if 1, Received bit-stream has RDS block only, no MMBS block (ā€˜Eā€™ block)

Parameters
mode

Example

#include <QN8066.h>
QN8066 tx;
void setup() {
tx.setup();
tx.setTX(1069); // Set the transmitter to 106.9 MHz
tx.rdsSetMode(0);
}
void loop() {
}
void rdsSetMode(uint8_t mode)
Sets RDS Mode Selection.
Definition: QN8066.cpp:1430

◆ rdsSet4KMode()

void QN8066::rdsSet4KMode ( uint8_t  value)

Sets RDS 4K Mode .

Enable RDS RX/TX 4k Mode: with or without the privacy mode (audio scramble and RDS encryption)

Parameters
value0 or 1

Example

#include <QN8066.h>
QN8066 tx;
void setup() {
tx.setup();
tx.setTX(1069); // Set the transmitter to 106.9 MHz
tx.rdsSet4KMode(0);
}
void loop() {
}
void rdsSet4KMode(uint8_t value)
Sets RDS 4K Mode .
Definition: QN8066.cpp:1456

◆ rdsSetInterrupt()

void QN8066::rdsSetInterrupt ( uint8_t  value)

Sets RDS interrupt.

RDS RX interrupt enable. When RDS_INT_EN=1, a 4.5ms low pulse will be output from pad din (RX mode)

when a new group data is received and stored into RDS0~RDS7 (RX mode).

Parameters
value0 or 1

Example

#include <QN8066.h>
QN8066 tx;
void setup() {
tx.setup();
tx.setTX(1069); // Set the transmitter to 106.9 MHz
}
void loop() {
}
void rdsSetInterrupt(uint8_t value)
Sets RDS interrupt.
Definition: QN8066.cpp:1483

◆ rdsInitTx()

void QN8066::rdsInitTx ( uint8_t  countryId = 0,
uint8_t  programId = 0,
uint8_t  reference = 0,
uint8_t  pty = 1,
uint8_t  rdsSyncTime = 60,
uint8_t  rdsRepeatGroup = 5 
)

Sets some RDS parameters.

Parameters
countryId- Country Identifier (First 4 Bits)
programId- Program Id code
reference- Program Reference Number (8 bits). It provides a unique reference number for the specific station or program.
pty- Program type (PTY) - Default is 1 (News)
rdsSyncTime- Time in ms to wait for sending the next group - Default value is 60 ms
rdsRepeatGroup- Number of times that a RDS group will send at once. - Default is 5.

Example

#include <QN8066.h>
QN8066 tx;
uint8_t countryId = 0;
uint8_t programId = 0;
uint8_t reference = 0;
void setup() {
tx.setup();
tx.setTX(1069); // Set the transmitter to 106.9 MHz
tx.rdsInitTx(countryId, programId, reference);
}
void loop() {
}
See also
rdsSetPI, rdsGetPI, rdsSetPTY, rdsGetPTY, rdsSetTP, rdsGetTP rdsSetSyncTime, rdsSetRepeatSendGroup

◆ rdsSetPI() [2/2]

void QN8066::rdsSetPI ( uint8_t  countryId,
uint8_t  programId,
uint8_t  reference = 0 
)

Sets the Program Identification (PI)

Parameters
countryId- Country Identifier (First 4 Bits)
programId- Program Id code
reference- Program Reference Number (8 bits). It provides a unique reference number for the specific station or program.
See also
rdsSetPI, rdsInitTx, rdsTxEnable, rdsGetPI, rdsSetPTY, rdsGetPTY, rdsSetTP, rdsGetTP rdsSetSyncTime, rdsSetRepeatSendGroup

◆ rdsTxEnable()

void QN8066::rdsTxEnable ( bool  value)

Transmitter RDS enable.

Enable RDS service

Parameters
value(true = enabled; false = disabled)
See also
Pages 20 and 21 of the Datasheet (Register SYSTEM2)

Example

#include <QN8066.h>
QN8066 tx;
void setup() {
tx.setup();
tx.setTX(1069); // Set the transmitter to 106.9 MHz
tx.rdsTxEnable(true);
}
void loop() {
}
See also
rdsSetPI, rdsInitTx, rdsTxEnable, rdsGetPI, rdsSetPTY, rdsGetPTY, rdsSetTP, rdsGetTP rdsSetSyncTime, rdsSetRepeatSendGroup

◆ rdsSetTxToggle()

uint8_t QN8066::rdsSetTxToggle ( )

RDS transmitting ready.

If user want the chip transmitting all the 8 bytes in RDS0~RDS7, user should toggle this bit.

description the chip internally will fetch these bytes after completing transmitting of current group.

See also
Pages 20 and 21 of the Datasheet (Register SYSTEM2)

Example

#include <QN8066.h>
QN8066 tx;
void setup() {
tx.setup();
tx.setTX(1069); // Set the transmitter to 106.9 MHz
tx.rdsTxEnable(true);
...
}
void loop() {
}
uint8_t rdsSetTxToggle()
RDS transmitting ready.
Definition: QN8066.cpp:1595

◆ rdsGetTxUpdated()

bool QN8066::rdsGetTxUpdated ( )

RDS TX Updated.

To transmit the 8 bytes in RDS0~RDS7, user should toggle the register bit RDSRDY (See SYSTEM2 register).

Then the chip internally fetches these bytes after completing transmitting of current group.

Once the chip internally fetched these bytes, it will toggle this bit, and user can write in another group.

Returns
true
false

Example

#include <QN8066.h>
QN8066 tx;
void setup() {
tx.setup();
tx.setTX(1069); // Set the transmitter to 106.9 MHz
tx.rdsTxEnable(true);
...
}
void loop() {
}
bool rdsGetTxUpdated()
RDS TX Updated.
Definition: QN8066.cpp:1626

References QN8066::getStatus3().

◆ rdsSetFrequencyDerivation()

void QN8066::rdsSetFrequencyDerivation ( uint8_t  freq = 6)

Sets RDS frequency deviation.

RDS frequency deviation = 0.35KHz*RDSFDEV in normal mode.

RDS frequency deviation = 0.207KHz*RDSFDEV in 4k mode and private mode.

Parameters
freq( valid values: from 0 to 127)
See also
Datasheet, register RDS (0x26), page 34.

Example

#include <QN8066.h>
QN8066 tx;
void setup() {
tx.setup();
tx.setTX(1069); // Set the transmitter to 106.9 MHz
tx.rdsTxEnable(true);
}
void loop() {
}
void rdsSetFrequencyDerivation(uint8_t freq=6)
Sets RDS frequency deviation.
Definition: QN8066.cpp:1652

◆ rdsSetTxLineIn()

void QN8066::rdsSetTxLineIn ( bool  value = 0)

Audio Line-in enable control.

Parameters
value(true = enabled; false = disabled)
See also
Datasheet, register RDS (0x26), page 34.

Example

#include <QN8066.h>
QN8066 tx;
void setup() {
tx.setup();
tx.setTX(1069); // Set the transmitter to 106.9 MHz
tx.rdsTxEnable(true);
tx.rdsSetTxLineIn(false);
}
void loop() {
}
void rdsSetTxLineIn(bool value=0)
Audio Line-in enable control.
Definition: QN8066.cpp:1679

◆ rdsSendGroup()

void QN8066::rdsSendGroup ( RDS_BLOCK1  block1,
RDS_BLOCK2  block2,
RDS_BLOCK3  block3,
RDS_BLOCK4  block4 
)

Sends a RDS group (four blocks) to the QN8066.

Each block is packaged in 16 bits word (two bytes)

Parameters
block1- RDS_BLOCK1 datatype
block2- RDS_BLOCK2 datatype
block3- RDS_BLOCK3 datatype
block4- RDS_BLOCK4 datatype

References RDS_BLOCK1::byteContent, RDS_BLOCK2::byteContent, RDS_BLOCK3::byteContent, and RDS_BLOCK4::byteContent.

◆ rdsSetStationName()

void QN8066::rdsSetStationName ( char *  stationName)

Sets the station name.

Parameters
stationName

Referenced by QN8066::rdsSendPS().

◆ rdsSendPS()

void QN8066::rdsSendPS ( char *  ps = NULL)

Sends the Program Service Message.

Like rdsSendPS this method sends the Station Name or other 8 char message.

This function repeats sending a group this->rdsRepeatGroup times.

Parameters
ps- String with the name of Station or message limeted to 8 character.

Example

#include <QN8066.h>
QN8066 tx;
void setup() {
tx.setup();
tx.setTX(1069); // Set the transmitter to 106.9 MHz
tx.rdsTxEnable(true);
delay(100);
tx.rdsSendPS("STATIONX"); // transmit "STATIONX" this->rdsRepeatGroup times
}
void loop() {
}
void rdsSendPS(char *ps=NULL)
Sends the Program Service Message.
Definition: QN8066.cpp:1785

References QN8066::rdsSetStationName().

◆ rdsSendRTMessage()

void QN8066::rdsSendRTMessage ( char *  rt)

Sends RDS Radio Text Message (group 2A)

This function repeats sending a group this->rdsRepeatGroup times.

Parameters
rt- Radio Text (string of 32 character)

Example

#include <QN8066.h>
QN8066 tx;
void setup() {
tx.setup();
tx.setTX(1069); // Set the transmitter to 106.9 MHz
tx.rdsTxEnable(true);
delay(100);
tx.rdsSendRTMessage("IT IS AN EXAMPLE..."); // transmits the message "IT IS AN EXAMPLE..." this->rdsRepeatGroup times
}
void loop() {
}
void rdsSendRTMessage(char *rt)
Sends RDS Radio Text Message (group 2A)
Definition: QN8066.cpp:1844

Referenced by QN8066::rdsSendRT().

◆ calculateMJD()

int32_t QN8066::calculateMJD ( uint16_t  year,
uint8_t  month,
uint8_t  day 
)

Calculates the Modified Julian Date.

Parameters
year
month
day
Returns
int32_t
See also
https://gssc.esa.int/navipedia/index.php/Julian_Date
https://quasar.as.utexas.edu/BillInfo/JulianDatesG.html

◆ rdsSendDateTime()

void QN8066::rdsSendDateTime ( uint16_t  year,
uint8_t  month,
uint8_t  day,
uint8_t  hour,
uint8_t  min,
int8_t  offset 
)

Sends the RDS Date Time information.

To use this function (service), you will need to add an integrated clock to your system that provides

the date and time to the system.

Parameters
year
month
day
hour
min
offset
Todo:
Under construction

References RDS_BLOCK3::byteContent.