CAT System Computer Control
CODING EXAMPLES
Although Yaesu Musen does not provide CAT con- trol software (owing to the large variety of computers and operating systems used by our customers), the following are a few examples of critical CAT I/O func- tions, in Basic. Note that all variations of Basic may not support some of the commands, in which case alter- nate algorithms may need to be developed to dupli- cate 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. How- ever, 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
PRINT #2,
CHR$(0);CHR$(0);CHR$(0);CHR$(2);CHR$(&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 neces- sary, however. If you decide to send commands through
a
Using the same example as on page 87, the follow- ing command could be used to set the frequency of the display to 14.25000 MHz:
PRINT #2,
CHR$(&H00);CHR$(&H50);CHR$(&H42);CHR$(&H01); CHR$(&HA);
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
Bear in mind that some commands specify “binary,” as opposed to BCD formatted parameters. You can send binary parameters without going through the char- acter/hex string conversion process. For example, the CH parameter in the Command table is a binary value. You could have the
PRINT#2,
CHR$(0);CHR$(0);CHR$(0);CHR$(49);CHR$(2);
Note that we must send 49 to get channel 50, 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 TO 5
MDATA(I) = ASC(INPUT$(1,#2))
NEXT I
Recall from above that the meter data consists of four identical bytes, followed by a filler byte, so we re- ally only need to see one byte to get all of the informa- tion this command offers. Nevertheless, we must read all five bytes (or 1, 16, or 1,863, in the case of the Up- date data). After reading all of the data, we can select the bytes of interest to us from the array (MDATA, in the above example).
| page 93 |