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.
- Baud-rate depending on the platform, see 1.5.3 Hardware Configuration
- 8 data bits
- no parity
- 1 stop bit
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).
- PLC initialization and configuration functions
- Handlers for received messages, transmission and events
The app_console.c file contains the chat application which communicates with the PC using the serial port.