Skip to content

Commit 4c00072

Browse files
Usha Gsaikprasad
authored andcommitted
MPAE-18347 Updated readme and firmware
1 parent 2e1df9c commit 4c00072

Some content is hidden

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

45 files changed

+2604
-2006
lines changed

.main-meta/main.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@
1010
"shortDescription": "This example demonstrates UART-I2C bridge implementation using PIC MCU. The PIC16F15244 MCU processes periodically acquired sensor data and also acts as a I2C client. Compatible PIC16F152xx family of MCUs are PIC16F15214, PIC16F15223, PIC16F15254, PIC16F15276.",
1111
"ide": {
1212
"name": "MPLAB X",
13-
"semverRange": ">=6.15.0"
13+
"semverRange": ">=6.20.0"
1414
},
1515
"compiler": [
1616
{
1717
"name": "XC8",
18-
"semverRange": "^2.45.0"
18+
"semverRange": "^2.50.0"
1919
}
2020
],
2121
"dfp": {
2222
"name": "PIC16F1xxxx_DFP",
23-
"semverRange": "^1.23.382"
23+
"semverRange": "^1.25.389"
2424
},
2525
"configurator": {
2626
"name": "MCC",
27-
"semverRange": ">=5.3.7"
27+
"semverRange": ">=5.7.1"
2828
},
2929
"device": {
3030
"metaDataVersion": "1.0.0",

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,13 @@ The input commands and clients I2C address information has been displayed on the
3535

3636
## Software Used
3737

38-
- MPLAB® X IDE [6.15 or newer](http://www.microchip.com/mplab/mplab-x-ide)
39-
- MPLAB® XC8 [2.45 or newer](http://www.microchip.com/mplab/compilers)
40-
- MPLAB® Code Configurator (MCC) [5.3.7 or newer](https://www.microchip.com/mplab/mplab-code-configurator)
41-
- Microchip PIC16F1xxxx Series Device Support [1.23.382 or newer](https://packs.download.microchip.com/)
42-
- MCC Melody Core 2.6.3
38+
- MPLAB® X IDE [6.20 or newer](http://www.microchip.com/mplab/mplab-x-ide)
39+
- MPLAB® XC8 [2.50 or newer](http://www.microchip.com/mplab/compilers)
40+
- MPLAB® Code Configurator (MCC) [5.7.1 or newer](https://www.microchip.com/mplab/mplab-code-configurator)
41+
- Microchip PIC16F1xxxx Series Device Support [1.25.389 or newer](https://packs.download.microchip.com/)
4342
- MSSP MCC Melody Core 7.0.1
4443
- ADC MCC Melody Core 3.0.10
45-
- TMR0 MCC Melody Core 4.0.12
44+
- TMR0 MCC Melody Core 4.0.13
4645
- UART MCC Melody Core 1.10.0
4746

4847
## Hardware Used

pic16f15244-usart-i2c-bridge-client2-mplab-mcc.X/Makefile renamed to pic16f15244-uart-i2c-bridge-i2c-client2-mplab-mcc.X/Makefile

File renamed without changes.

pic16f15244-usart-i2c-bridge-client2-mplab-mcc.X/application.c renamed to pic16f15244-uart-i2c-bridge-i2c-client2-mplab-mcc.X/application.c

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "stdlib.h"
66
#include "stdio.h"
77

8+
89
/*******************************************************************************
910
* void Application(void)
1011
*
@@ -21,7 +22,7 @@ void Application(void)
2122
if(timerInterruptFlag == SET)
2223
{
2324
#ifdef DEBUG
24-
EUSART1_SendString("Timer WakeUP\n"); // only for debug
25+
printf("Timer WakeUP\n"); // only for debug
2526
#endif
2627
Sensor2_DataProcessing(); //Read Analog Sensor 2 and calibration
2728
Sensor3_DataProcessing(); //Read Analog Sensor 3 and calibration
@@ -30,7 +31,7 @@ void Application(void)
3031
else if(SSP1STATbits.I2C_START)
3132
{
3233
#ifdef DEBUG
33-
EUSART1_SendString(" I2C WakeUP\n"); //only for debug
34+
printf(" I2C WakeUP\n"); //only for debug
3435
#endif
3536
if(i2cRdDataIndex >= LENGTH)
3637
{
@@ -46,7 +47,7 @@ void Application(void)
4647
}
4748
else
4849
{
49-
// SLEEP();
50+
SLEEP();
5051
}
5152

5253
}
@@ -110,7 +111,9 @@ void Sensor2_DataProcessing(void)
110111
dataBuffer = (((float)adcBuffer/ADC_MAX_VALUE )* VDD);
111112
buffer = ((dataBuffer / VDD) * TEMP_CONSTANT);
112113
temp_Value = (uint8_t)(TEMP_CONSTANT1 + buffer);
113-
sensor_Data_Register[ZERO]= temp_Value;
114+
sensor_Data_Register[ZERO]= temp_Value;
115+
116+
114117
}
115118

116119
/*******************************************************************************
@@ -134,6 +137,7 @@ void Sensor3_DataProcessing(void)
134137
buffer = (dataBuffer / (ADC_MAX_VALUE-1));
135138
soilSensor_Value = (uint8_t)(buffer * 100);
136139
sensor_Data_Register[ONE] = soilSensor_Value;
140+
137141
}
138142

139143
/*******************************************************************************
@@ -159,7 +163,6 @@ void TimerInterruptHandler(void)
159163
******************************************************************************/
160164
bool I2C_ClientInterruptHandler(i2c_client_transfer_event_t event)
161165
{
162-
163166
switch (event)
164167
{
165168
case I2C_CLIENT_TRANSFER_EVENT_ADDR_MATCH:
@@ -176,25 +179,19 @@ bool I2C_ClientInterruptHandler(i2c_client_transfer_event_t event)
176179
case I2C_CLIENT_TRANSFER_EVENT_RX_READY:
177180
if(currentClient == CLIENT2_7_BIT_ADDR)
178181
{
179-
180-
{
181182
i2cRdData[i2cRdDataIndex++] = I2C1_ReadByte();
182-
}
183183
}
184184
break;
185185
case I2C_CLIENT_TRANSFER_EVENT_TX_READY:
186-
if(currentClient == CLIENT2_7_BIT_ADDR)
187-
{
188-
for( uint8_t index = 0;index < i2cRxDataLength;index++)
189-
{
190-
I2C1_WriteByte(i2cWrData[index]);
191-
}
192-
i2cRxDataLength = 0;
186+
I2C1_WriteByte(i2cWrData[index++]);
187+
if(index > i2cRxDataLength)
188+
{
189+
index = 0;
193190
}
194191
break;
195192

196193
case I2C_CLIENT_TRANSFER_EVENT_STOP_BIT_RECEIVED:
197-
// i2cRdDataIndex = 0x00;
194+
//i2cRdDataIndex = 0x00;
198195
break;
199196

200197
default:

pic16f15244-usart-i2c-bridge-client2-mplab-mcc.X/application.h renamed to pic16f15244-uart-i2c-bridge-i2c-client2-mplab-mcc.X/application.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ client_t currentClient;
6868
* File Global variables
6969
* **********************************************************
7070
**/
71-
uint8_t sensor_Data_Register[LENGTH] __at(0x76);
71+
uint8_t sensor_Data_Register[2] __at(0x76);
7272
//uint8_t sensor2_Data_Register_Adress[LENGTH] = {0x76};
7373
//uint8_t sensor3_Data_Register_Adress[LENGTH] = {0x77};
7474
uint8_t i2cWrData[LENGTH];
@@ -80,6 +80,7 @@ uint8_t temp_Value;
8080
uint8_t i2cRxDataLength;
8181
uint8_t i2cRxSensorRegisterAddress;
8282
volatile uint8_t timerInterruptFlag = SET;
83+
volatile uint8_t index = CLEAR;
8384
/**
8485
* **********************************************************
8586
* Function declarations

pic16f15244-uart-i2c-bridge-i2c-client2-mplab-mcc.X/defmplabxtrace.log

Whitespace-only changes.
Binary file not shown.

pic16f15244-usart-i2c-bridge-client2-mplab-mcc.X/main.c renamed to pic16f15244-uart-i2c-bridge-i2c-client2-mplab-mcc.X/main.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
*
88
* @brief This is the generated driver implementation file for the MAIN driver.
99
*
10-
* @version MAIN Driver Version 1.0.0
10+
* @version MAIN Driver Version 1.0.2
11+
*
12+
* @version Package Version: 3.1.2
1113
*/
1214

1315
/*
14-
© [2021] Microchip Technology Inc. and its subsidiaries.
16+
© [2024] Microchip Technology Inc. and its subsidiaries.
1517
1618
Subject to your compliance with these terms, you may use Microchip
1719
software and any derivatives exclusively with Microchip products.
@@ -39,7 +41,6 @@
3941
int main(void)
4042
{
4143
SYSTEM_Initialize();
42-
4344
// If using interrupts in PIC18 High/Low Priority Mode you need to enable the Global High and Low Interrupts
4445
// If using interrupts in PIC Mid-Range Compatibility Mode you need to enable the Global and Peripheral Interrupts
4546
// Use the following macros to:
@@ -53,8 +54,6 @@ int main(void)
5354
// Enable the Peripheral Interrupts
5455
INTERRUPT_PeripheralInterruptEnable();
5556

56-
// Disable the Peripheral Interrupts
57-
//INTERRUPT_PeripheralInterruptDisable();
5857
Timer0_OverflowCallbackRegister(TimerInterruptHandler);
5958
I2C1_CallbackRegister(I2C_ClientInterruptHandler);
6059
LED_SetLow();
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# This file has been autogenerated by MPLAB Code Configurator. Please do not edit this file.
2+
3+
manifest_file_version: 1.0.0
4+
project: pic16f15244-uart-i2c-bridge-i2c-client2-mplab-mcc
5+
creation_date: 2024-08-22T09:56:58.160+05:30[Asia/Calcutta]
6+
operating_system: Windows 10
7+
mcc_mode: IDE
8+
mcc_mode_version: v6.20
9+
device_name: PIC16F15244
10+
compiler: XC8 2.50
11+
mcc_version: 5.5.1
12+
mcc_core_version: 5.7.1
13+
content_manager_version: 5.0.1
14+
is_mcc_offline: false
15+
is_using_prerelease_versions: true
16+
mcc_content_registries: https://registry.npmjs.org/,https://artifacts.microchip.com/artifactory/api/npm/npm/
17+
device_library: {library_class: com.microchip.mcc.melody.Library, name: Melody, version: 2.7.1}
18+
packs: {name: PIC16F1xxxx_DFP, version: 1.26.395}
19+
modules:
20+
- {name: '@mchp-mcc/i2c-client-driver', type: MELODY, version: 2.0.4}
21+
- {name: '@mchp-mcc/main-manager', type: MELODY, version: 3.1.2}
22+
- {name: '@mchp-mcc/pic-8bit', type: MELODY, version: 5.28.2}
23+
- {name: '@mchp-mcc/pic16-configuration-bits-v2', type: MELODY, version: 4.1.3}
24+
- {name: '@mchp-mcc/pic16-pin-manager', type: MELODY, version: 3.6.1}
25+
- {name: '@mchp-mcc/pin-content-processor', type: MELODY, version: 3.8.0}
26+
- {name: '@mchp-mcc/scf-pic8-adc-v1', type: MELODY, version: 3.0.10}
27+
- {name: '@mchp-mcc/scf-pic8-eusart-v1', type: MELODY, version: 7.1.6}
28+
- {name: '@mchp-mcc/scf-pic8-interrupt-v2', type: MELODY, version: 5.2.11}
29+
- {name: '@mchp-mcc/scf-pic8-mssp-v1', type: MELODY, version: 7.0.1}
30+
- {name: '@mchp-mcc/scf-pic8-osc-v2', type: MELODY, version: 4.2.2}
31+
- {name: '@mchp-mcc/scf-pic8-tmr0-v1', type: MELODY, version: 4.0.13}
32+
- {name: '@mchp-mcc/uart-driver', type: MELODY, version: 1.10.2}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# This file has been autogenerated by MPLAB Code Configurator. Please do not edit this file.
2+
3+
manifest_file_version: 1.0.0
4+
project: pic16f15244-uart-i2c-bridge-i2c-client2-mplab-mcc
5+
creation_date: 2024-08-22T09:56:58.137+05:30[Asia/Calcutta]
6+
operating_system: Windows 10
7+
mcc_mode: IDE
8+
mcc_mode_version: v6.20
9+
device_name: PIC16F15244
10+
compiler: XC8 2.50
11+
mcc_version: 5.5.1
12+
mcc_core_version: 5.7.1
13+
content_manager_version: 5.0.1
14+
is_mcc_offline: false
15+
is_using_prerelease_versions: true
16+
mcc_content_registries: https://registry.npmjs.org/,https://artifacts.microchip.com/artifactory/api/npm/npm/
17+
device_library: {library_class: com.microchip.mcc.melody.Library, name: Melody, version: 2.7.1}
18+
packs: {name: PIC16F1xxxx_DFP, version: 1.26.395}
19+
modules:
20+
- {name: '@mchp-mcc/i2c-client-driver', type: MELODY, version: 2.0.4}
21+
- {name: '@mchp-mcc/main-manager', type: MELODY, version: 3.1.2}
22+
- {name: '@mchp-mcc/pic-8bit', type: MELODY, version: 5.28.2}
23+
- {name: '@mchp-mcc/pic16-configuration-bits-v2', type: MELODY, version: 4.1.3}
24+
- {name: '@mchp-mcc/pic16-pin-manager', type: MELODY, version: 3.6.1}
25+
- {name: '@mchp-mcc/pin-content-processor', type: MELODY, version: 3.8.0}
26+
- {name: '@mchp-mcc/scf-pic8-adc-v1', type: MELODY, version: 3.0.10}
27+
- {name: '@mchp-mcc/scf-pic8-eusart-v1', type: MELODY, version: 7.1.6}
28+
- {name: '@mchp-mcc/scf-pic8-interrupt-v2', type: MELODY, version: 5.2.11}
29+
- {name: '@mchp-mcc/scf-pic8-mssp-v1', type: MELODY, version: 7.0.1}
30+
- {name: '@mchp-mcc/scf-pic8-osc-v2', type: MELODY, version: 4.2.2}
31+
- {name: '@mchp-mcc/scf-pic8-tmr0-v1', type: MELODY, version: 4.0.13}
32+
- {name: '@mchp-mcc/uart-driver', type: MELODY, version: 1.10.2}

0 commit comments

Comments
 (0)