User Tools

Site Tools


k20:k20.3:k20.3.3:start

20.3.3 Timer projects 3

20.3.3.1 Example 10 - Extended Timer

Example 10 assumes the following technical situation:

An application queries the frequency of an amateur radio receiver (RX) - here in the 20m band - at intervals of 100-ms via a serial interface. A separate transmitter (TX) is to be set to the current RX frequency according to the following approach:

  • As long as the RX frequency is changed on the RX with the rotary knob, the set TX frequency remains unchanged.
  • Only if the new RX frequency remained constant for more than 1 second, the TX frequency is pulled to the current RX frequency after this second - synchronised with it.
  • An LED signals the synchronisation status with the two colours green and red.

RX-TX

Figure 20.3.3.1.1: Digital frequency display → RX and TX synchronised.

Source code excerpt from the above application (realisation Extended Timer):

Public Sub Form_Open()
  FMain.Center()
  FMain.Resizable = False
  Dial1.MinValue = 14000000
  Dial1.MaxValue = 14355000
  Dial1.PageStep = 1000
  Dial1.Step = 100
  Dial1.Value = 14325200
  Dial1.Wrap = True
  LCDLabel.Alignment = Align.Center
  LCDLabel.Border = True
  LCDLabel.Background = &HC3DDFF&
  LCDLabel.Foreground = &H0000FF&
  SetLEDColor("green")
  syncTimer.Delay = 1000
 
End
 
Public Sub Dial1_Change()
  LCDLabel.Text = Format(Dial1.Value, "00,000000")
  syncTimer.Stop()
  syncTimer.Start()
  SetLEDColor("red")
End
 
Public Sub syncTimer_Timer()
  syncTimer.Stop()
  SetLEDColor("green")
End
 
Public Sub SetLEDColor(sLEDColor As String)
  PictureBox1.Picture = Picture["LED/led_" & sLEDColor & ".svg"]
End
 
Public Sub Form_Close()
  If syncTimer.Enabled = True Then syncTimer.Stop
End
  • If the event Dial1_Change occurs - the RX frequency is changed - the syncTimer is stopped and immediately restarted, which again means a full second clock time for the syncTimer.
  • If the Dial1_Change event does not__ occur within the timer's delay period, then the syncTimer_Timer() event is triggered and both transmitter and receiver frequencies are synchronised.

Download

The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k20/k20.3/k20.3.3/start.txt · Last modified: 21.10.2023 by emma

Page Tools