YAESU FRG-100 RADIO PROGRAMMING SOURCE CODE


Following are code modules for computer control of the Yaesu FRG-100 Communications Receiver. These modules allow the computer to communicate with the receiver using the FIF-232C Computer-Aided Transceiver (CAT) System option available from Yaesu. These modules constitute only the computer-receiver interface portion of a complete control program.

The following code modules were produced by Industrial Mindworks, Inc. and remain the exclusive property of Industrial Mindworks, Inc. They may be used for non-commercial purposes if the entire copyright notice and credits remain intact. Please contact Industrial Mindworks, Inc. for permission to use the following code for any commercial purpose. Contact information is available at http://www.industrialmindworks.com/.

Included below are a C source code module and its associated H header file.


/*
******************************************************************************
**
**      ----------------------------------------------------------------------
**
**	FRG100 Routines
**
**	imFRG100.c
**
**      ----------------------------------------------------------------------
**
**	Copyright Notice
**
**      Copyright (c) 1982-1999 Industrial Mindworks, Inc.
**      All Rights Reserved.
**
**      ----------------------------------------------------------------------
**
**	License and Disclaimer
**
**      Copyright Industrial Mindworks, Inc.  This is an unpublished work.
**	This work embodies trade secrets proprietary to Industrial Mindworks,
**	Inc. and is protected under copyright law as an unpublished work.
**	Use and disclosure is restricted by license agreement.  All Rights
**	in Copyright are Reserved.
**
**      This work is provided "as-is" with no warranties whatsoever including
**	any warranty of merchantability, fitness for any particular purpose,
**	or any warranty otherwise arising out of any proposal, specification,
**	or sample.
**
**      Authors of this work disclaim all liability, including liability
**      for infringement of proprietary rights, relating to implementation
**      of this work.  Authors of this library also do not warrant or
**      represent that such implementation will not infringe such rights.
**
**      All product names are trademarks, registered trademarks, or service
**	marks of their respective owners.
**
**      LICENSEE of the work assumes full and complete responsibility for the
**	usefulness, correctness, or marketability of executable	program and/or
**	object module(s) resulting from compilation or interpretation of this
**	program source code (hereinafter in total or in part referred to as
**	"MATERIAL"), the suitability of the MATERIAL for a particular purpose,
**	the merchantability of the MATERIAL, and any or all incidental or
**      consequential damages which may occur due to misuse of the MATERIAL.
**
**      LICENSOR DOES NOT MAKE ANY EXPRESS, IMPLIED, OR STATUTORY WARRANTY,
**      INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF
**      MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT
**      SHALL LICENSOR BE LIABLE FOR INDIRECT, SPECIAL, OR CONSEQUENTIAL
**      DAMAGES INCLUDING WITHOUT LIMITATION, TO LOSS OF ANTICIPATED PROFITS
**      OR BENEFITS RESULTING FROM THE USE OF THE PROGRAM SOURCE CODE OR
**      ARISING OUT OF ANY BREACH OF THIS WARRANTY.
**
**      ----------------------------------------------------------------------
**
******************************************************************************
*/



/*
******************************************************************************
**
**	Information
**
******************************************************************************
*/



#define imFRG100_INFO__DESCRIPTION		( "FRG100 Routines" )
#define imFRG100_INFO__FILENAME			( "imFRG100.c" )
#define imFRG100_INFO__VERSION			( "1.0" )
#define imFRG100_INFO__DEPENDENCIES		( "imTypes.h, imError.h, imMath.h, imMemory.h, imSerialPort.h, imFRG100.h" )

#define imFRG100_INFO__AUTHORS			( "Christopher D. Watkins" )
#define imFRG100_INFO__DATE			( "11 Mar 2000" )
#define imFRG100_INFO__TIME			( "00:00 UCT" )



/*
******************************************************************************
**
**	Industrial Mindworks, Inc. Includes
**
******************************************************************************
*/



#include        "imTypes.h"
#include        "imError.h"
#include        "imMath.h"
#include        "imMemory.h"
#include        "imSerial.h"
#include        "imFRG100.h"



/*
******************************************************************************
**
**	imFRG100 Functions
**
******************************************************************************
*/



/*----------------------------------------------------------------------------
**
**      imFRG100 Command Handling
**
*/
#define imFRG100_CMD_MEMORY_RECALL              ( 0x02 )
#define imFRG100_CMD_VFO_TO_MEM                 ( 0x03 )
#define imFRG100_CMD_LOCK                       ( 0x04 )
#define imFRG100_CMD_VFO_OPERATION              ( 0x05 )
#define imFRG100_CMD_MEM_TO_VFO                 ( 0x06 )
#define imFRG100_CMD_UP_FAST                    ( 0x07 )
#define imFRG100_CMD_DOWN_FAST                  ( 0x08 )
#define imFRG100_CMD_SET_OPERATING_FREQ         ( 0x0A )
#define imFRG100_CMD_MODE                       ( 0x0C )
#define imFRG100_CMD_PACING                     ( 0x0E )
#define imFRG100_CMD_STATUS_UPDATE              ( 0x10 )
#define imFRG100_CMD_POWER                      ( 0x20 )
#define imFRG100_CMD_CLOCK_SET                  ( 0x21 )
#define imFRG100_CMD_TIMER_SLEEP_TIME_SET       ( 0x22 )
#define imFRG100_CMD_SCAN_SKIP_SET              ( 0x8D )
#define imFRG100_CMD_STEP_OPERATING_FREQ        ( 0x8E )
#define imFRG100_CMD_READ_S_METER               ( 0xF7 )
#define imFRG100_CMD_DIM                        ( 0xF8 )
#define imFRG100_CMD_READ_FLAGS                 ( 0xFA )


