Development

Would you like to control the PIRA32 RDS Encoder from your own application? This section provides some examples and control routines for different environment. Complete reference can be found in the PIRA32 pdf manual.

Have you created any control utility which seems to be useful for other users? Contact us and get individual bonus!

Download
  
Delphi examples Delphi component needed Linux control template

Example1.zip (214 kB)
Example2.zip (234 kB)

Async32.zip (498 kB, D3-D5)
As200d6.zip (441 kB, D6)
Tmsa32.zip (975 kB, trial, D7-D2005, CB5-CB6)

p32linux.zip (2 kB)

First of all install the Async32 component in Delphi. It provides all COM port operations in Delphi as this programming language does not have native support of the COM port. Of course, any other COM port access method may be used in your application.

Example 1 description

The example 1 sends program service name (PS). After clicking on Send button the string from edit box is sent to the RDS encoder and new PS is showed immediately. It's the simplest example possible.

Since the PIRA32 communication works in ASCII text mode using a set of commands, the control is as easy as it can be. We will send a text string to the RDS encoder.

At startup, the COM port is initialized. If the Send button is pressed, this code fragment is executed:

VaComm1.WriteText('PS='+Edit1.Text+CR);
Sleep(500);

The Async32 component will send the PS command followed by "=", the name from formular and carriage return character. In this example we don't check the RDS encoder response (unidirectional communication) so we don't receive the information when the command was processed. Instead of this we wait some time using the Sleep instruction before potential next COM port operations.

When the form is closed, the COM port is closed too.

In the pdf manual you can find the list and description of all commands and try to make more experiments!

Note: Before execute the Example1, make sure the RDS encoder COM speed is set to 2400 Bd and it's connected to COM1. In other case change the values in source code (Unit1.pas) and compile the project again.

Example 2 description

The Example 2 demonstrates advanced communication and includes all procedures needed for implementation in your applications. Big advantage of the PIRA32 is that the COM port is bidirectional. This allows to check if the data transfer was successfull and we can also read the information stored in the RDS encoder. These features are essential for increasing reliability, allow remote control and administration etc.

The demo application works with Program service name and Radiotext 1. It can send these information to the RDS encoder, store them in EEPROM memory and also read them back. After startup, select the COM port and COM port speed. Then press the Send button. If incorrect speed was selected, the application will detect the right speed automatically. The COM port operations are indicated in status bar.

All Send and Read procedures are located in second part of the Unit1.pas file and you may edit them and use in your applications. These procedures are:

procedure SendStart(Sender: TObject);
procedure ReceiveStart(Sender: TObject);
procedure Stop(Sender: TObject);
procedure Send(Command: string);
function Receive(Command: string): string;
procedure SetSpeed(Sender: TObject);

To send any data to the RDS encoder:

SendStart(Form1);
Send('PS='+ps);
Send('RT1='+rt1);
Send('RT1EN=1');
...
Stop(Form1);

To read the data from the RDS encoder:

ReceiveStart(Form1);
ps:=Receive('PS');
rt1:=Receive('RT1');
...
Stop(Form1);

To store the data to EEPROM:

SendStart(Form1);
Send('*PS');
Send('*RT1');
...
Stop(Form1);

Before any operation the COM port must be opened. See the source code for more details.

Any requests and reports are welcome.

How in MS-DOS?

It's not a big problem to control the RDS encoder from old MS-DOS. Of course, you may use any ASCII terminal application but it's also possible to use clean command line!

First of all we configure the appropriate COM port using the MODE command. Then we will redirect the keyboard output to the COM port. All command written now will be sent to the RDS encoder. Press Enter after each command. At the end press Ctrl+C.
If you replace the CON word by a filename, its content will be sent to the RDS encoder. If more than one command is placed in the file, type some spaces before each command to give the RDS encoder a time for processing previous command and send feedback. This simple method doesn't receive any feedback from the RDS encoder.
In a batch file, we can also use for example: echo PS=Hello > com2

(C) 1999-2024 Pira.cz. All rights reserved.