Skip to content

Commit 0e042ef

Browse files
author
Anoop Kumar
committed
MPAE-16733: Firmware & Documents updated with the Latest Melody
1 parent baa1d12 commit 0e042ef

File tree

25 files changed

+745
-584
lines changed

25 files changed

+745
-584
lines changed

.main-meta/main.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@
44
"content": {
55
"metaDataVersion": "1.3.0",
66
"name": "com.microchip.mcu8.mplabx.project.pic16f15276-cnano-uart-io-expander-host-mplab-mcc",
7-
"version": "1.0.0",
7+
"version": "1.0.1",
88
"displayName": "UART I/O Expander: Host Implementation using PIC16F15276",
99
"projectName": "pic16f15276-cnano-uart-io-expander-host-mplab-mcc",
1010
"shortDescription": "This example highlights usage of PIC MCU as I/O expander using UART interface. The PIC16F15276 MCU acts as host and is used to control seven segment display. Compatible PIC16F152xx family of MCUs are: PIC16F15244, PIC16F15254, PIC16F15276.",
1111
"ide": {
1212
"name": "MPLAB X",
13-
"semverRange": ">=6.0.0"
13+
"semverRange": ">=6.15.0"
1414
},
1515
"compiler": [
1616
{
1717
"name": "XC8",
18-
"semverRange": "^2.36.0"
18+
"semverRange": "^2.45.0"
1919
}
2020
],
2121
"dfp": {
2222
"name": "PIC16f1xxxx_DFP",
23-
"semverRange": "^1.13.178"
23+
"semverRange": "^1.21.368"
2424
},
2525
"configurator": {
2626
"name": "MCC",
27-
"semverRange": "^5.1.1"
27+
"semverRange": "^5.3.7"
2828
},
2929
"device": {
3030
"metaDataVersion": "1.0.0",
@@ -36,7 +36,7 @@
3636
"versionRange": "*"
3737
}
3838
},
39-
"author": "Amey Panse",
39+
"author": "Anoop Kumar",
4040
"peripherals": [
4141
"EUSART",
4242
"TMR2"

README.md

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This code example demonstrates usage of PIC16F15276 microcontroller as a I/O exp
88

99
## Introduction
1010

11-
The PIC16F152xx family of microcontrollers are available in packages for various embedded applications. The PIC16F15276 simplified feature set includes Peripheral Pin Select (PPS), digital communication peripherals, timers, Enhanced Universal Synchronous Asynchronous Receiver Transmitter (EUSART). In real time applications, EUSART, can be configured as a full-duplex asynchronous system or half-duplex synchronous system. Full-Duplex mode is useful for communications with peripheral systems, such as CRT terminals and personal computers. Half-Duplex Synchronous mode is intended for communications with peripheral devices, such as A/D or D/A integrated circuits, serial EEPROMs or other microcontrollers. Several embedded applications use I/O expander to add the additional I/O pins required for the main microcontroller while interfacing standalone IC modules, display modules, for various features implementation. This code example demonstrates implementation of I/O Expander using EUSART peripheral and I/O pins of the PIC16F15276 microcontroller.
11+
The PIC16F152xx family of microcontrollers are available in packages for various embedded applications. The PIC16F15276 simplified feature set includes Peripheral Pin Select (PPS), digital communication peripherals, timers, Enhanced Universal Synchronous Asynchronous Receiver Transmitter (EUSART). In real time applications, EUSART can be configured as a full-duplex asynchronous system or half-duplex synchronous system. Full-Duplex mode is useful for communications with peripheral systems, such as CRT terminals and personal computers. Half-Duplex Synchronous mode is intended for communications with peripheral devices, such as A/D or D/A integrated circuits, serial EEPROMs or other microcontrollers. Several embedded applications use I/O expander to add the additional I/O pins required for the main microcontroller while interfacing standalone IC modules, display modules, for various features implementation. This code example demonstrates implementation of I/O Expander using EUSART peripheral and I/O pins of the PIC16F15276 microcontroller.
1212

1313
Refer code example [UART I/O Expander Implementation using PIC16F15276](https://github.com/microchip-pic-avr-examples/pic16f15276-cnano-uart-io-expander-client-mplab-mcc.git) for more details about the client device implementation.
1414

@@ -23,7 +23,7 @@ Refer code example [UART I/O Expander Implementation using PIC16F15276](https://
2323

2424
## Description
2525

26-
In this code example, host microcontroller expects to display the numbers on Seven Segment Display (SSD). To interface SSD with the host device, it requires minimum 7 general purpose I/O pins. To minimize the usage of I/O pins on host, a secondary microcontroller is used as client for driving the SSD and, UART serial communication interface is used for communication between both the host and client devices. To establish communication between host device and client device UART serial communication interface is used.
26+
In this code example, host microcontroller expects to display the numbers on Seven Segment Display (SSD). To interface SSD with the host device, it requires minimum 7 general purpose I/O pins. To minimize the usage of I/O pins on host, a secondary microcontroller is used as client for driving the SSD and, UART serial communication interface to communicate between the host and client device. To establish communication between the host and client device, UART serial communication interface is used.
2727

2828
For the ease of demonstration, this code example uses PIC16F15276 microcontroller as host microcontroller and another PIC16F15276 microcontroller as client microcontroller. Also, the code example uses PIC16F15276 Curiosity nano development boards for the demonstration.
2929

@@ -86,18 +86,18 @@ Resistor ( R ) = (V<sub>in</sub> – V<sub>f</sub> ) / ( I<sub>f</sub> ) = 140 o
8686

8787
Microchip’s free IDE, compiler and graphical code generators are used throughout the application firmware development. Following are the tools used for this demo application:
8888

89-
* MPLAB® X IDE [v6.00.0 or newer](https://www.microchip.com/mplab/mplab-x-ide)
90-
* XC8 Compiler [v2.36.0 or newer](https://www.microchip.com/mplab/compilers)
91-
* MPLAB Code Configurator (MCC) [v5.0.3](https://www.microchip.com/mplab/mplab-code-configurator)
92-
* UART MCC Melody driver 1.6.0
93-
* Microchip PIC16F1xxxx Series Device Support [1.9.163 or newer](https://packs.download.microchip.com/)
89+
* [MPLAB® X IDE](https://www.microchip.com/mplab/mplab-x-ide) 6.15.0 or newer
90+
* [MPLAB® XC8 Compiler](https://www.microchip.com/mplab/compilers) 2.45.0 or newer
91+
* [MPLAB® Code Configurator (MCC)](https://www.microchip.com/mplab/mplab-code-configurator) 5.3.7 or newer
92+
* [Microchip PIC16F1xxxx_DFP Device Support](https://packs.download.microchip.com/) 1.21.368 or newer pack
93+
* ESUART MCC Melody driver 7.1.5
9494

9595
***Note: For running the demo, the installed tool versions should be the same or later. This example is not tested with the previous versions.***
9696

9797
## Hardware Used
9898

99-
* [PIC16F15244 Curiosity Nano](https://www.microchip.com/en-us/product/PIC16F15244 "PIC16F15244 Curiosity Nano")
100-
* [Curiosity Nano Base for Click boards](https://www.microchip.com/developmenttools/ProductDetails/AC164162 "Curiosity Nano Base for Click boards")
99+
* [PIC16F15276 Curiosity Nano Board](https://www.microchip.com/en-us/development-tool/EV35F40A)
100+
* [Curiosity Nano Base for Click Boards<sup>TM</sup>](https://www.microchip.com/en-us/development-tool/AC164162)
101101
* [PROTO Xplained Pro Extension Kit](https://www.microchip.com/en-us/development-tool/ATPROTO1-XPRO "PROTO Xplained Pro Extension Kit")
102102
* Seven Segment Display
103103

@@ -118,7 +118,7 @@ The following figure consists of populated PROTO Xplained Pro extension kit, Cur
118118
<br>Figure 4: Hardware Setup <br>
119119
</p>
120120

121-
***Note: In order to use on-board mechanical switch, timer is used to avoid the debouncing. Thereby, timer input pin RC3 and pin RB5 (on-board switch), need to be shorted using a jumper. The usage of jumper is required as RB5 pin cannot be selected as timer input through PPS feature of the PIC16F15276 microcontroller.***
121+
***Note: In order to use on-board mechanical switch on host device, timer is used to avoid the debouncing. Thereby, timer input pin RC3 and pin RB5 (on-board switch), need to be shorted using a jumper. The usage of jumper is required as RB5 pin cannot be selected as timer input through PPS feature of the PIC16F15276 microcontroller.***
122122

123123
## Operation
124124

@@ -135,28 +135,27 @@ In many real-world embedded applications, the microcontroller requires to interf
135135

136136
## Appendix
137137

138-
MCC – MPLAB<sup>®</sup> Code Configurator is a graphical programming environment that generates seamless, easy to understand C code to give a head start to the project, saving the designer’s time to initialize and configure all the modules, and to go through the datasheets. Using an instructive interface, it enables and configures all peripherals and functions specific to the application requirements.
138+
MPLAB<sup>®</sup> Code Configurator is a graphical programming environment that generates seamless, easy to understand C code to give a head start to the project, saving the designer’s time to initialize and configure all the modules, and to go through the datasheets. Using an instructive interface, it enables and configures all peripherals and functions specific to the application requirements.
139139

140140
**Start by creating a new Project and open MCC**
141-
- Go to File > New Project
142-
- Select Microchip Embedded > Standalone Project
143-
- Enter the device name. In this case, select PIC16F15276 device
141+
- Go to **File** and click **New Project**
142+
- Select **Microchip Embedded** and click **Standalone Project**
143+
- Enter the device name, in this case, PIC16F15276
144144
- Name the project
145145
- Launch MCC tool by navigating to ***“Tools -> Embedded -> MPLAB Code Configurator v4: Open/Close”*** . Alternatively, click the MCC icon to launch the MCC tool.
146146

147147
## System Configuration
148148

149149
- Configure Clock
150150

151-
Open "Clock Control" setup present under "System" dropdown menu in "Project Resources" tab. Host and the client device will be configured with same configuration as given below.
151+
Open **Clock Control** setup present under "System" dropdown menu in **Project Resources** tab. Host and the client device will be configured with same configuration as given below.
152152

153-
Set "Clock Source" as "HFINTOSC"
154-
-- Set "HF Internal Clock" as "8_MHz"
155-
-- Enable low power programming checkbox
153+
- Set Clock Source as HFINTOSC
154+
- Set HF Internal Clock as 8_MHz
156155

157-
The system configuration window of MCC is used for MCU oscillator, Watchdog timer and low voltage programming configuration. The Watchdog timer is disabled in the application.
156+
The **configurations Bits**(**Project Resources** -> **System**) window in MCC is used for MCU oscillator, Watchdog timer and low voltage programming configuration. The Watchdog timer is disabled in the application.
158157

159-
The following figure shows the system configuration setting in MCC tool.
158+
The following figure shows the clock configuration setting in MCC tool.
160159

161160
<p align="center">
162161
<img width=600 height=auto src="images/clk_config.png">
@@ -165,17 +164,17 @@ The following figure shows the system configuration setting in MCC tool.
165164

166165
- Timer 2 Configuration
167166

168-
Configure Timer2 in HLT mode for switch debouncing functionality with the following configuration.
167+
Configure Timer2 in HLT mode for switch debouncing functionality with the following configuration.
169168

170-
-- Enable Timer checkbox
171-
-- Control Mode – Monostable
172-
-- Ext Reset – T2INPPS
173-
-- Start/Reset Option – Start on rising edge on TMR2_ers
174-
-- Clock Source – MFINTOSC 31.25kHz
175-
-- Polarity – Rising Edge
176-
-- Prescaler – 1:16, Postscaler – 1:1
177-
-- Time Period – 100ms
178-
-- Enable Timer Interrupt checkbox
169+
- Enable Timer checkbox
170+
- Control Mode – Monostable
171+
- Ext Reset – T2INPPS
172+
- Start/Reset Option – Start on rising edge on TMR2_ers
173+
- Clock Source – MFINTOSC 31.25kHz
174+
- Polarity – Rising Edge
175+
- Prescaler – 1:16, Postscaler – 1:1
176+
- Time Period – 100ms
177+
- Enable Timer Interrupt checkbox
179178

180179
<p align="center">
181180
<img width=600 height=auto src="images/tmr_config.png">
@@ -205,4 +204,4 @@ The following images informs about the pin usage in the project.
205204
<p align="center">
206205
<img width=600 height=auto src="images/pin_config_client.png">
207206
<br>Figure 9: Pin Configuration (Client) <br>
208-
</p>
207+
</p>

pic16f15276-cnano-uart-io-expander-host-mplab-mcc.X/application.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void Application(void)
2424
button = STATE_READ; // Reset button state
2525
EUSART1_Write(START_7_SEG_DISP_LOOP); // Send command to initiate communication
2626
LED_SetLow(); // Toggle LED for visual indication
27-
while(!EUSART1_IsRxReady()); // Check if transmit has happened successfully
27+
while(!EUSART1_IsTxReady()); // Check if transmit has happened successfully
2828
__delay_ms(LED_HOLD_PERIOD);
2929
LED_SetHigh();
3030
}

pic16f15276-cnano-uart-io-expander-host-mplab-mcc.X/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212

1313
/*
14-
© [2022] Microchip Technology Inc. and its subsidiaries.
14+
© [2023] Microchip Technology Inc. and its subsidiaries.
1515
1616
Subject to your compliance with these terms, you may use Microchip
1717
software and any derivatives exclusively with Microchip products.
@@ -59,7 +59,7 @@ int main(void)
5959

6060
printf("\n\t EUSART HOST DEVICE \r\n\n");
6161

62-
Timer2_OverflowCallbackRegister(TMR2_UserInterruptHandler); // Used for switch press detection and avoid switch de-bouncing
62+
TMR2_OverflowCallbackRegister(TMR2_UserInterruptHandler); // Used for switch press detection and avoid switch de-bouncing
6363

6464
while(1)
6565
{

pic16f15276-cnano-uart-io-expander-host-mplab-mcc.X/mcc_generated_files/system/clock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313

1414
/*
15-
© [2022] Microchip Technology Inc. and its subsidiaries.
15+
© [2023] Microchip Technology Inc. and its subsidiaries.
1616
1717
Subject to your compliance with these terms, you may use Microchip
1818
software and any derivatives exclusively with Microchip products.
Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,17 @@
11
/**
2-
@Generated CCL Header File
3-
4-
@Company:
5-
Microchip Technology Inc.
6-
7-
@File Name:
8-
config_bits.h
9-
10-
@Summary:
11-
This is the config_bits.h file generated using CCL
12-
13-
@Description:
14-
This header file provides implementations for driver APIs for all modules selected in the GUI.
15-
Generation Information :
16-
Driver Version : 2.00
17-
The generated drivers are tested against the following:
18-
Compiler : XC8 v2.31
19-
MPLAB : MPLAB X 5.45
2+
* CONFIGURATION BITS Generated Driver Header File
3+
*
4+
* @file config_bits.h
5+
*
6+
* @defgroup config_bitsdriver CONFIGBITS Driver
7+
*
8+
* @brief This file contains the API prototype for the Configuration Bits driver.
9+
*
10+
* @version Driver Version 2.0.1
2011
*/
2112

2213
/*
23-
© [2022] Microchip Technology Inc. and its subsidiaries.
14+
© [2023] Microchip Technology Inc. and its subsidiaries.
2415
2516
Subject to your compliance with these terms, you may use Microchip
2617
software and any derivatives exclusively with Microchip products.
@@ -46,3 +37,6 @@
4637
#include "../system/clock.h"
4738

4839
#endif //CONFIG_BITS_H
40+
/**
41+
End of File
42+
*/

0 commit comments

Comments
 (0)