Still working on the Icom Project

It has been a LONG time since I seriously did any C programming… and structures were something we only vaguely touched on in class. 

I’ve already used up about 60% of my dynamic memory – a huge chunk of it is the array of structures, containing a string, a hex byte, an integer, and 2 spare strings.  I might change those to integers…   but the idea is that each radio has a definition, and the Arduino can simply search the table one time for the radio ID stored in EEPROM Memory (or selected in a menu), and then pull what it needs (address, capabilities) from the table.  The structure contains the following:

·         String:  Radio Model  (“IC706MK2G” or “IC7300”)

·         Hex Byte:  Radio default address (“0x58”)

·         Integer:  Radio capability byte (converts to 8 but binary, each bit refers to one capability, currently:  VFO B, DSP, Voice Keyer, 20 dB Attenuator, soft level adjust, and 3 spares)

·         Spare

·         Spare

Now that the big chunk of the radio control code is done, I’m working on smaller items, like refining which commands require which radio features.  For example, a radio without DSP can’t turn NR on or off, and a radio with no voice keyer can’t operate the voice keyer.

Additionally, I’m including some code form my earlier work, including the LCD display and rotary encoder.  This doesn’t help with the menu structure for setup, but I need to get the LCD display working before I move on to that task, which, honestly, is the most daunting.

I suspect that the entire main loop is going to need to move to a state machine with some degree of interrupt operation.  It’s not going to be SIMPLE, but I think it’s quite do-able.  In addition to all of this, I am going to have to get the multiple serial ports on the Arduino Mega functioning so that the system will watch for serial data in from the computer and interrupt system operation to repeat that data to the radio, and vice versa.  This will also cause me to need to send data, then monitor for a response, and dump it out of the Arduino (basically count the sent bytes, then purge that many from the sent, when the radio responds).

I guess if it was easy, someone else would have done it already?

Leave a Reply