Skip to content

Commit 121d0ff

Browse files
Usha Gsaikprasad
authored andcommitted
MPAE-18337 Generated the firmware using latest tools
1 parent e08bf1f commit 121d0ff

38 files changed

+1031
-1145
lines changed

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

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* File: application.c
33
* Author: I51005
44
*
5-
* Created on July 28, 2024, 8:02 PM
5+
* Created on June 18, 2025, 3:09 PM
66
*/
77

88

@@ -20,7 +20,7 @@
2020
* Macros definitions
2121
* **********************************************************
2222
**/
23-
//#define _XTAL_FREQ (4000000)
23+
#define _XTAL_FREQ (4000000)
2424
#define DATA_LENGTH (2)
2525
#define WRITE_DATA_LENGTH (2)
2626
#define READ_ONE_BYTE (1)
@@ -116,7 +116,6 @@ void Application(void)
116116
switch(applicationState)
117117
{
118118
case DISPLAY_INFORMATION:
119-
__delay_ms(100);
120119
SensorInformation();
121120
applicationState = DISPLAY_I2C_CLIENT_INFO;
122121
break;
@@ -134,7 +133,7 @@ void Application(void)
134133
}
135134
else if(timerInterrupt_Flag == SET)
136135
{
137-
EUSART1_SendString("Input not received\n");
136+
printf("Input not received\n");
138137
timerInterrupt_Flag = 0;
139138
applicationState = DISPLAY_I2C_CLIENT_INFO;
140139
}
@@ -175,7 +174,7 @@ void Application(void)
175174
}
176175
else if(timerInterrupt_Flag == SET)
177176
{
178-
EUSART1_SendString("Input not received\n");
177+
printf("Input not received\n");
179178
timerInterrupt_Flag = 0;
180179
applicationState = DISPLAY_I2C_CLIENT_INFO;
181180
}
@@ -200,19 +199,19 @@ void Application(void)
200199
}
201200
else if(timerInterrupt_Flag == SET)
202201
{
203-
EUSART1_SendString("Input not received\n");
202+
printf("Input not received\n");
204203
timerInterrupt_Flag = 0;
205204
applicationState = DISPLAY_I2C_CLIENT_INFO;
206205
}
207206
break;
208207
case SEND_I2C_SENSOR_DATA_TO_UART:
209-
I2C_ClientWriteAndRead(clientAddress,dataRegisterAddress,WRITE_DATA_LENGTH ,readDataLength );
208+
I2C_ClientWriteAndRead(clientAddress,(uint8_t*)dataRegisterAddress,WRITE_DATA_LENGTH ,readDataLength );
210209
for(uint8_t index = 0;index < dataLength;index++)
211210
{
212211
*clientRdDataBuffer = sensorDataRdBuffer[index];
213212
transmitBuffer = IntegerToAsciConver(*clientRdDataBuffer,string, baseValue);
214213
EUSART1_SendString((char*)(transmitBuffer));
215-
EUSART1_SendString("\t");
214+
printf("\t");
216215
}
217216
memset(sensorDataRdBuffer, 0 , sizeof(sensorDataRdBuffer));
218217
inputCmdBuffer = 0;
@@ -240,11 +239,6 @@ void EUSART1_SendString(char *str)
240239
{
241240
for(uint8_t index = 0; index < strlen(str); index++)
242241
{
243-
while(0 == PIR1bits.TX1IF)
244-
{
245-
246-
}
247-
248242
EUSART1_Write(str[index]);
249243
}
250244
}
@@ -265,21 +259,21 @@ uint8_t DecodeUartCmdForI2C_Client(char *command)
265259
uint8_t cmdFlag = 0;
266260
if(strcmp(command,CLIENT1) == 0)
267261
{
268-
EUSART1_SendString("Selected Client 1\n");
269-
EUSART1_SendString("Enter '1' to measure pH\n");
262+
printf("Selected Client 1\n");
263+
printf("Enter '1' to measure pH\n");
270264
Timer0_Start();
271265
cmdFlag = 1;
272266
}
273267
else if(strcmp(command,CLIENT2)== 0)
274268
{
275-
EUSART1_SendString("Selected Client 2\n");
276-
EUSART1_SendString("Enter '2' to measure Temperature, '3' to measure Soil moisture, '4' to measure both sensors\n");
269+
printf("Selected Client 2\n");
270+
printf("Enter '2' to measure Temperature, '3' to measure Soil moisture, '4' to measure both sensors\n");
277271
Timer0_Start();
278272
cmdFlag = 2;
279273
}
280274
else
281275
{
282-
EUSART1_SendString("Error! Incorrect CLIENT Address\n");
276+
printf("Error! Incorrect CLIENT Address\n");
283277
cmdFlag = 0;
284278
}
285279
return (cmdFlag);
@@ -298,7 +292,7 @@ uint8_t Eusart1_ReadInput(void)
298292
{
299293
uint8_t readFlag = 0 ;
300294
uint8_t inputStr;
301-
if(eusart1RxCount!=0)
295+
if(EUSART1_IsRxReady())
302296
{
303297
Timer0_Stop();
304298
inputStr = EUSART1_Read();
@@ -333,9 +327,10 @@ uint8_t Eusart1_ReadInput(void)
333327
******************************************************************************/
334328
void SensorInformation(void)
335329
{
336-
EUSART1_SendString("\n\nTwo I2C Clients are connected to I2C Host\n");
337-
EUSART1_SendString("pH Sensor is connected to I2C Client1\n");
338-
EUSART1_SendString("Temperature Sensor and Soil Moisture Sensor are connected to I2C Client2\n");
330+
__delay_ms(10);
331+
printf("\n\nTwo I2C Clients are connected to I2C Host\n");
332+
printf("pH Sensor is connected to I2C Client1\n");
333+
printf("Temperature Sensor and Soil Moisture Sensor are connected to I2C Client2\n");
339334
}
340335

341336
/*******************************************************************************
@@ -351,7 +346,7 @@ void SensorInformation(void)
351346
******************************************************************************/
352347
void DisplayI2C_ClientAddrOnUART(void)
353348
{
354-
EUSART1_SendString("\nEnter '0x0A' address to connect I2C_Client1 or '0x0B' address to connect I2C_Client2\n");
349+
printf("\nEnter '0x0A' address to connect I2C_Client1 or '0x0B' address to connect I2C_Client2\n");
355350
}
356351

357352
/*******************************************************************************
@@ -371,15 +366,15 @@ uint8_t I2C_CLient1SensorCommand(char *command)
371366

372367
if(strcmp(command,SENSOR_1)== 0)
373368
{
374-
EUSART1_SendString("pH is : ");
369+
printf("pH is : ");
375370
clientAddress = CLIENT1_ADDRESS;
376371
readDataLength = READ_ONE_BYTE;
377372
dataRegisterAddress = (uint8_t)sensor1DataRegister;
378373
dataLengthFlag = 1;
379374
}
380375
else
381376
{
382-
EUSART1_SendString("Error! Incorrect Client 1 Command\n");
377+
printf("Error! Incorrect Client 1 Command\n");
383378
dataLengthFlag = 0;
384379
}
385380
return (dataLengthFlag);
@@ -402,31 +397,32 @@ uint8_t I2C_CLient2SensorCommand(char *command)
402397

403398
if(strcmp(command,SENSOR_2)== 0)
404399
{
405-
EUSART1_SendString("Temperature in \260C: ");
400+
printf("Temperature in \260C: ");
406401
clientAddress = CLIENT2_ADDRESS;
407402
readDataLength = READ_ONE_BYTE;
408403
dataRegisterAddress = (uint8_t)sensor2DataRegister;
409404
dataLengthFlag = 1;
405+
410406
}
411407
else if(strcmp(command,SENSOR_3)== 0)
412408
{
413-
EUSART1_SendString("Soil Moisture in \045: ");
409+
printf("Soil Moisture in \045: ");
414410
clientAddress = CLIENT2_ADDRESS;
415411
readDataLength = READ_ONE_BYTE;
416412
dataRegisterAddress = (uint8_t)sensor3DataRegister;
417413
dataLengthFlag = 1;
418414
}
419415
else if(strcmp(command,SENSOR_2AND3)== 0)
420416
{
421-
EUSART1_SendString("Temperature in \260C and Soil Moisture in \045: ");
417+
EUSART1_SendString(" Temperature in \260C and Soil Moisture in \045: ");
422418
clientAddress = CLIENT2_ADDRESS;
423419
readDataLength = READ_TWO_BYTE;
424420
dataRegisterAddress = (uint8_t)sensor2And3DataRegister;
425421
dataLengthFlag = 2;
426422
}
427423
else
428424
{
429-
EUSART1_SendString("Error! Incorrect Client 2 command\n");
425+
printf("Error! Incorrect Client 2 command\n");
430426
dataLengthFlag = 0;
431427
}
432428

@@ -529,3 +525,4 @@ void TimerInterruptHandler(void)
529525
timerInterrupt_Flag = 1;
530526
}
531527

528+

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414

1515
/*
16-
© [2024] Microchip Technology Inc. and its subsidiaries.
16+
© [2025] Microchip Technology Inc. and its subsidiaries.
1717
1818
Subject to your compliance with these terms, you may use Microchip
1919
software and any derivatives exclusively with Microchip products.
@@ -34,7 +34,6 @@
3434
*/
3535
#include "mcc_generated_files/system/system.h"
3636
#include "application.h"
37-
3837
/*
3938
Main application
4039
*/
@@ -59,10 +58,10 @@ int main(void)
5958
//INTERRUPT_PeripheralInterruptDisable();
6059

6160

62-
Timer0_OverflowCallbackRegister(TimerInterruptHandler);
61+
TMR0_PeriodMatchCallbackRegister(TimerInterruptHandler);
62+
6363
while(1)
6464
{
65-
Application(); // Add your application code
66-
}
67-
65+
Application(); // Add your application code
66+
}
6867
}
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
11
# This file has been autogenerated by MPLAB Code Configurator. Please do not edit this file.
22