imTypes_void
	imFRG100_SendCommand
	(
		imTypes_uint8	b4,
		imTypes_uint8	b3,
		imTypes_uint8	b2,
		imTypes_uint8	b1,
		imTypes_uint8	command
	)
{
	imSerialPort_WriteByte( b4 );
	imSerialPort_WriteByte( b3 );
	imSerialPort_WriteByte( b2 );
	imSerialPort_WriteByte( b1 );
	imSerialPort_WriteByte( command );
}


imTypes_void
	imFRG100_ReceiveData
	(
		imTypes_uint8 *		data,
		imTypes_uint16		data_length
	)
{
	imTypes_uint16    n;

	for ( n = 0;  n < data_length;  n++ )
	{
		imMemory_ELEMENT_SET( data, n, imSerialPort_ReadByte() );
	}
}



/*----------------------------------------------------------------------------
**
**      POWER
**
*/
imTypes_void
	imFRG100_Power
	(
		imTypes_uint8	status
	)
{
	/*
	** status =
	**
	**      imFRG100_ST_POWER_OFF   0
	**      imFRG100_ST_POWER_ON    1
	*/
	imFRG100_SendCommand( 0, 0, 0, status, imFRG100_CMD_POWER );
}



/*----------------------------------------------------------------------------
**
**      DIM (LCD backlighting)
**
*/
imTypes_void
	imFRG100_Dim
	(
		imTypes_uint8	status
	)
{
	/*
	** status =
	**
	**      imFRG100_ST_DIM_OFF     1
	**      imFRG100_ST_DIM_ON      0
	*/
	imFRG100_SendCommand( 0, 0, 0, status, imFRG100_CMD_DIM );
}



/*----------------------------------------------------------------------------
**
**      Pacing
**
*/
imTypes_void
	imFRG100_Pacing
	(
		imTypes_uint8	delay_ms
	)
{
	/*
	** delay_ms =
	**
	**      the number of milliseconds delay added between
	**      all bytes of data returned from the radio
	**      (useful for slow computers with slow ports)
	*/
	imFRG100_SendCommand( 0, 0, 0, delay_ms, imFRG100_CMD_PACING );
}



/*----------------------------------------------------------------------------
**
**      LOCK (tuning knob or panel lock)
**
*/
imTypes_void
	imFRG100_Lock
	(
		imTypes_uint8	status
	)
{
	/*
	** status =
	**
	**      imFRG100_ST_LOCK_OFF    0
	**      imFRG100_ST_LOCK_ON     1
	*/
	imFRG100_SendCommand( 0, 0, 0, status, imFRG100_CMD_LOCK );
}



/*----------------------------------------------------------------------------
**
**      Read S-Meter
**
*/
#define imFRG100_READSMETER_SIZE			( 5 )

imTypes_uint8
	imFRG100_ReadSMeter
	(
		imTypes_uint8 *		deflection
	)
{
	imTypes_uint16		data_length = imFRG100_READSMETER_SIZE;
	imTypes_uint8 *		data = NULL;
	imTypes_float64		dB;

	data = imMemory_CALLOC( data_length, imTypes_uint8 );

	/*------------------------------------------------------------------*/

	imFRG100_SendCommand( 0, 0, 0, 0, imFRG100_CMD_READ_S_METER );

	/*
	**      bytes   offset  description
	**      -----   ------  ------------------------
	**      1       0       Meter Value
	**      1       1       Meter Value (duplicate of first byte)
	**      1       2       Meter Value (duplicate of first byte)
	**      1       3       Meter Value (duplicate of first byte)
	**      1       4       Padding 0xF7
	**      -----
	**      5
	*/
	imFRG100_ReceiveData( data, data_length );

	/*------------------------------------------------------------------*/

	*deflection = imMemory_ELEMENT( data, 0 );

	if ( *deflection == 0 )
	{
		dB = 0.0;
	}
	else
	{
		/* 0.052421875 = 13.42 / 2^(sizeof(uint8)) */
		dB = exp( 0.052421875 * (imTypes_float64)(*deflection) );
	}

	/*------------------------------------------------------------------*/

	imMemory_FREE( data );

	return( dB );
}



/*----------------------------------------------------------------------------
**
**      Mode
**
*/
imTypes_void
	imFRG100_Mode
	(
		imTypes_uint8	status
	)
{
	/*
	** status =
	**
	**      imFRG100_ST_MODE_LSB            0
	**      imFRG100_ST_MODE_USB            1
	**      imFRG100_ST_MODE_CW_WIDE        2
	**      imFRG100_ST_MODE_CW_NARROW      3
	**      imFRG100_ST_MODE_AM_WIDE        4
	**      imFRG100_ST_MODE_AM_NARROW      5
	**      imFRG100_ST_MODE_FM             6
	*/
	imFRG100_SendCommand( 0, 0, 0, status, imFRG100_CMD_MODE );
}



