RDS Encoder

  

 

Development

Would you like to control the Magic RDS Module from your own application? This section shows you how to do it using the magicrds.dll driver.
  
Download (v. 1.1)
  

Magicdll.zip (212 kB)  

Current DLL version is 1.1.

function PortIni (Port: integer; Slow, Invert:boolean): Boolean; stdcall;
function SetTimeDate (CTChng: Boolean; UTCOffset: Integer): Boolean; stdcall;
function SendProgram (PSTA0, PSTA1, PI: string; TP: Boolean; PTY: integer; DPS1Chng, DPS2Chng, DPSDelay, TA, RTEn, NumRT, PINEn, ECCEn: Boolean; ECC: byte; PIND, PINH, PINM: integer; DataGroups: array of byte; DGNum: integer; AF: array of string; MS: boolean; DI: array of boolean): Boolean; stdcall;
function SendTA (DPS1Chng, DPS2Chng, DPSDelay, TA, RTEn, NumRT: boolean): Boolean; stdcall;
function SendSystem (PINEn, ECCEn: Boolean; ECC: byte; PIND, PINH, PINM: integer; DataGroups: array of byte; DGNum: integer; AF: array of string; MS: boolean; DI: array of boolean): Boolean; stdcall;
function SendDPS1 (DPS1Chng, DPS2Chng, DPSDelay, TA, RTEn, NumRT, DPS1En: Boolean; DPS1: array of string; DPS1Num, DPS1Per: integer): Boolean; stdcall;
function SendDPS2 (DPS1Chng, DPS2Chng, DPSDelay, TA, RTEn, NumRT, DPS2En: Boolean; DPS2: array of string; DPS2Num, DPS2Per: integer): Boolean; stdcall;
function SendRadiotext (RT1, RT2: string; RTDelay: integer; DPS1Chng, DPS2Chng, DPSDelay, TA, RTEn, NumRT, RTRC, RT2B: boolean): Boolean; stdcall;
function SendDataGroups (PINEn, ECCEn: Boolean; ECC: byte; PIND, PINH, PINM: integer; DataGroups: array of byte; DGNum: integer): Boolean; stdcall;
function SendAll (PSTA0, PSTA1, PI: string; TP: Boolean; PTY: integer; DPS1Chng, DPS2Chng, DPSDelay, TA, RTEn, NumRT: boolean; PINEn, ECCEn: Boolean; ECC: byte; PIND, PINH, PINM: integer; DataGroups: array of byte; DGNum: integer; AF: array of string; MS: boolean; DI: array of boolean; DPS1En: Boolean; DPS1: array of string; DPS1Num, DPS1Per: integer; DPS2En: Boolean; DPS2: array of string; DPS2Num, DPS2Per: integer; RT1, RT2: string; RTDelay: integer; RTRC, RT2B: boolean): Boolean; stdcall;
function PortClose: Boolean; stdcall;

function Version: string; stdcall;

All functions except the Version return true if an error occured. In other cases return false.
The PortIni should be the first function called from the DLL. The PortClose should be the last. The Version can be called at any time.

Most of variables have their equivalents in the Magic RDS control software.

Declaration Range Description
Port: integer 1-4, 16-65535 Port number. 1-4 for COM1-COM4. 888 (0x378) for LPT1.
Slow, Invert: boolean   Port options. Defaultly false, false.
CTChng: boolean   Change of this bit tells the RDS encoder that the time changed or the time starts to be transmitted. The time information is read from PC system time.
UTCOffset: integer -13-13 Local UTC time offset.
PSTA0, PSTA1: string max. 8 char. each Default and traffic Program Service name.
PI: string 4 char. 0-9, A-F Program Identification code.
TP: boolean   Traffic Program.
PTY: integer 0-31 Program Type.
DPS1Chng: boolean   Change of this bit tells the RDS encoder that the Dynamic PS 1 loop has to be transmitted from beggin.
DPS2Chng: boolean   Change of this bit tells the RDS encoder that the Dynamic PS 2 loop has to be transmitted from beggin.
DPSDelay: boolean   Delay between DPS labels. False for 2.1 sec., true for 4.2 sec.
TA: boolean   Traffic Announcement.
RTEn: boolean   Radiotext feature enabled.
RTNum: boolean   Number of Radiotexts. False for 1, true for 2.
PINEn: boolean   Program-Item Number enabled.
ECCEn: boolean   Extended Country Code enabled.
ECC: byte 0-255 Extended Country Code byte.
PIND: integer 1-31 Program-Item Number - Day
PINH: integer 0-23 Program-Item Number - Hour
PINM: integer 0-59 Program-Item Number - Minute
DataGroups: array [0..X] of byte X: 0, 5, 11, 17, 23, 29, 35, 41, 47 Data Groups, 3x 2 bytes each.
DGNum: integer 0-8 (0-7) Number of Data Groups. If PIN or ECC is enabled, max. 7 Data Groups can be used.
AF: array [0..6] of string   Alternative Frequencies.
MS: boolean   Music or Speech.
DI: array [0..3] of boolean   Decoder Identification.
DPS1: array [0..X] of string X: 0-31 Dynamic PS 1 labels.
DPS1Num: integer 0-32 Number of DPS1 labels.
DPS1Per: integer 0-255 Delay between DPS loops.
DPS2: array [0..X] of string X: 0-31 Dynamic PS 2 labels.
DPS2Num: integer 0-32 Number of DPS2 labels.
DPS2Per: integer 0-255 Delay between DPS loops.
RT1, RT2: string max. 64 char. each Radiotext 1 and 2.
RTDelay: integer 0-255 Delay between two Radiotexts (if two Radiotexts are used).
RTRC: boolean   Reduced RT character transmission.
RT2B: boolean   Radiotext 2 is type B.

  

program Project1;

uses
Dialogs;

function SendProgram(PSTA0,PSTA1,PI:string;

TP:Boolean; PTY:integer; DPS1Chng,DPS2Chng,DPSDelay,
TA,RTEn,NumRT, PINEn,ECCEn: Boolean; ECC: byte;
PIND,PINH,PINM: integer; DataGroups: array of byte;
DGNum: integer; AF: array of string;
MS: boolean; DI: array of boolean): Boolean; stdcall;
external 'magicrds.dll' name 'SendProgram';


function PortIni(Port: integer; Slow,Invert:boolean): Boolean; stdcall;
external 'magicrds.dll' name 'PortIni';


function PortClose: Boolean; stdcall;
external 'magicrds.dll' name 'PortClose';

var
DataGroups: array [0..47] of byte;
AF: array [0..6] of string = ('87.7','88.0','89.8','98.8','99.8','99.9','107.8');
DI: array [0..3] of boolean;

begin
if (PortIni(888,False,False)) then
  begin ShowMessage('PortIni: Error'); Exit; end
  else ShowMessage('PortIni: OK');
if (SendProgram('OCEAN_FM','Traffic','20F3',True,3,True,True,

  False,False,False,False,False,False,0,1,0,0,DataGroups,
  0,AF,True,DI)) then
    ShowMessage('SendProgram: Error')
    else ShowMessage('SendProgram: OK');
PortClose;
end.

  • The DLL uses standard calling conventions so it should be easy to call the functions from any 32bit Windows programming language. See help or find some examples.
  • The DLL and also included SYS port driver must be distributed with your application.

  

(C) 1999-2005 PiRa. All rights reserved.