Coding Examples - Yaesu FT-1000 Operating Manual

Hide thumbs Also See for FT-1000:
Table of Contents

Advertisement

5. CAT System Computer Control
Read Flags Data
The Read Flags command retrieves the three Flag
Bytes (and two padding bytes) without having to read
the entire 1,636-byte Update Status. The transceiver
responds to the Read Flags command by returning the
Flag Bytes described on the preceding page, plus two
additional bytes with the constant values of 10h and
21h (in that order), as shown here:
Flags Byte 1 | Flags Byte 2 | Flags Byte 3 | Dummy (10h)
Read Meter Data
Sending the Read Meter command causes the com- .
puter to return a digitized meter deflection indication,
between 0 and OFFh (in practice, the highest value
returned will be around OFOh). Four copies of this value
are returned, along with one padding byte (OF7h), as
follows:
Meter Byte | Meter Byte | Meter Byte | Meter Byte
OF7h
During reception, the signal strength deflection is
returned. During transmission, the parameter repre-
sented by the reading returned depends on the setting
of the METER switch.
Coding Examples
Although Yaesu Musen Company cannot offer to
provide complete CAT control programs (owing to the
large variety of incompatible computers used by our
customers), following are a few examples of critical
CAT i/o functions, in Basic. Note that all variations of
Basic may not support some of the commands, in
which case alternate algorithms may need to be devel-
oped to duplicate the functions of those shown.
Sending a Command
After "opening" the computer's serial port for 4800-
baud, 8 data bits and 2 stop bits with no parity, as i/o
device #2, any CAT command may be sent. However,
if you determine that your computer may need extra
time to process data returned from the transceiver, you
should send the Pacing command first. Here is an
example of the Pacing command setting a 2-ms delay:
PRINT #2, CHR$(0) ;CHR$(0) ;CHR$ (0) ;CHR$ (2) sCHR$ (HE) ;
Notice that the instruction opcode is sent last, with
the first (MSB) parameter sent just before it, and the
LSB parameter (or dummies) sent first. This means that
the parameters are sent in the reverse order from that in
which they appear in the CAT Commands table. Also
note that in this and the following examples, we are
sending zeros as dummy bytes: this is not necessary,
however. If you decide to send commands through a
5-byte array, they values of the dummy parameters
need not be cleared.
Using the same example as on page 36, the follow-
ing command could be used to set the frequency of the
display to 14.25000 MHz:
PRINT #2, CHR$(&HOO); CHR$(&H50);
CHR$(&H42); CHRS(8HO1); CHR$ (AHA) ;
Notice here that the BCD values can be sent just by
preceding the decimal digits with "&H" in this ex-
ample. However, in an actual program, it may be pref-
erable to convert the decimal frequency variable in the
program to an ASCII string, and then to convert the
string to characters through a lookup table.
If you send a parameter that is out of range for the
intended function, or not among the specified legal
values for that function, the FT-1000 should do no-
thing. Therefore, you may wish to alternate your sen-
ding regular commands or command groups with the
Read Flags command (and occasionally even the Up-
date command),
allowing the transceiver to let the
computer know if everything sent so far has been ac-
cepted and acted upon as expected.
Bear in mind that some commands specify "bi-
nary", as opposed to BCD formatted parameters. You
can send binary parameters without going through the
character/hex string conversion process. For example,
the CH parameter in the Command table is a binary
value. You could have the FT-1000 recall memory
channel 50 (decimal) by the following:
PRINT #2, CHR$(0) ;CHR$ (0) ;CHR$ (0) ;CHRS (49) ;CHR$ (2);
Note that we have to send 49 to get channel SO, since
the channel numbers in the command
start from 0,
while those on the display start with 1.
Reading Returned Data
The reading process is easily done through a loop,
storing incoming data into an array, which can then be
processed after the entire array has been read. To read
the meter:
FOR I=1 10 5
eer
= ASC(INPUT$(1,#2))
Recall from above that the meter data consists of
four identical bytes, followed by a filler byte, so we
really only need to see one byte to get all of the infor-
mation this command offers. Nevertheless, we must
read all five bytes (or 1,636, in the case of the Update
data). After reading all of the data, we can select the
bytes of interest to us from the array (MDATA, in the
above example).
eee
pag 39

Advertisement

Table of Contents
loading

Table of Contents