You must periodically direct your FT897 to send you its VFO frequency, VFO mode, and S-meter.
The commands to do this are described on page 62 of you FT-897 manual.
Sending the "Read Frequency and Mode Status" command (opcode 03, incorrectly called "Read RX Status" in the table) will cause the FT-897 to send you 5 bytes into which the frequency and mode are encoded, as shown in Note 5 on page 62. The four bytes containing frequency are binary-coded decimal (BCD), as illustrated in Note 5. The mode byte is a simple hex encoding.
Sending the "Read RX Status" command (opcode E7) will cause the FT-897 to send you a byte containing the S-meter data in its low-order 4 bits, as shown in Note 3 on page 62.
The code I use to open a serial port using the MSCOMM control is appended below.
You may find it helpful to download Commander, a free transceiver control application that besides handling most Yaesu, Kenwood, Icom, and TenTec transceivers will display all transceiver control messages in either Hex, Decimal, or Ascii; given the poor quality of Yaesu's documentation -- this will save you some trial-and-error. Commander is available via
www.qsl.net/dxlab .
73,
Dave, AA6YQ
Const ReceiveBufferLen = 1024
Const TransmitBufferLen = 1024
Sub OpenPort(Port As Integer, Speed As Long, Parity As String, WordLength As String, StopBits As String, DTRControl As Integer, RTSControl As Integer)
Dim CommString As String
Dim ErrorMessage As String
On Error GoTo Abort
If Port = 0 Then Exit Sub
If Opened Then CommControl.PortOpen = False 'reconfigure
CommControl.CommPort = Port
CommControl.DTREnable = ModemControlEnabled(DTRControl)
CIVComm.ConfigureRTS (RTSControl)
CommControl.InBufferSize = ReceiveBufferLen
CommControl.InputLen = 0 'get everything received
CommControl.NullDiscard = False
CommControl.InputMode = comInputModeText 'get strings
CommControl.RThreshold = 1 'enable receive events
CommControl.OutBufferCount = 0 'clear the output buffer
CommControl.OutBufferSize = TransmitBufferLen
CommControl.SThreshold = 0 'disable transmit events
CommControl.InBufferCount = 0 'flush anything laying around from before
CommString = Format$(Speed) + "," + Parity + "," + WordLength + "," + StopBits
'Debug.Print CommString
CommControl.Settings = CommString
CommControl.EOFEnable = False
CommControl.Handshaking = comNone
On Error GoTo OpenFailed
CommControl.PortOpen = True 'try opening the port
On Error GoTo Abort
Opened = True
CIVModule.SetCommCaption ""
CIVModule.UpdateCaption
Exit Sub
OpenFailed:
If Err.Number = 8005 Then
CIVModule.SetCommCaption " - selected Com port already in use"
CIVModule.UpdateCaption
MsgBox "Already in use", vbOKOnly, "Unable to open Com" + Format$(Port)
Opened = False
Else
ErrorMessage = Err.Description + " (" + Format$(Err.Number) + "), port = " + Format$(Port) + ", settings = " + CommString
CIVModule.SetCommCaption " - selected Com port failed to open: " + Err.Description
CIVModule.UpdateCaption
MsgBox ErrorMessage, vbOKOnly, "Unable to open Com" + Format$(Port)
Opened = False
End If
Exit Sub
Abort:
Common.ProgramError Err.Number, "CIVComm.OpenPort"
End Sub