33
manifest_file_version: 1.0.0
4-
project: pic16f15244-usart-i2c-bridge-host-mplab-mcc
5-
creation_date: 2024-08-22T11:08:50.841+05:30[Asia/Calcutta]
6-
operating_system: Windows 10
4+
project: pic16f15244-uart-i2c-bridge-host-mplab-mcc
5+
creation_date: 2025-06-18T15:16:29.548+05:30[Asia/Calcutta]
6+
operating_system: Windows 11
77
mcc_mode: IDE
8-
mcc_mode_version: v6.20
8+
mcc_mode_version: v6.25
99
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
10+
compiler: XC8 3.00
11+
mcc_version: 5.6.2
12+
mcc_core_version: 5.8.2
13+
content_manager_version: 6.0.1
1414
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}
15+
is_using_prerelease_versions: false
16+
mcc_content_registries: https://registry.npmjs.org/,
17+
device_library: {library_class: com.microchip.mcc.melody.Library, name: Melody, version: 2.9.1}
18+
packs: {name: N/A, version: N/A}
1919
modules:
20-
- {name: '@mchp-mcc/i2c-host-driver', type: MELODY, version: 1.0.5}
20+
- {name: '@mchp-mcc/i2c-host-driver', type: MELODY, version: 1.1.0-dev.1}
2121
- {name: '@mchp-mcc/main-manager', type: MELODY, version: 3.1.2}
22-
- {name: '@mchp-mcc/pic-8bit', type: MELODY, version: 5.28.3-test.1}
22+
- {name: '@mchp-mcc/melody', type: CLASSIC, version: 2.9.1}
23+
- {name: '@mchp-mcc/pic-8bit', type: MELODY, version: 5.29.1}
2324
- {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-eusart-v1', type: MELODY, version: 7.1.6}
27-
- {name: '@mchp-mcc/scf-pic8-interrupt-v2', type: MELODY, version: 5.2.11}
28-
- {name: '@mchp-mcc/scf-pic8-mssp-v1', type: MELODY, version: 7.0.1}
25+
- {name: '@mchp-mcc/pic16-pin-manager', type: MELODY, version: 3.6.2}
26+
- {name: '@mchp-mcc/pin-content-processor', type: MELODY, version: 3.10.0}
27+
- {name: '@mchp-mcc/scf-pic8-eusart-v1', type: MELODY, version: 7.1.7}
28+
- {name: '@mchp-mcc/scf-pic8-interrupt-v2', type: MELODY, version: 5.2.12}
29+
- {name: '@mchp-mcc/scf-pic8-mssp-v1', type: MELODY, version: 7.0.3}
2930
- {name: '@mchp-mcc/scf-pic8-osc-v2', type: MELODY, version: 4.2.2}
30-
- {name: '@mchp-mcc/scf-pic8-tmr0-v1', type: MELODY, version: 4.0.13}
31+
- {name: '@mchp-mcc/scf-pic8-tmr0-v1', type: MELODY, version: 5.1.0}
3132
- {name: '@mchp-mcc/uart-driver', type: MELODY, version: 1.10.2}
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
11
# This file has been autogenerated by MPLAB Code Configurator. Please do not edit this file.
22

33
manifest_file_version: 1.0.0
4-
project: pic16f15244-usart-i2c-bridge-host-mplab-mcc
5-
creation_date: 2024-08-22T11:08:50.812+05:30[Asia/Calcutta]
6-
operating_system: Windows 10
4+
project: pic16f15244-uart-i2c-bridge-host-mplab-mcc
5+
creation_date: 2025-06-18T15:16:29.531+05:30[Asia/Calcutta]
6+
operating_system: Windows 11
77
mcc_mode: IDE
8-
mcc_mode_version: v6.20
8+
mcc_mode_version: v6.25
99
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
10+
compiler: XC8 3.00
11+
mcc_version: 5.6.2
12+
mcc_core_version: 5.8.2
13+
content_manager_version: 6.0.1
1414
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}
15+
is_using_prerelease_versions: false
16+
mcc_content_registries: https://registry.npmjs.org/,
17+
device_library: {library_class: com.microchip.mcc.melody.Library, name: Melody, version: 2.9.1}
18+
packs: {name: N/A, version: N/A}
1919
modules:
20-
- {name: '@mchp-mcc/i2c-host-driver', type: MELODY, version: 1.0.5}
20+
- {name: '@mchp-mcc/i2c-host-driver', type: MELODY, version: 1.1.0-dev.1}
2121
- {name: '@mchp-mcc/main-manager', type: MELODY, version: 3.1.2}
22-
- {name: '@mchp-mcc/pic-8bit', type: MELODY, version: 5.28.3-test.1}
22+
- {name: '@mchp-mcc/melody', type: CLASSIC, version: 2.9.1}
23+
- {name: '@mchp-mcc/pic-8bit', type: MELODY, version: 5.29.1}
2324
- {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-eusart-v1', type: MELODY, version: 7.1.6}
27-
- {name: '@mchp-mcc/scf-pic8-interrupt-v2', type: MELODY, version: 5.2.11}
28-
- {name: '@mchp-mcc/scf-pic8-mssp-v1', type: MELODY, version: 7.0.1}
25+
- {name: '@mchp-mcc/pic16-pin-manager', type: MELODY, version: 3.6.2}
26+
- {name: '@mchp-mcc/pin-content-processor', type: MELODY, version: 3.10.0}
27+
- {name: '@mchp-mcc/scf-pic8-eusart-v1', type: MELODY, version: 7.1.7}
28+
- {name: '@mchp-mcc/scf-pic8-interrupt-v2', type: MELODY, version: 5.2.12}
29+
- {name: '@mchp-mcc/scf-pic8-mssp-v1', type: MELODY, version: 7.0.3}
2930
- {name: '@mchp-mcc/scf-pic8-osc-v2', type: MELODY, version: 4.2.2}
30-
- {name: '@mchp-mcc/scf-pic8-tmr0-v1', type: MELODY, version: 4.0.13}
31+
- {name: '@mchp-mcc/scf-pic8-tmr0-v1', type: MELODY, version: 5.1.0}
3132
- {name: '@mchp-mcc/uart-driver', type: MELODY, version: 1.10.2}
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
*
66
* @defgroup i2c_host_events I2C_HOST_EVENTS
77
*
8-
* @brief This file contains additional data types for the I2C module.
8+
* @brief This header file provides helper structures for the I2C driver implementation.
99
*
10-
* @version I2C Driver Version 2.1.0
10+
* @version I2C1 Driver Version 2.1.3
11+
*
12+
* @version I2C1 Package Version 7.0.3
1113
*/
1214

1315
/*
14-
© [2024] Microchip Technology Inc. and its subsidiaries.
16+
© [2025] 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.
@@ -36,6 +38,8 @@
3638

3739
#include "i2c_host_types.h"
3840

41+
#define I2C_EVENTS (9)
42+
3943
/**
4044
* @ingroup i2c_host_events
4145
* @enum i2c_host_event_states_t
@@ -72,4 +76,9 @@ typedef struct
7276
i2c_host_event_states_t state; /**< Event State index*/
7377
} i2c_host_event_status_t;
7478

79+
typedef i2c_host_event_states_t (*i2c1eventHandler)(void);
80+
81+
extern volatile i2c_host_event_status_t i2c1Status;
82+
extern const i2c1eventHandler i2c1_eventTable[I2C_EVENTS];
83+
7584
#endif /* end of I2C_EVENT_TYPES_H */

0 commit comments

Comments
 (0)