1.5.1 Application Example

Microchip MAC-RT PLC & Go application is a point to point or multi-point chat application built on top of the G3-PLC MAC-RT layer Microchip implementation.

This application example assumes that a host device (a PC, for example) is connected through a serial interface (UART, USB) to a Microchip evaluation kit acting as a PLC modem.

The figure below shows a block diagram of the MAC-RT PLC & Go application.

Figure 1-47. G3 MAC-RT PLC & Go Block Diagram
The MAC-RT PLC & Go application interchanges data with the PC through a serial port using a terminal emulator (see Figure 1-48 where terminal emulator Tera Term is used). The settings of the serial port are:

When the terminal emulator is connected to the serial port and the first character is entered by the user, the PLC & Go application shows in the console some information about the hardware platform and the firmware running, and it waits for a PLC message to be sent/received or configuration request. The PLC message is sent when a carriage return character is entered. If the user enters the ASCII character 0x13 (‘CTRL+S’), a configuration menu is shown. If the user enters the ASCII character 0x04 (‘CTRL+D’), the current configuration is shown.

The MAC-RT PLC & Go application allows to:

  • Configure source/destination address and PAN ID
  • Configure the Ack Request Mechanism
  • Configure the frequency band (in case of using a Microchip evaluation board that supports several bands of transmission)
  • Enable/disable sleep mode (the STBY pin of the PLC device needs to be physically connected to a GPIO of the MCU host)

In addition, the application provides some information about the transmitted messages (length of the message) and the received messages (modulation, LQI destination address and source address).

Figure 1-48. MAC-RT PLC & Go Console
In the example project, the app_plc.c file contains:
  • PLC initialization and configuration functions
  • Handlers for received messages, transmission and events
The following subsections explain in more detail the app_plc.c file.

The app_console.c file contains the chat application which communicates with the PC using the serial port.