/*----------------------------------------------------------------------------
**
**      Set Operating Frequency (kHz)
**
*/
imTypes_void
	imFRG100_SetOperatingFrequency
	(
		imTypes_float64		frequency_kHz
	)
{
	imTypes_uint8    f_100MHz_10MHz;
	imTypes_uint8    f_1MHz_100kHz;
	imTypes_uint8    f_10kHz_1kHz;
	imTypes_uint8    f_100Hz_10Hz;
	imTypes_uint8    padding;

	imMath_DoubleToPackedBCD( frequency_kHz, &f_100MHz_10MHz,
						 &f_1MHz_100kHz,
						 &f_10kHz_1kHz,
						 &f_100Hz_10Hz,
						 &padding );

	/*
	** frequency_kHz as a packed BCD number
	**      (a nibble represents a digit, thus 8-digits -> 4 bytes) =
	**
	**      f_100Hz_10Hz    <-   100Hz |    10Hz
	**      f_10kHz_1kHz    <-   10kHz |    1kHz
	**      f_1MHz_100kHz   <-    1MHz |  100kHz
	**      f_100MHz_10MHz  <-  100MHz |   10MHz
	*/
	imFRG100_SendCommand( f_100Hz_10Hz,
			      f_10kHz_1kHz,
			      f_1MHz_100kHz,
			      f_100MHz_10MHz,
			      imFRG100_CMD_SET_OPERATING_FREQ );
}



/*----------------------------------------------------------------------------
**
**      UP (FAST)
**
*/
imTypes_void
	imFRG100_UpFast
	(
		imTypes_uint8	status
	)
{
	/*
	** status =
	**
	**      imFRG100_ST_UPFAST_100KHZ       0
	**      imFRG100_ST_UPFAST_1MHZ         1
	*/
	imFRG100_SendCommand( 0, 0, status, 0, imFRG100_CMD_UP_FAST );
}



/*----------------------------------------------------------------------------
**
**      DOWN (FAST)
**
*/
imTypes_void
	imFRG100_DownFast
	(
		imTypes_uint8	status
	)
{
	/*
	** status =
	**
	**      imFRG100_ST_DOWNFAST_100KHZ     0
	**      imFRG100_ST_DOWNFAST_1MHZ       1
	*/
	imFRG100_SendCommand( 0, 0, status, 0, imFRG100_CMD_DOWN_FAST );
}



