Serial instruction codes

Hello,
I am considering using an arduino nano to act as a radio control device sending serial data to a radio when various buttons are pressed.
I have not yet tried to send serial data out to a peripheral other than Serial.print

Here are the instructions I have for this operation.
The code table can be provided later if necessary.
If I can get this up and running, I would like to try to implement variable resistors for the volume and squelch functions automatically sensing the change in voltage to send the appropriate codes for the function needed.

PCC Data Protocol

Serial TTL data (0/+5V) at 9600 bps is sent via the
DATA IN & DATA GND pins of the DATA jack. Each
byte consists of one start bit, 8 data bits, no parity
and two stop bits. All transceiver settings can be
configured by sending commands in hexadecimal
code to the transceiver CPU via the FIF-232C interface.

The coding table on the next page lists all
functions with the corresponding hexadecimal code.
Using the PCC Command Coding Table
First choose which function you wish to emulate.
Next, note its corresponding hexadecimal code. For
example, to activate the Spectra-Analyzer, a hex
code of 19h must be sent. Before starting, PCC
operation must first be enabled by sending the PCC
ON command (AAh); afterwards, following PCC
commands take effect. Note that up/down commands
(22h-25h) can also be entered, as well as press &
hold (F0h) for buttons that have dual functions, depending
on the duration they are held. In this way,
you can use a specially-written program or the computer
keyboard to control the FT-8500.
There are 60 instruction opcodes listed in the table
on the next page. The PCC control program must
construct the appropriate instruction opcode, organizing
the parameters, then send them to the SI serial
input pin of the DATA jack on the transceiver.
Example: Tune to 145.520 MHz; this assumes direct
frequency entry (menu function 33) is enabled. First
think how this would be entered using the keypad

The sequence would be:
1 – 4 – 5 – 5 – 2 – 0

• Determine the opcode for the desired instruction
using the PCC Commands Code table. These opcodes
should be stored in the program so they can
be looked up when the user requests the corresponding
command. In this case the instruction is:
01h 04h 05h 05h 02h 00h "h”= hex

Example: Change the CTCSS encode/decode tone
from 88.5 Hz (default) to 100.0 Hz;
• First, the menu programming loop needs to be
recalled, next, tone select must be selected and
then the default tone changed using A or B buttons.
D then 0 buttons enables menu programming (20h).
0 then 6 buttons recalls the tone select entry (00h, 06h).
C button views the default tone (21h).
A button pressed 4 times moves up four consecutive
times to select 100.0 Hz (22h, 22h, 22h, 22h).
C button saves the new tone (21h).
D then 0 buttons exits menu programming (20h).
• The opcode for this instruction is :
20h 00h 06h 21h 22h 22h 22h 22h 21h 20h
Commands for dual-function buttons require a special
flag (FFh) when constructing the opcode:
Example: Activate continuous-sweep Spectra-Analyzer
operation.
• Normally D and 5 buttons must be pressed, with button 5 held
longer than ½ sec. to enable continuous sweeping,
(single sweep activates if it is only momentarily
pressed). Preceding a button code with FFh (press
& hold) simulates holding that button for 1 second.
In this case the command to activate continuous sweep
Spectra-Analyzer operation is: F0h 19h

Writing Programs
Coding Examples
Although Yaesu Musen does not offer PCC control
programs (due to the variety of incompatible computers
used by our customers), the following is an example
of a PCC command, in BASIC programming
language. Note that all variations of BASIC may not
support some of the commands, in which case alternate
algorithms may need to be developed to duplicate
the functions of those shown.

Sending a Command

After "opening" the computer's serial port for 9600
baud, 8 data bits and 2 stop bits with no parity, as i/o
device #2, any PCC command may be sent.
Notice that the instruction opcode is sent in the same
order in which they appear in the PCC Commands
table.

For example, the following command could be used
to set the frequency of the display to 145.520 MHz:

PRINT #2,

CHR$(&H18); CHR$(&H01);
CHR$(&H04); CHR$(&H05);
CHR$(&H05); CHR$(&H02);

Sending a parameter that is out of range for the
intended function, or not among the specified legal
values for that function should do nothing.

Thanks to all who can contribute to this project
Mike

You’ve almost got it…

SerialX.write(0x18);
SerialX.write(0x01);
SerialX.write(0x04);
SerialX.write(0x05);
SerialX.write(0x05);
SerialX.write(0x02;

Where X is whatever serial stream you’re using…

The instructions I posted were from the manufacturer.

What I am clueless at is setting up for a serial stream with 1,8,N,2 configuration.
I know enough to be dangerous, :grimacing:

I would be using a nano, so only one stream??

Mike

Serial.begin() - Arduino Reference

Is that not the default?

No:

SERIAL_8N1 (the default)
SERIAL_5N2
SERIAL_6N2
SERIAL_7N2
SERIAL_8N2

But... With Nano, so that the radio does not interfere with sketch upload and serial monitor for debugging, software serial might be a better option.

Yeah, but in most cases, the number of stop bits is irrelevant to the receiver...

How did you manage to mangle them so badly when posting? :astonished:

Not a worry really, just the sort of thing that happens with some websites. :grin:

I see configs in there for 8 bits WITH parity. AFAIK that's not possible on a standard 8250 UART. The last bit time (bit 8) is either bit 8 or parity. Has anyone actually gotten 8Ox or 8Ex to work?

Not really you. It's most likely manufacturer's fault.

tinkerer9 :slightly_smiling_face:

It can be various things. I believe there is a frequent problem with people composing on tablets or phones which word wrap and actually insert spurious newlines when the text is copied for pasting or submitted.

The fact that the OP's own text was not fouled up but the quoted text was, does suggest some bad formatting on the web page that was pasted (instead of quoted). So I was certainly not blaming the OP, just having a bit of a whinge.

Problem is my obsessive personality (not to be confused with OCD which is totally unrelated but commonly misunderstood) forcing me to check everything I post for errors. :roll_eyes:

Thank you very much, that fills in a big hole for me.
I am assuming this is declared in void setup() ?
Mike

I copied the text word for word from the instructions.
probably jinglish translation.
Mike

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.