Skip to content

Commit d502a8b

Browse files
Gabriel UrsGabriel Urs
authored andcommitted
MPAE-20124: Update code and readme
1 parent d2cc8dd commit d502a8b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1309
-104
lines changed

.main-meta/main.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"content": {
55
"metaDataVersion": "1.3.0",
66
"name": "com.microchip.mcu8.mplabx.project.pic18f56q71-mtch9010-dynamic-cfg-change",
7-
"version": "1.0.1",
7+
"version": "1.0.2",
88
"displayName": "MTCH9010 Dynamic Configuration Change Using the PIC18F56Q71 Microcontroller with MCC Melody",
99
"projectName": "pic18f56q71-mtch9010-dynamic-cfg-change",
1010
"shortDescription": "This repository contains two MPLAB X projects demonstrating dynamic configuration changes for MTCH9010 using Enhanced Configuration mode or configuration input pins, with the PIC18F56Q71 microcontroller as the host device.",
@@ -24,7 +24,7 @@
2424
},
2525
"configurator": {
2626
"name": "MCC",
27-
"semverRange": ">=5.7.1"
27+
"semverRange": ">=5.6.2"
2828
},
2929
"device": {
3030
"metaDataVersion": "1.0.0",
@@ -40,12 +40,17 @@
4040
"peripherals": ["UART",
4141
"DAC",
4242
"OPA",
43+
"TMR",
4344
"GPIO"
4445
],
45-
"keywords": ["Capacitive Touch",
46-
"Sensor",
47-
"GPIO",
48-
"MCC Melody"
46+
"keywords": [
47+
"MTCH9010",
48+
"Liquid Detection",
49+
"Human Machine Interface",
50+
"Capacitive Touch",
51+
"Sensor",
52+
"GPIO",
53+
"MCC Melody"
4954
],
5055
"additionalData": {
5156
"longDescription": {

Enhanced_Configuration_Mode/README.md

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,36 @@
11
<!-- Please do not change this html logo with link -->
22

3-
<a href="https://www.microchip.com" rel="nofollow"><img src="images/microchip.png" alt="MCHP" width="300"/></a>
3+
<a target="_blank" href="https://www.microchip.com/" id="top-of-page">
4+
<picture>
5+
<source media="(prefers-color-scheme: light)" srcset="images/mchp_logo_light.png" width="350">
6+
<source media="(prefers-color-scheme: dark)" srcset="images/mchp_logo_dark.png" width="350">
7+
<img alt="Microchip Technologies Inc." src="https://www.microchip.com/content/experience-fragments/mchp/en_us/site/header/master/_jcr_content/root/responsivegrid/header/logo.coreimg.100.300.png/1605828081463/microchip.png">
8+
</picture>
9+
</a>
410

511
# MTCH9010 Dynamic Enhanced Configuration Change Using the PIC18F56Q71 Microcontroller with MCC Melody
612

713
This MPLAB® X project shows how to dynamically change the configuration for MTCH9010 using the Enhanced Configuration mode. The PIC18F56Q71 microcontroller is used as a host device and the configuration is realized using the Universal Asynchronous Receiver Transmitter (UART) peripheral.
814

915
## Related Documentation
1016
- [MTCH9010 Product Page](https://www.microchip.com/en-us/product/MTCH9010?utm_source=GitHub&utm_medium=TextLink&utm_campaign=MCU8_PIC18-Q71&utm_content=pic18f56q71-mtch9010-dynamic-cfg-change-github&utm_bu=MCU08)
17+
- [MTCH9010 Data Sheet](https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ProductDocuments/DataSheets/MTCH9010-DataSheet-DS40002635.pdf)
18+
- [MTCH9010 Code Examples on GitHub](https://github.com/microchip-pic-avr-examples/?q=MTCH9010)
19+
- [MTCH9010 Resources on MPLAB Discover](https://mplab-discover.microchip.com/v2?dsl=MTCH9010)
1120
- [PIC18F56Q71 Product Page](https://www.microchip.com/en-us/product/PIC18F56Q71?utm_source=GitHub&utm_medium=TextLink&utm_campaign=MCU8_PIC18-Q71&utm_content=pic18f56q71-mtch9010-dynamic-cfg-change-github&utm_bu=MCU08)
12-
- [PIC18F56Q71 Code Examples on Discover](https://mplab-discover.microchip.com/v2?dsl=PIC18F56Q71)
1321
- [PIC18F56Q71 Code Examples on GitHub](https://github.com/microchip-pic-avr-examples/?q=PIC18F56Q71)
22+
- [PIC18F56Q71 Resources on MPLAB Discover](https://mplab-discover.microchip.com/v2?dsl=PIC18F56Q71)
1423

1524
## Software Used
16-
- [MPLAB X IDE v6.25 or newer](https://www.microchip.com/en-us/tools-resources/develop/mplab-x-ide?utm_source=GitHub&utm_medium=TextLink&utm_campaign=MCU8_PIC18-Q71&utm_content=pic18f56q71-mtch9010-dynamic-cfg-change-github&utm_bu=MCU08)
17-
- [MPLAB® XC8 v3.00 or newer](https://www.microchip.com/en-us/tools-resources/develop/mplab-xc-compilers?utm_source=GitHub&utm_medium=TextLink&utm_campaign=MCU8_PIC18-Q71&utm_content=pic18f56q71-mtch9010-dynamic-cfg-change-github&utm_bu=MCU08)
18-
- [PIC18F-Q_DFP 1.28.451 or newer](https://packs.download.microchip.com/)
25+
- [MPLAB X IDE v6.25](https://www.microchip.com/en-us/tools-resources/develop/mplab-x-ide?utm_source=GitHub&utm_medium=TextLink&utm_campaign=MCU8_PIC18-Q71&utm_content=pic18f56q71-mtch9010-dynamic-cfg-change-github&utm_bu=MCU08) or newer
26+
- [MPLAB® XC8 v3.00](https://www.microchip.com/en-us/tools-resources/develop/mplab-xc-compilers?utm_source=GitHub&utm_medium=TextLink&utm_campaign=MCU8_PIC18-Q71&utm_content=pic18f56q71-mtch9010-dynamic-cfg-change-github&utm_bu=MCU08) or newer
27+
- [PIC18F-Q_DFP 1.28.451](https://packs.download.microchip.com/) or newer
1928

2029
## Hardware Used
21-
22-
- The [PIC18F56Q71 Curiosity Nano Development board](https://www.microchip.com/en-us/development-tool/EV01G21A?utm_source=GitHub&utm_medium=TextLink&utm_campaign=MCU8_PIC18-Q71&utm_content=pic18f56q71-mtch9010-dynamic-cfg-change-github&utm_bu=MCU08) is used as a test platform:
23-
<br><img src="images/pic18f56q71-curiosity-nano-board.png" width="600">
2430
- [MTCH9010](https://www.microchip.com/en-us/product/MTCH9010?utm_source=GitHub&utm_medium=TextLink&utm_campaign=MCU8_PIC18-Q71&utm_content=pic18f56q71-mtch9010-dynamic-cfg-change-github&utm_bu=MCU08)
25-
<br><img src="images/mtch9010.png" width="600">
31+
<br><img src="images/mtch9010.png" width="400">
32+
- [PIC18F56Q71 Curiosity Nano Development board](https://www.microchip.com/en-us/development-tool/EV01G21A?utm_source=GitHub&utm_medium=TextLink&utm_campaign=MCU8_PIC18-Q71&utm_content=pic18f56q71-mtch9010-dynamic-cfg-change-github&utm_bu=MCU08)
33+
<br><img src="images/pic18f56q71-curiosity-nano-board.png" width="600">
2634

2735
## Operation
2836

@@ -33,15 +41,14 @@ To program the Curiosity Nano board with this MPLAB X project, follow the steps
3341
In Enhanced Configuration mode, the MTCH9010 device can be configured using the UART communication protocol. To enter in this configuration mode, the following settings should be done on the MTCH9010 configuration pins:
3442
- The SYS_LK pin should be set to high (disabled)
3543
- The CFG_EN pin should be set to low (enabled)
36-
- The UART_EN pin should be set to low (enabled)
3744

3845
A Reset of the device is needed after the pins are configured to enter the configuration mode. This can be done using the RESET pin by making it low for a period of time (10 ms are used in this example) and then restore it to high.
3946

4047
After the Reset operation, the device will send the firmware version on the serial port and then wait for the configuration commands. Each command sent should be followed by a validation key (with the ASCII code equal to 0x0D in hexadecimal system). After a command is sent, the device will respond with ACK (Acknowledge, 0x06 in hexadecimal system) or NAK (Negative Acknowledge, 0x15 in hexadecimal system) followed by the validation key. If a NAK signal is received, the command must be sent again until it is validated by the device with an ACK signal.
4148

42-
In this code example, the `MTCH9010.h` and `MTCH9010.c` files contains the implementation of the functions used to configure the device in Enhanced Configuration mode. The `mtch9010_config_t` structure is used to simply define the parameters of the configuration that need to be sent. The `MTCH9010_Config(mtch9010_config_t configData)` function can be used to configure the device. This function sets the pins for configuration mode, reset the device and then send the configuration parameters using the UART1 peripheral. The function also implements a mechanism that verifies if each command is validated by the ACK signal. If it is validated, the program continues with the next command in the same way. If it is not validated, the program repeats the transmission. Each command is repeated for a maximum number of five times. After that the function returns an error code and the program blocks in an infinite loop. A message about the error code is also displayed on serial port using the UART2 peripheral.
49+
In this code example, the `MTCH9010.h` and `MTCH9010.c` files contains the implementation of the functions used to configure the device in Enhanced Configuration mode. The `mtch9010_config_t` structure is used to simply define the parameters of the configuration that need to be sent. The `MTCH9010_Config(mtch9010_config_t configData)` function can be used to configure the device. This function sets the pins for configuration mode, reset the device and then send the configuration parameters using the UART1 peripheral. The function also implements a mechanism that verifies if each command is validated by the ACK signal. If it is validated, the program continues with the next command in the same way. If it is not validated, the program repeats the transmission. Each command is repeated for a maximum number of five times. After that the function returns an error code and the program blocks in an infinite loop. A message about the error code is also displayed on serial port using the UART2 peripheral.
4350

44-
This example contains two configurations of the MTCH9010. The user can switch between configurations using the on-board button of the PIC18F56Q71 Curiosity Nano. An Interrupt-on-Change (IOC) is generated on the negative edge of the button input. After the interrupt occurs, a debouncing mechanism is implemented using a software delay. The state of the button is verified in the main loop after a 10 ms delay to determine if the pressed state is maintained. The parameters of the two configurations are shown below:
51+
This example contains two configurations of the MTCH9010. The user can switch between configurations using the on-board button of the PIC18F56Q71 Curiosity Nano. An Interrupt-on-Change (IOC) is generated on the negative edge of the button input. After the interrupt occurs, a debouncing mechanism is implemented using TMR0 peripheral. The button state is verified after a 20ms delay, triggered by the TMR0 overflow interrupt, to ensure that the pressed state is maintained. The parameters of the two configurations are shown below:
4552
- Configuration 1:
4653
- SYS_LK: Enabled
4754
- CFG_EN: Disabled
@@ -98,10 +105,18 @@ The following peripheral and clock configurations are set up using the MPLAB Cod
98105
- Enable UART: Enabled
99106
<br><img src="images/mcc-uart2-plib.png" width="600">
100107

101-
6. Pin Grid View
108+
6. TMR0
109+
- Timer Enable: Disabled
110+
- Clock Source: LFINTOSC
111+
- Prescaler: 1:4
112+
- Requested Period: 20ms
113+
- TMR Interrupt Enable: Enabled
114+
<br><img src="images/mcc-tmr0.png" width="600">
115+
116+
7. Pin Grid View
102117
<br><img src="images/mcc-pin-grid.png" width="600">
103118

104-
7. Pins
119+
8. Pins
105120
<br><img src="images/mcc-pins.png" width="600">
106121

107122
The following pins are used to control MTCH9010:
@@ -114,7 +129,6 @@ The following pins are used to control MTCH9010:
114129
| RD1 | Digital output | MTCH9010 RESET pin | RESET |
115130
| RD2 | Digital output | MTCH9010 CFG_EN pin | CFG_EN |
116131
| RD3 | Digital output | MTCH9010 SYS_LK pin | SYS_LK |
117-
| RD4 | Digital output | MTCH9010 UART_EN pin | UART_EN |
118132

119133
## Demo
120134

-14 KB
Loading
810 Bytes
Loading
-5.63 KB
Loading
-12.1 KB
Loading
116 KB
Loading
663 Bytes
Loading
-107 Bytes
Loading
923 Bytes
Loading

0 commit comments

Comments
 (0)