User manual
18
- Creates a USB CDC Device that enumerates as a single COM port on the host personal
computer.
- Creates an instance of UART driver (USART_ID_1) to communicate with the Telit Cellular
module
- Creates an instance of UART driver (USART_ID_2) GPS module
- Creates an instance of SPI driver (SPI_ID_4) to communicate with the ADC chip MCP3910
- Creates an instance of I2C driver (I2C_ID_2) to communicate with the Accelerometer -
Magnetometer FXOS8700CQ
- Creates an instance of RTCC driver
- Creates an instance of SQI driver to communicate with the flash memory on board.
- Contains a state machine that reads Analog and Digital values from Analog and Digital inputs
- Contains a state machine that counts the pulses on the frequency counter inputs
- Contains a state machine to do 1Wire communications
Each driver instance is controlled with a separate state machine to make it easier for code
porting and reusing.
The application also has many useful functions that makes it easy for the user to develop
applications. Example of which are StrToInt(), IntToStr(), DEC2BCD(), BCD2DEC(),fota2(),
FormatDate(), ParseGGA(), ParseRMC(),, etc…
The application contains its own timer to create non-blocking delays incase RTOS is not used.
The function L_GetTickCounter() returns an unsigned long long variable that is incremented every
tenth of a second (0.1 second). For each state machine, a variable is defined which is used to
store the value of L_GetTickCounter() the point where the delay should be begin, and then
compare it with L_GetTickCounter() in each run of the state machine till the time has elapsed.
A 5 seconds delay example after assigning the Timeout variable the value of L_GetTickCounter() is:
if((L_GetTickCounter()- p_XE910Timeout)>50)
{
SendUSBDebugMessage("Module is on");
BLUE_LED_OFF();
GREEN_LED_ON();
PLIB_PORTS_PinClear(XE910_ON_OFF);
appData.XE910_State = XE910_SETUP_USART;
}
5.1 USB Communications:
The application creates an instance of USB CDC to exchange data between the device and a
host computer. It uses the libraries from MPLAB Harmonry. Please refer to the documentation
of the Microchip Harmony Harmony for more details on how it works. Device Driver is provided
along with the source code.
The function SendUSBDebugMessage(const char* message) can be used to send debug string messages
over USB.