Icom IC-7300 USB python 3 control

Linux controlling Icom IC-7300

In order to control IC-7300 using Python under linux we need to  instantiate serial object first.
ser = serial.Serial(serialport, baudrate)   then we need to send some data via serial.

Icom data is yet to study but for frequency change here is a simple script to do that .
As a remark,the problem not yet solved is that if Icom has Connectors /USB Send set as RTS for N1MM control or other software , then once the serial object is instantiated  , the transceiver goes to transmit mode for a short period of time.
This small script would be the base for a larger project of mine regarding an crystal bandpass filter
for 40 meter band controlled by Arduino but willing to communicate bi-directional with IC-7300 using Ci-V jack, of course ported in C language.

#! /usr/bin/python3
import time
import serial
import struct
from time import sleep

baudrate = 9600 
serialport = "/dev/ttyUSB0"
ser = serial.Serial(serialport, baudrate)
ser.setDTR(False) # prevent TCVR cw send  if USB key is set on DTR
ser.setRTS(False) # prevent TCVR going transmit if USB Send is set on RTS

# Define the string for freq change
string = ["0xfe","0xfe","0x94","0xe0","0x00","0x56","0x34","0x12","0x07","0x00","0xfd"]

# Where fefe is start sequance, 94 is icom address, e0 is computer address, next 5 groups
# represents reverse freq # like 14.124.456 Mhz , 00 is the end of data and fd is execute data

string_set = 0
while(string_set < 11):
    senddata = int(bytes(string[string_set], 'UTF-8'), 16)
    ser.write(struct.pack('>B', senddata))
    string_set +=1

Leave a Reply

Your email address will not be published. Required fields are marked *