/*----------------------------------------------------------------------------
**
**      Status Update
**
*/
imTypes_void
	imFRG100_Status
	(
		imTypes_uint8 *		data,
		imTypes_uint16		data_length,
		imTypes_char		status
	)
{
	/*
	** status =
	**
	**      imFRG100_ST_STATUS_COMPLETE_RECORD              0
	**              Return 292-byte complete status data record
	**
	**      imFRG100_ST_STATUS_MEM_CHANNEL_NUMBER           1
	**              Return   1-byte memory channel number
	**
	**      imFRG100_ST_STATUS_OPERATING_DATA_RECORD        2
	**              Return  19-byte operating data record
	**
	**      imFRG100_ST_STATUS_VFO_DATA_RECORD              3
	**              Return  18-byte VFO data record
	**
	**      imFRG100_ST_STATUS_MEM_CHANNEL_DATA_RECORD      4
	**              Return  19-byte memory data record for channel CH
	*/
	imFRG100_SendCommand( 0, 0, 0, status, imFRG100_CMD_STATUS_UPDATE );

	switch ( status )
	{
		/*
		**	-----------------
		**      VFO/Mem Flag Byte
		**	-----------------
		**
		**      Bit0 -> Reserved for system
		**      Bit1 -> Memory Clear
		**      Bit2 -> Memory set to SKIP when scanning
		**      Bit3 -> Reserved for system
		**      Bit4 -> Reserved for system
		**      Bit5 -> Reserved for system
		**      Bit6 -> Current mode is AM NARrow
		**      Bit7 -> Current mode is CW NARrow
		**
		**	---------------------------------------------
		**	Operating Data, VFO Data, Memory Channel Data
		**	---------------------------------------------
		**
		**      Byte0 -> Frequency least-significant byte (binary)
		**      Byte1 -> Frequency middle-significant byte (binary)
		**      Byte2 -> Frequency most-significant byte (binary)
		**      Byte3 -> Mode (LSB=0, USB=1, CW=2, AM=3, FM=4)
		**      Byte4 -> VFO/Mem Flag Byte
		*/

		/*------------------------------------------------------------
		**
		*/
		case imFRG100_ST_STATUS_COMPLETE_RECORD:
		{
			/*
			**      bytes   offset  description
			**      -----   ------  ------------------------
			**      1       1       Flag Byte 1
			**                      Bit0 -> LOCK is active (= display)
			**                      Bit1 -> Reserved for system
			**                      Bit2 -> Reserved for system
			**                      Bit3 -> Memory Recall in progress
			**                      Bit4 -> Memory Tuning (M TUNE) activated
			**                      Bit5 -> MEM operation (= display)
			**                      Bit6 -> Reserved for system
			**                      Bit7 -> VFO operation (= display)
			**
			**      1       2       Flag Byte 2
			**                      Bit0 -> SCAN
			**                      Bit1 -> Scan Delay
			**                      Bit2 -> Group Scanning
			**                      Bit3 -> Priority Scan
			**                      Bit4 -> MUTE
			**                      Bit5 -> Reserved for system
			**                      Bit6 -> Reserved for system
			**                      Bit7 -> FAST Tuning/Scanning Rate is activated
			**
			**      1       3       Flag Byte 3
			**                      Bit0 -> SLEEP Timer ON
			**                      Bit1 -> On - Timer ON
			**                      Bit2 -> Off - Timer ON
			**                      Bit3 -> Clock #1 Display
			**                      Bit4 -> Clock #2 Display
			**                      Bit5 -> Set Mode Function
			**                      Bit6 -> Power OFF
			**                      Bit7 -> 12/24 Hour Time Format
			**
			**      1       4       Memory Channel Number
			**
			**      3       5-9     Operating Data
			**
			**      5       10-14   VFO Data
			**
			**      52 x 5  15-273  Memory Channel Data
			**
			**      9       274-282 Clock #1
			**                      Byte0 -> Seconds (BCD)
			**                      Byte1 -> Minutes (BCD)
			**                      Byte2 -> Hours (BCD)
			**                      Byte3 -> Day
			**                      Byte4 -> Date
			**                      Byte5 -> Month
			**                      Byte6 -> Year
			**                      Byte7 -> Leap Year
			**                      Byte8 -> 12/24 Hour Format
			**
			**      9       283-292 Clock #2
			**                      Byte0 -> Minutes (BCD)
			**                      Byte1 -> Hours (BCD)
			**                      Byte2 -> On Timer Minutes (BCD)
			**                      Byte3 -> On Timer Hours (BCD)
			**                      Byte4 -> Off Timer Minutes (BCD)
			**                      Byte5 -> Off Timer Hours (BCD)
			**                      Byte6 -> Sleep Timer Minutes (BCD)
			**                      Byte7 -> Sleep Timer Hours (BCD) [differs from text]
			**                      Byte8 -> Reserved for system
			**      -----
			**      292
			*/
			if ( data_length != imFRG100_STATUS_COMPLETE_RECORD_SIZE )
			{
				imError_Fatal( "Data lengths do not match [function = imFRG100_Status]", "" );
			}

			imFRG100_ReceiveData( data, data_length );
		}
		break;

		/*------------------------------------------------------------
		**
		*/
		case imFRG100_ST_STATUS_MEM_CHANNEL_NUMBER_RECORD:
		{
			/*
			**      bytes   offset  description
			**      -----   ------  ------------------------
			**      1       1       Memory Channel Number
			**      -----
			**      1
			*/
			if ( data_length != imFRG100_STATUS_MEM_CHANNEL_NUMBER_RECORD_SIZE )
			{
				imError_Fatal( "Data lengths do not match [function = imFRG100_Status]", "" );
			}

			imFRG100_ReceiveData( data, data_length );
		}
		break;

		/*------------------------------------------------------------
		**
		*/
		case imFRG100_ST_STATUS_OPERATING_DATA_RECORD:
		{
			/*
			**      bytes   offset  description
			**      -----   ------  ------------------------
			**      1       1       Memory Channel Number
			**      3       2-4     Operating Data - Frequency (binary LSB->MSB)
			**      2       5-6     Padding
			**      1       7       Operating Data - Mode
			**      1       8       Padding
			**      1       9       Operating Data - VFO/Mem Flag Byte
			**      1       10      Padding?
			**      9       11-19   Padding
			**      -----
			**      19
			*/
			if ( data_length != imFRG100_STATUS_OPERATING_DATA_RECORD_SIZE )
			{
				imError_Fatal( "Data lengths do not match [function = imFRG100_Status]", "" );
			}

			imFRG100_ReceiveData( data, data_length );
		}
		break;

		/*------------------------------------------------------------
		**
		*/
		case imFRG100_ST_STATUS_VFO_DATA_RECORD:
		{
			/*
			**      bytes   offset  description
			**      -----   ------  ------------------------
			**      3       1-3     VFO Data - Frequency (binary LSB->MSB)
			**      2       4-5     Padding
			**      1       6       VFO Data - Mode
			**      1       7       Padding
			**      1       8       VFO Data - VFO/Mem Flag Byte
			**      1       9       Padding?
			**      9       10-18   Padding
			**      -----
			**      18
			*/
			if ( data_length != imFRG100_STATUS_VFO_DATA_RECORD_SIZE )
			{
				imError_Fatal( "Data lengths do not match [function = imFRG100_Status]", "" );
			}

			imFRG100_ReceiveData( data, data_length );
		}
		break;

		/*------------------------------------------------------------
		**
		*/
		case imFRG100_ST_STATUS_MEM_CHANNEL_DATA_RECORD:
		{
			/*
			**      bytes   offset  description
			**      -----   ------  ------------------------
			**      1       1       Memory Channel Number
			**      3       2-4     Memory Channel Data - Frequency (binary LSB->MSB)
			**      2       5-6     Padding
			**      1       7       Memory Channel Data - Mode
			**      1       8       Padding
			**      1       9       Memory Channel Data - VFO/Mem Flag Byte
			**      1       10      Padding?
			**      9       11-19   Padding
			**      -----
			**      19
			*/
			if ( data_length != imFRG100_STATUS_MEM_CHANNEL_DATA_RECORD_SIZE )
			{
				imError_Fatal( "Data lengths do not match [function = imFRG100_Status]", "" );
			}

			imFRG100_ReceiveData( data, data_length );
		}
		break;

		/*------------------------------------------------------------
		**
		*/
		default:
		{
			imError_Fatal( "Invalid status update mode [function = imFRG100_Status].", "" );
		}
		break;
	}
}



