5.6 YAESU5 configuration - frequency - FT818 example
You need to first look at the documentation on ASCII command masks.
The outgoing commands for all YAESU5 radios are five bytes:
- four bytes of optional bcd (binary coded decimal) data
- following by a hexadecimal opcode byte.
- The readbytes and setbytes fields are always set to 10 (ie: 10 chars generating 5 bytes)
Set frequency - FT818 example
The manual specifies the frequency in four bytes: P1 P2 P3 P4 followed by opcode = 01
(Be aware that the FT920 manual notation is reversed, ie: P4 P3 P2 P1 Opcode)
Thus: 01 42 34 56 01 will set 14.234560 MHz (frequency resolution = 10 Hz)
We configure this in the catcodes table as: setmask = gfedcmht01
ie: ten ascii characters which will be translated into five bytes.
In detail: gf ed cd ht 01. t is replaced by tens, h by hundreds, m by thousands
(Note that there is no u = units because the resolution is 10Hz )
With YAESU5, the setbytes field is ALWAYS set to 10.
14.234560 MHz from piWebCAT's tuner will result in a ten char ascii string = '0142345601'
The server (with YAESU5 selected) will convert this to five bytes 01 42 34 56 01
Changing band
Note that The YAESU5 radios appear to have no band selecting command.
So we also have to use frequency setting to change band with the user's choice of initial frequency.
Below are the frequency configurations in the catcodes table.
Frequency setting will be driven from:
- piWebCAT's tuner OR
- the band sector buttons configured as a group in the buttons table.
Note that for tuner operation, the frequency read message to the server are internally generated from the tuner.
They must use code = FREQ in the catcodes table (which defines the server response)
For band changing, the FREQ commands to the server are generated by the grouped BAND buttons.
At the server, they are handled by the same catcodes records as the tuner generated commands.
Read frequency ( and mode) FT818 example
The above image shows the readmask for frequency reading as 0000000003.
The manual specifies five bytes: * * * * 03 (where * = don't care )
So we enter ten characters 0000000003
These ten characters are transmitted to the server and translate to bytes 00 00 00 00 03.
The ten characters are sent to the server verbatim:
- as is any character that is not in the reserved lower case mask set: g f e d c m h t u s x
Handling data frequency data read from the radio - This is relevant to all YAESU5 data reads
The FT920 frequency read response is 28 bytes. If this were handled in one operation the answermask
would be 56 characters in length on the basis of two characters per byte. We don't do this !
We therefore use an answermask format of the form #BB:SS:CC:MM:gfedcmht (no u = units here)
- BB is the total size of the bytes block to be read (The server needs this - it will wait for them or timeout)
- SS is the start position in the block of our data (zero indexed)
- CC in the count = size of our extract from the block
- MM is a hexadecimal bit mask which may be applied to single byte data.
- gfedcmht is the actual mask to transform the CC bytes into 2 x CC characters
FT818 frequency read - we extract 4 bytes from a 5 byte received data block
CC= 04, and the mask is gfedcmht. The server will interpret the four bytes as binary coded decimal data
and transform them into a matching 8 character decimal string. eg: 02 81 23 45 > 28.123.450 MHz.
FT920 frequency read - see below - we extract 4 bytes from a 28 byte received data block.
CC= 04, and the mask is bbbbbbbb. The server will interpret the four byes as binary data and perform a
binary to decimal conversion, eg: 00 2A E9 B9 > 2812345 > 28.123.450 MHz