Using the Serial Port for Time Correction


Introduction: SDR can use one of the serial ports to keep the time synchronized to another computer system. This other system could be another SDR system that has the WWV time option, or some other computer that has accurate timing.
SDR to SDR Connection: If you need more then 6 channels you will need to run two or more SDR systems. One way of synchronizing the time is to connect a serial cable between the systems. You will need to use a NULL Modem connector to swap the transmitter and receiver signal lines. The first system should have the WWV time option or have one serial port connected to another computer system that has accurate time (see below). This system would have one or both serial ports set to act as a time server.

Setting SDR as a Time Server:

Under the F6 settings you will see the option Time Server Port 1 and Timer Server Port 2 menu items. Select Yes to one or both ports if you are going to control two systems.

Setting SDR to Receive Time:

The SDR systems the will be receiving the time information should select Set Time Using Comm Port to port 1 or 2 depending on what Comm port you will be using on the system.

Using Another Computer as a Time source: SDR can use another computer as a source of accurate time by using one of the serial ports to receive time information. You must first go to the F6 settings screen and set the Set Time Using Comm Port to a 1 or 2. You will need to write a program on the system that will be sending the time to SDR. It should do the following:

  • 1: Open the Comm port that will be connect to the system running SDR. The Comm port configuration should be: 19.2k Baud 8 Bits No Parity.
  • 2: The program should wait for an uppercase T character sent by SDR. SDR will send the T character when it first starts up and then every 15 minutes. You can also use the keyboard to force a time check by press the P key in SDR's main screen.
  • 3: Your program then needs to read the system time and convert it to the number of milliseconds past midnight local time. If for some reason the system does not know the current time you should set the time variable to -1.
  • 4: You then send the time over the serial link as a LONG, a four byte integer in the Intel byte order. SDR will read the 4 bytes and check it against its internal time. If there is more then 10 milliseconds difference, SDR will correct its internal time to the reference time.
  • 5: Loop to #2 and wait for the next T character.

Note: You may need a Null Modem connector between the SDR system and your time reference system.

Using SDR as a Time Source: If SDR has the WWV option, or the other serial port is connected to a time reference, you can request the current time from SDR. You must set one of the serial ports as a time server under the F6 settings. You then need to write a program that does the following:

  • 1: Open the Comm port that will be connect to the system running SDR. The Comm port configuration should be: 19.2k Baud 8 Bits No Parity.
  • 2: Send an uppercase T character out the serial port.
  • 3: Wait for 4 characters from the serial port.
  • 4: Convert the 4 bytes received to a LONG, 4 byte integer. If you are on a system that has a different byte order then the Intel format you will have to swap the bytes first. The LONG variable has the time in milliseconds past midnight.
  • 5: Set the system time if the LONG variable is not a -1.
  • 6: Wait some period of time and then loop to #2.

Note: Remember to check for a -1. SDR will send a -1 if its time is not lock to WWV or some other reference.

[ Top ] [ Next ] [ SDR Help ]

Larry Cochrane -