/*----------------------------------------------------------------------------
**
**      Read Flags
**
*/
#define imFRG100_READFLAGS_SIZE				( 5 )

imTypes_void
	imFRG100_ReadFlags
	(
		imTypes_uint8 *		b1,
		imTypes_uint8 *		b2,
		imTypes_uint8 *		b3
	)
{
	imTypes_uint16		data_length = imFRG100_READFLAGS_SIZE;
	imTypes_uint8 *		data = NULL;

	data = imMemory_CALLOC( data_length, imTypes_uint8 );

	/*------------------------------------------------------------------*/

	imFRG100_SendCommand( 0, 0, 0, 0, imFRG100_CMD_READ_FLAGS );

	/*
	**      bytes   offset  description
	**      -----   ------  ------------------------
	**      1       1       Flag Byte 1
	**                      Bit0 -> LOCK is active (= display)
	**                      Bit1 -> Reserved for system
	**                      Bit2 -> Reserved for system
	**                      Bit3 -> Memory Recall in progress
	**                      Bit4 -> Memory Tuning (M TUNE) activated
	**                      Bit5 -> MEM operation (= display)
	**                      Bit6 -> Reserved for system
	**                      Bit7 -> VFO operation (= display)
	**
	**      1       2       Flag Byte 2
	**                      Bit0 -> SCAN
	**                      Bit1 -> Scan Delay
	**                      Bit2 -> Group Scanning
	**                      Bit3 -> Priority Scan
	**                      Bit4 -> MUTE
	**                      Bit5 -> Reserved for system
	**                      Bit6 -> Reserved for system
	**                      Bit7 -> FAST Tuning/Scanning Rate is activated
	**
	**      1       3       Flag Byte 3
	**                      Bit0 -> SLEEP Timer ON
	**                      Bit1 -> On - Timer ON
	**                      Bit2 -> Off - Timer ON
	**                      Bit3 -> Clock #1 Display
	**                      Bit4 -> Clock #2 Display
	**                      Bit5 -> Set Mode Function
	**                      Bit6 -> Power OFF
	**                      Bit7 -> 12/24 Hour Time Format
	**
	**      1       3       Padding 0x08
	**
	**      1       4       Padding 0x41
	**      -----
	**      5
	*/
	imFRG100_ReceiveData( data, data_length );

	/*------------------------------------------------------------------*/

	*b1 = imMemory_ELEMENT( data, 0 );
	*b2 = imMemory_ELEMENT( data, 1 );
	*b3 = imMemory_ELEMENT( data, 2 );

	/*------------------------------------------------------------------*/

	imMemory_FREE( data );
}



/*----------------------------------------------------------------------------
**
**      Memory Recall
**
*/
imTypes_void
	imFRG100_MemoryRecall
	(
		imTypes_uint8	channel
	)
{
	/*
	** channel =
	**
	**      1-50 for Memory Channel Number
	**      and 51 for Lower Scan Frequency
	**      and 52 for Upper Scan Frequency
	*/
	imFRG100_SendCommand( 0, 0, 0, channel, imFRG100_CMD_MEMORY_RECALL );
}



/*----------------------------------------------------------------------------
**
**      VFO Operation
**
*/
imTypes_void
	imFRG100_VFOOperation
	(
		imTypes_void
	)
{
	imFRG100_SendCommand( 0, 0, 0, 0, imFRG100_CMD_VFO_OPERATION );
}



/*----------------------------------------------------------------------------
**
**      VFO->MEM
**
*/
imTypes_void
	imFRG100_VFOToMem
	(
		imTypes_uint8	channel,
		imTypes_uint8	status
	)
{
	/*
	** channel =
	**
	**      1-50 for Memory Channel Number
	**      and 51 for Lower Scan Frequency
	**      and 52 for Upper Scan Frequency
	**
	** status =
	**
	**      imFRG100_ST_VFOTOMEM_SET        0
	**      imFRG100_ST_VFOTOMEM_CLEAR      1
	**      imFRG100_ST_VFOTOMEM_RECALL     2
	*/
	imFRG100_SendCommand( 0, 0, status, channel, imFRG100_CMD_VFO_TO_MEM );
}



/*----------------------------------------------------------------------------
**
**      MEM->VFO
**
*/
imTypes_void
	imFRG100_MemToVFO
	(
		imTypes_uint8	channel
	)
{
	/*
	** channel =
	**
	**      1-50 for Memory Channel Number
	**      and 51 for Lower Scan Frequency
	**      and 52 for Upper Scan Frequency
	*/
	imFRG100_SendCommand( 0, 0, 0, channel, imFRG100_CMD_MEM_TO_VFO );
}



