4 Software Implementation
The firmware provided has been verified
on
ATmega64 and ATmega328PB by
changing
the device in the Atmel Studio. The project contains the files as explained in the
following table:
File Name | Description |
---|---|
main.c | This file contains the main routine which has the application code. This includes the initialization and ISR for Timer 1 used as free running timer. |
device.h | This file acts as a wrapper to have definitions for the two devices. This code can be used for other devices with no changes or minimal, if any. |
icp.c | This file consists of the drivers necessary for
the ICP module. The functions icp_init and
icp_rx can be called respectively, to do
initialization and fetch a sample for demodulator. |
icp.h | This file should be included to use the
functions in icp.c . This header file declares
the functions defined in icp.c and a required
data type icp_sample_t . This type reflects the
type used for computing the duty cycle, so it is wide enough to
hold values [0:ICP_SCALE ]. It also defines the
preprocessor symbol ICP_ANALOG , which must be
set to 1 to select analog mode and to 0 for digital. |
More details about the firmware and its functioning are discussed in the following sections.