/*----------------------------------------------------------------------------
**
**      Scan Skip Set
**
*/
imTypes_void
	imFRG100_ScanSkipSet
	(
		imTypes_uint8	channel,
		imTypes_uint8	status
	)
{
	/*
	** channel =
	**
	**      1-50 for Memory Channel Number
	**      to be skipped during scanning
	**
	** status =
	**
	**      imFRG100_ST_SCANSKIPSET_ON      0
	**      imFRG100_ST_SCANSKIPSET_OFF     1
	*/
	imFRG100_SendCommand( 0, 0, status, channel,
						imFRG100_CMD_SCAN_SKIP_SET );
}



/*----------------------------------------------------------------------------
**
**      Step Operating Frequency
**
*/
imTypes_void
	imFRG100_StepOperatingFrequency
	(
		imTypes_uint8	status
	)
{
	/*
	** status =
	**
	**      imFRG100_ST_STEPOPERATINGFREQ_UP        0
	**              Step  up  minimum step size (10Hz or 100Hz)
	**      imFRG100_ST_STEPOPERATINGFREQ_DOWN      1
	**              Step down minimum step size (10Hz or 100Hz)
	*/
	imFRG100_SendCommand( 0, 0, 0, status,
					imFRG100_CMD_STEP_OPERATING_FREQ );
}



/*----------------------------------------------------------------------------
**
**      Clock Set
**
*/
imTypes_void
	imFRG100_ClockSet
	(
		imTypes_uint8	status,
		imTypes_uint8	hour,
		imTypes_uint8	minute
	)
{
	/*
	** status =
	**
	**      imFRG100_ST_CLOCKSET_12_24_HOUR         0
	**              hour = imFRG100_ST_CLOCKSET_12HR for 12 hour
	**              hour = imFRG100_ST_CLOCKSET_24HR for 24 hour
	**
	**      imFRG100_ST_CLOCKSET_CLOCK1             1
	**              hour   =   hour (BCD)
	**              minute = minute (BCD)
	**
	**      imFRG100_ST_CLOCKSET_CLOCK2             2
	**              hour   = offset   hour (BCD) from Clock #1
	**              minute = offset minute (BCD) from Clock #1
	*/
	imFRG100_SendCommand( 0, minute, hour, status,
						imFRG100_CMD_CLOCK_SET );
}



/*----------------------------------------------------------------------------
**
**      Timer/Sleep Time Set
**
*/
imTypes_void
	imFRG100_TimerSleepTimeSet
	(
		imTypes_uint8	status,
		imTypes_uint8	hour,
		imTypes_uint8	minute,
		imTypes_uint8	timer_status
	)
{
	/*
	** status =
	**
	**      imFRG100_ST_TIMERSLEEPTIMESET_ONTIME_SET        1
	**              hour   =   hour (BCD)
	**              minute = minute (BCD)
	**
	**      imFRG100_ST_TIMERSLEEPTIMESET_OFFTIME_SET       2
	**              hour   =   hour (BCD)
	**              minute = minute (BCD)
	**
	**      imFRG100_ST_TIMERSLEEPTIMESET_SLEEPTIME_SET     3
	**              hour   =   hour (BCD)
	**              minute = minute (BCD)
	**
	** timer_status =
	**
	**      imFRG100_ST_TIMERSLEEPTIMESET_DISABLE           0
	**      imFRG100_ST_TIMERSLEEPTIMESET_ENABLE            1
	*/
	imFRG100_SendCommand( timer_status, minute, hour, status,
					imFRG100_CMD_TIMER_SLEEP_TIME_SET );
}



/****************************************************************************/



/*
******************************************************************************
**
**	End of imFRG100.c
**
******************************************************************************
*/




/*
******************************************************************************
**
**      ----------------------------------------------------------------------
**
**	FRG100 Routines
**
**	imFRG100.h
**
**      ----------------------------------------------------------------------
**
**	Copyright Notice
**
**      Copyright (c) 1982-1999 Industrial Mindworks, Inc.
**      All Rights Reserved.
**
**      ----------------------------------------------------------------------
**
**	License and Disclaimer
**
**      Copyright Industrial Mindworks, Inc.  This is an unpublished work.
**	This work embodies trade secrets proprietary to Industrial Mindworks,
**	Inc. and is protected under copyright law as an unpublished work.
**	Use and disclosure is restricted by license agreement.  All Rights
**	in Copyright are Reserved.
**
**      This work is provided "as-is" with no warranties whatsoever including
**	any warranty of merchantability, fitness for any particular purpose,
**	or any warranty otherwise arising out of any proposal, specification,
**	or sample.
**
**      Authors of this work disclaim all liability, including liability
**      for infringement of proprietary rights, relating to implementation
**      of this work.  Authors of this library also do not warrant or
**      represent that such implementation will not infringe such rights.
**
**      All product names are trademarks, registered trademarks, or service
**	marks of their respective owners.
**
**      LICENSEE of the work assumes full and complete responsibility for the
**	usefulness, correctness, or marketability of executable	program and/or
**	object module(s) resulting from compilation or interpretation of this
**	program source code (hereinafter in total or in part referred to as
**	"MATERIAL"), the suitability of the MATERIAL for a particular purpose,
**	the merchantability of the MATERIAL, and any or all incidental or
**      consequential damages which may occur due to misuse of the MATERIAL.
**
**      LICENSOR DOES NOT MAKE ANY EXPRESS, IMPLIED, OR STATUTORY WARRANTY,
**      INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF
**      MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT
**      SHALL LICENSOR BE LIABLE FOR INDIRECT, SPECIAL, OR CONSEQUENTIAL
**      DAMAGES INCLUDING WITHOUT LIMITATION, TO LOSS OF ANTICIPATED PROFITS
**      OR BENEFITS RESULTING FROM THE USE OF THE PROGRAM SOURCE CODE OR
**      ARISING OUT OF ANY BREACH OF THIS WARRANTY.
**
**      ----------------------------------------------------------------------
**
******************************************************************************
*/



#ifndef __imFRG100_h__
#define __imFRG100_h__



/*
******************************************************************************
**
**	Information
**
******************************************************************************
*/



#define imFRG100_HINFO__DESCRIPTION		( "FRG100 Routines" )
#define imFRG100_HINFO__FILENAME		( "imFRG100.h" )
#define imFRG100_HINFO__VERSION			( "1.0" )
#define imFRG100_HINFO__DEPENDENCIES		( "imTypes.h" )

#define imFRG100_HINFO__AUTHORS			( "Christopher D. Watkins" )
#define imFRG100_HINFO__DATE			( "11 Oct 1999" )
#define imFRG100_HINFO__TIME			( "00:00 UCT" )



/*
******************************************************************************
**
**	Industrial Mindworks, Inc. Includes
**
******************************************************************************
*/



#include	"imTypes.h"



/*
******************************************************************************
**
**	imFRG100 Functions
**
******************************************************************************
*/



#define imFRG100_CHANNEL_NUMBER_MINIMUM			(  1 )
#define imFRG100_CHANNEL_NUMBER_MAXIMUM			( 50 )
#define imFRG100_CHANNEL_NUMBER_LOWER_SCAN_FREQUENCY	( 51 )
#define imFRG100_CHANNEL_NUMBER_UPPER_SCAN_FREQUENCY	( 52 )

#define imFRG100_RADIO_FREQUENCY_MINIMUM_KHZ		(    50.00 )
#define imFRG100_RADIO_FREQUENCY_MAXIMUM_KHZ		( 30000.00 )



/*----------------------------------------------------------------------------
**
**      POWER
**
*/
#define imFRG100_ST_POWER_OFF				( 0 )
#define imFRG100_ST_POWER_ON				( 1 )

extern imTypes_void
	imFRG100_Power
	(
		imTypes_uint8	status
	);


/*----------------------------------------------------------------------------
**
**      DIM (LCD backlighting)
**
*/
#define imFRG100_ST_DIM_OFF				( 1 )
#define imFRG100_ST_DIM_ON				( 0 )

extern imTypes_void
	imFRG100_Dim
	(
		imTypes_uint8	status
	);


/*----------------------------------------------------------------------------
**
**	Pacing
**
*/
extern imTypes_void
	imFRG100_Pacing
	(
		imTypes_uint8	delay_ms
	);


/*----------------------------------------------------------------------------
**
**      LOCK (tuning knob or panel lock)
**
*/
#define imFRG100_ST_LOCK_OFF				( 0 )
#define imFRG100_ST_LOCK_ON				( 1 )

extern imTypes_void
	imFRG100_Lock
	(
		imTypes_uint8	status
	);


/*----------------------------------------------------------------------------
**
**      Read S-Meter
**
*/
extern imTypes_uint8
	imFRG100_ReadSMeter
	(
		imTypes_uint8 *		deflection
	);


/*----------------------------------------------------------------------------
**
**      Mode
**
*/
#define imFRG100_ST_MODE_LSB				( 0 )
#define imFRG100_ST_MODE_USB				( 1 )
#define imFRG100_ST_MODE_CW_WIDE			( 2 )
#define imFRG100_ST_MODE_CW_NARROW			( 3 )
#define imFRG100_ST_MODE_AM_WIDE			( 4 )
#define imFRG100_ST_MODE_AM_NARROW			( 5 )
#define imFRG100_ST_MODE_FM				( 6 )

extern imTypes_void
	imFRG100_Mode
	(
		imTypes_uint8	status
	);


/*----------------------------------------------------------------------------
**
**      Set Operating Frequency (kHz)
**
*/
extern imTypes_void
	imFRG100_SetOperatingFrequency
	(
		imTypes_float64		frequency_kHz
	);


/*----------------------------------------------------------------------------
**
**      UP (FAST)
**
*/
#define imFRG100_ST_UPFAST_100KHZ			( 0 )
#define imFRG100_ST_UPFAST_1MHZ				( 1 )

extern imTypes_void
	imFRG100_UpFast
	(
		imTypes_uint8	status
	);


/*----------------------------------------------------------------------------
**
**      DOWN (FAST)
**
*/
#define imFRG100_ST_DOWNFAST_100KHZ			( 0 )
#define imFRG100_ST_DOWNFAST_1MHZ			( 1 )

extern imTypes_void
	imFRG100_DownFast
	(
		imTypes_uint8	status
	);


/*----------------------------------------------------------------------------
**
**      Status Update
**
*/
#define imFRG100_ST_STATUS_COMPLETE_RECORD		( 0 )
#define imFRG100_ST_STATUS_MEM_CHANNEL_NUMBER_RECORD	( 1 )
#define imFRG100_ST_STATUS_OPERATING_DATA_RECORD	( 2 )
#define imFRG100_ST_STATUS_VFO_DATA_RECORD		( 3 )
#define imFRG100_ST_STATUS_MEM_CHANNEL_DATA_RECORD	( 4 )

#define imFRG100_STATUS_COMPLETE_RECORD_SIZE		( 292 )
#define imFRG100_STATUS_MEM_CHANNEL_NUMBER_RECORD_SIZE	(   1 )
#define imFRG100_STATUS_OPERATING_DATA_RECORD_SIZE	(  19 )
#define imFRG100_STATUS_VFO_DATA_RECORD_SIZE		(  18 )
#define imFRG100_STATUS_MEM_CHANNEL_DATA_RECORD_SIZE	(  19 )

extern imTypes_void
	imFRG100_Status
	(
		imTypes_uint8 *		data,
		imTypes_uint16		data_length,
		imTypes_char		status
	);


/*----------------------------------------------------------------------------
**
**      Read Flags
**
*/
extern imTypes_void
	imFRG100_ReadFlags
	(
		imTypes_uint8 *		b1,
		imTypes_uint8 *		b2,
		imTypes_uint8 *		b3
	);


/*----------------------------------------------------------------------------
**
**      Memory Recall
**
*/
extern imTypes_void
	imFRG100_MemoryRecall
	(
		imTypes_uint8	channel
	);


/*----------------------------------------------------------------------------
**
**      VFO Operation
**
*/
extern imTypes_void
	imFRG100_VFOOperation
	(
		imTypes_void
	);


/*----------------------------------------------------------------------------
**
**      VFO->MEM
**
*/
#define imFRG100_ST_VFOTOMEM_SET			( 0 )
#define imFRG100_ST_VFOTOMEM_CLEAR			( 1 )
#define imFRG100_ST_VFOTOMEM_RECALL			( 2 )

extern imTypes_void
	imFRG100_VFOToMem
	(
		imTypes_uint8	channel,
		imTypes_uint8	status
	);


/*----------------------------------------------------------------------------
**
**      MEM->VFO
**
*/
extern imTypes_void
	imFRG100_MemToVFO
	(
		imTypes_uint8	channel
	);


/*----------------------------------------------------------------------------
**
**      Scan Skip Set
**
*/
#define imFRG100_ST_SCANSKIPSET_ON			( 0 )
#define imFRG100_ST_SCANSKIPSET_OFF			( 1 )

extern imTypes_void
	imFRG100_ScanSkipSet
	(
		imTypes_uint8	channel,
		imTypes_uint8	status
	);


/*----------------------------------------------------------------------------
**
**      Step Operating Frequency
**
*/
#define imFRG100_ST_STEPOPERATINGFREQ_UP		( 0 )
#define imFRG100_ST_STEPOPERATINGFREQ_DOWN		( 1 )

extern imTypes_void
	imFRG100_StepOperatingFrequency
	(
		imTypes_uint8	status
	);


/*----------------------------------------------------------------------------
**
**      Clock Set
**
*/
#define imFRG100_ST_CLOCKSET_12HR_24HR			( 0 )
#define imFRG100_ST_CLOCKSET_CLOCK1			( 1 )
#define imFRG100_ST_CLOCKSET_CLOCK2			( 2 )

#define imFRG100_ST_CLOCKSET_12HR			( 1 )
#define imFRG100_ST_CLOCKSET_24HR			( 0 )

extern imTypes_void
	imFRG100_ClockSet
	(
		imTypes_uint8	status,
		imTypes_uint8	hour,
		imTypes_uint8	minute
	);


/*----------------------------------------------------------------------------
**
**      Timer/Sleep Time Set
**
*/
#define imFRG100_ST_TIMERSLEEPTIMESET_ONTIME_SET	( 1 )
#define imFRG100_ST_TIMERSLEEPTIMESET_OFFTIME_SET	( 2 )
#define imFRG100_ST_TIMERSLEEPTIMESET_SLEEPTIME_SET	( 3 )

#define imFRG100_ST_TIMERSLEEPTIMESET_DISABLE		( 0 )
#define imFRG100_ST_TIMERSLEEPTIMESET_ENABLE		( 1 )

extern imTypes_void
	imFRG100_TimerSleepTimeSet
	(
		imTypes_uint8	status,
		imTypes_uint8	hour,
		imTypes_uint8	minute,
		imTypes_uint8	timer_status
	);



/****************************************************************************/



#endif /* __imFRG100_h__ */



/*
******************************************************************************
**
**	End of imFRG100.h
**
******************************************************************************
*/


Copyright © 1982-2024 Christopher D. Watkins. All Rights Reserved. LEGAL
Orlando, Florida, USA | Thu 19 Apr 2018

RETURN TO SHORTWAVE RADIO LISTENING RESOURCES