Merge pull request #5 from Klagarge/modbus

Modbus
This commit is contained in:
Rémi Heredero 2023-03-14 15:45:42 +01:00 committed by GitHub
commit f7102d8aa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 256 additions and 142 deletions

30
main.c
View File

@ -50,9 +50,8 @@
/* /*
Main application Main application
*/ */
void resetTMR0(void);
void endFrame(void);
extern uint16_t input_registers[2];
void main(void) void main(void)
{ {
// Initialize the device // Initialize the device
@ -80,15 +79,16 @@ void main(void)
// Disable the Peripheral Interrupts // Disable the Peripheral Interrupts
//INTERRUPT_PeripheralInterruptDisable(); //INTERRUPT_PeripheralInterruptDisable();
uint16_t foo = 512;
EUSART1_SetRxInterruptHandler(resetTMR0);
TMR0_SetInterruptHandler(endFrame);
while (1) while (1)
{ {
foo = ++foo%1023;
EPWM1_LoadDutyValue(foo); EPWM1_LoadDutyValue(holding_registers[0]);
uint16_t valueV = measure_voltage(); input_registers[0] = measure_voltage();
uint16_t valueI = measure_current(offsetCurrent); input_registers[1] = measure_current(offsetCurrent);
uint16_t valueV = input_registers[0];
uint16_t valueI = input_registers[1];
char msg[MAX_COL+1]; char msg[MAX_COL+1];
//LCD_2x16_WriteCmd(0x01); // clear display //LCD_2x16_WriteCmd(0x01); // clear display
@ -103,18 +103,6 @@ void main(void)
} }
void resetTMR0(void){
INTCONbits.TMR0IF = 0;
TMR0_Reload();
TMR0_StartTimer();
}
void endFrame(void){
TMR0_StopTimer();
modbus_analyse_and_answer();
// TODO
}
/** /**
End of File End of File
*/ */

View File

@ -93,8 +93,8 @@ void EUSART1_Initialize(void)
// SPEN enabled; RX9 9-bit; CREN enabled; ADDEN disabled; SREN disabled; // SPEN enabled; RX9 9-bit; CREN enabled; ADDEN disabled; SREN disabled;
RCSTA1 = 0xD0; RCSTA1 = 0xD0;
// TX9 9-bit; TX9D 0; SENDB sync_break_complete; TXEN enabled; SYNC asynchronous; BRGH hi_speed; CSRC master_mode; // TX9 9-bit; TX9D 1; SENDB sync_break_complete; TXEN enabled; SYNC asynchronous; BRGH hi_speed; CSRC master_mode;
TXSTA1 = 0xE4; TXSTA1 = 0xE5;
// //
SPBRG1 = 0x8A; SPBRG1 = 0x8A;

View File

@ -90,8 +90,8 @@ void TMR0_Initialize(void)
// Set Default Interrupt Handler // Set Default Interrupt Handler
TMR0_SetInterruptHandler(TMR0_DefaultInterruptHandler); TMR0_SetInterruptHandler(TMR0_DefaultInterruptHandler);
// T0PS 1:2; T08BIT 16-bit; T0SE Increment_hi_lo; T0CS FOSC/4; TMR0ON enabled; PSA not_assigned; // T0PS 1:2; T08BIT 16-bit; T0SE Increment_hi_lo; T0CS FOSC/4; TMR0ON disabled; PSA not_assigned;
T0CON = 0x98; T0CON = 0x18;
} }
void TMR0_StartTimer(void) void TMR0_StartTimer(void)

View File

@ -15,6 +15,7 @@ uint8_t modbusAddress;
uint16_t input_registers[2]; uint16_t input_registers[2];
uint16_t holding_registers[2]; uint16_t holding_registers[2];
// Modbus error codes // Modbus error codes
#define ILLEGAL_FUNCTION 1 #define ILLEGAL_FUNCTION 1
#define ILLEGAL_DATA_ADDRESS 2 #define ILLEGAL_DATA_ADDRESS 2
@ -33,37 +34,85 @@ uint8_t recPtr = 0;
void modbus_timer(void) void modbus_timer(void)
{ {
// TODO -> complete what to do on modbus timer event INTCONbits.TMR0IF = 0;
recPtr = 0;
TMR0_StopTimer();
modbus_analyse_and_answer();
} }
extern uint16_t measure_voltage();
uint8_t modbus_analyse_and_answer(void) { uint8_t modbus_analyse_and_answer(void) {
// TODO -> complete the modbus analyse and answer // TODO -> complete the modbus analyse and answer
rx_buf[0] = 0; uint16_t length = 0;
if(rx_buf[0] == modbusAddress){
tx_buf[0] = rx_buf[0]; // Adress
tx_buf[1] = rx_buf[1]; // Function
uint16_t adresseRegister = ((uint16_t)rx_buf[2] << 8) | rx_buf[3];
//sprintf(tx_buf, "%i", modbusAddress, ); switch(rx_buf[1]){ // Check the function from rx buffer
case READ_INPUT_REGISTERS:
length = ((uint16_t)rx_buf[4] << 8) | rx_buf[5];
tx_buf[2] = (uint8_t)(length*2); // Data length
for(uint16_t i = 0; i < length; i++){ // Data
tx_buf[i*2+4] = input_registers[adresseRegister+i];
tx_buf[i*2+3] = (input_registers[adresseRegister+i] >> 8);
}
length*=2;
length+=3;
break;
case READ_HOLDING_REGISTERS:
length = ((uint16_t)rx_buf[4] << 8) | rx_buf[5];
tx_buf[2] = (uint8_t)(length*2); // Data length
for(uint16_t i = 0; i < length; i++){ // Data
tx_buf[i*2+4] = holding_registers[adresseRegister+i];
tx_buf[i*2+3] = (holding_registers[adresseRegister+i] >> 8);
}
length*=2;
length+=3;
break;
case WRITE_SINGLE_REGISTER:
holding_registers[adresseRegister] = ((uint16_t)rx_buf[4] << 8) | rx_buf[5];
for (int i = 2; i <= 5; i++) {
tx_buf[i] = rx_buf[i];
length = i+1;
}
break;
}
} }
void modbus_char_recvd(uint8_t c) rx_buf[0] = 0;
modbus_send(length);
}
void modbus_char_recvd(void)
{ {
// TODO -> complete modbus char receive rx_buf[recPtr++] = RCREG1;
TMR0_Reload();
TMR0_StartTimer();
} }
void modbus_send(uint8_t length) void modbus_send(uint8_t length)
{ {
uint16_t temp16;
uint8_t i;
// TODO -> complete modbus RCR calculation uint16_t crc = CRC16(tx_buf, length);
tx_buf[length] = crc;
tx_buf[length+1] = crc >> 8;
length += 2; // add 2 CRC bytes for total size length += 2; // add 2 CRC bytes for total size
// For all the bytes to be transmitted // For all the bytes to be transmitted
uart_send(tx_buf,length); for (uint8_t i = 0; i < length; i++){
EUSART1_Write(tx_buf[i]);
}
} }
void modbus_init(uint8_t address) void modbus_init(uint8_t address)
{ {
modbusAddress = address; modbusAddress = address;
// TODO -> confikre timer for modbus usage holding_registers[1] = address;
EUSART1_SetRxInterruptHandler(modbus_char_recvd);
TMR0_SetInterruptHandler(modbus_timer);
} }

View File

@ -45,10 +45,10 @@ void modbus_send(uint8_t length);
* This function will be called every time a character has been received on the * This function will be called every time a character has been received on the
* Modbus serial port. It is called from the interrupt hander. * Modbus serial port. It is called from the interrupt hander.
* *
* @param c : the received char * @param c : the received char // removed !
* @see interrupts.c. * @see interrupts.c.
*/ */
void modbus_char_recvd(uint8_t c); void modbus_char_recvd(void);
/** /**
* Modbus timer finished. This function is called by the interrupt handler * Modbus timer finished. This function is called by the interrupt handler

View File

@ -57,17 +57,17 @@ OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE}
DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE}
# Source Files Quoted if spaced # Source Files Quoted if spaced
SOURCEFILES_QUOTED_IF_SPACED=lcd/lcd.c mcc_generated_files/device_config.c mcc_generated_files/mcc.c mcc_generated_files/pin_manager.c mcc_generated_files/adc.c mcc_generated_files/epwm1.c mcc_generated_files/tmr2.c mcc_generated_files/eusart1.c mcc_generated_files/interrupt_manager.c mcc_generated_files/tmr0.c main.c crc.c measure.c modbus.c uart.c SOURCEFILES_QUOTED_IF_SPACED=lcd/lcd.c mcc_generated_files/device_config.c mcc_generated_files/mcc.c mcc_generated_files/pin_manager.c mcc_generated_files/adc.c mcc_generated_files/epwm1.c mcc_generated_files/tmr2.c mcc_generated_files/eusart1.c mcc_generated_files/interrupt_manager.c mcc_generated_files/tmr0.c main.c crc.c measure.c modbus.c
# Object Files Quoted if spaced # Object Files Quoted if spaced
OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/lcd/lcd.p1 ${OBJECTDIR}/mcc_generated_files/device_config.p1 ${OBJECTDIR}/mcc_generated_files/mcc.p1 ${OBJECTDIR}/mcc_generated_files/pin_manager.p1 ${OBJECTDIR}/mcc_generated_files/adc.p1 ${OBJECTDIR}/mcc_generated_files/epwm1.p1 ${OBJECTDIR}/mcc_generated_files/tmr2.p1 ${OBJECTDIR}/mcc_generated_files/eusart1.p1 ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1 ${OBJECTDIR}/mcc_generated_files/tmr0.p1 ${OBJECTDIR}/main.p1 ${OBJECTDIR}/crc.p1 ${OBJECTDIR}/measure.p1 ${OBJECTDIR}/modbus.p1 ${OBJECTDIR}/uart.p1 OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/lcd/lcd.p1 ${OBJECTDIR}/mcc_generated_files/device_config.p1 ${OBJECTDIR}/mcc_generated_files/mcc.p1 ${OBJECTDIR}/mcc_generated_files/pin_manager.p1 ${OBJECTDIR}/mcc_generated_files/adc.p1 ${OBJECTDIR}/mcc_generated_files/epwm1.p1 ${OBJECTDIR}/mcc_generated_files/tmr2.p1 ${OBJECTDIR}/mcc_generated_files/eusart1.p1 ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1 ${OBJECTDIR}/mcc_generated_files/tmr0.p1 ${OBJECTDIR}/main.p1 ${OBJECTDIR}/crc.p1 ${OBJECTDIR}/measure.p1 ${OBJECTDIR}/modbus.p1
POSSIBLE_DEPFILES=${OBJECTDIR}/lcd/lcd.p1.d ${OBJECTDIR}/mcc_generated_files/device_config.p1.d ${OBJECTDIR}/mcc_generated_files/mcc.p1.d ${OBJECTDIR}/mcc_generated_files/pin_manager.p1.d ${OBJECTDIR}/mcc_generated_files/adc.p1.d ${OBJECTDIR}/mcc_generated_files/epwm1.p1.d ${OBJECTDIR}/mcc_generated_files/tmr2.p1.d ${OBJECTDIR}/mcc_generated_files/eusart1.p1.d ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1.d ${OBJECTDIR}/mcc_generated_files/tmr0.p1.d ${OBJECTDIR}/main.p1.d ${OBJECTDIR}/crc.p1.d ${OBJECTDIR}/measure.p1.d ${OBJECTDIR}/modbus.p1.d ${OBJECTDIR}/uart.p1.d POSSIBLE_DEPFILES=${OBJECTDIR}/lcd/lcd.p1.d ${OBJECTDIR}/mcc_generated_files/device_config.p1.d ${OBJECTDIR}/mcc_generated_files/mcc.p1.d ${OBJECTDIR}/mcc_generated_files/pin_manager.p1.d ${OBJECTDIR}/mcc_generated_files/adc.p1.d ${OBJECTDIR}/mcc_generated_files/epwm1.p1.d ${OBJECTDIR}/mcc_generated_files/tmr2.p1.d ${OBJECTDIR}/mcc_generated_files/eusart1.p1.d ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1.d ${OBJECTDIR}/mcc_generated_files/tmr0.p1.d ${OBJECTDIR}/main.p1.d ${OBJECTDIR}/crc.p1.d ${OBJECTDIR}/measure.p1.d ${OBJECTDIR}/modbus.p1.d
# Object Files # Object Files
OBJECTFILES=${OBJECTDIR}/lcd/lcd.p1 ${OBJECTDIR}/mcc_generated_files/device_config.p1 ${OBJECTDIR}/mcc_generated_files/mcc.p1 ${OBJECTDIR}/mcc_generated_files/pin_manager.p1 ${OBJECTDIR}/mcc_generated_files/adc.p1 ${OBJECTDIR}/mcc_generated_files/epwm1.p1 ${OBJECTDIR}/mcc_generated_files/tmr2.p1 ${OBJECTDIR}/mcc_generated_files/eusart1.p1 ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1 ${OBJECTDIR}/mcc_generated_files/tmr0.p1 ${OBJECTDIR}/main.p1 ${OBJECTDIR}/crc.p1 ${OBJECTDIR}/measure.p1 ${OBJECTDIR}/modbus.p1 ${OBJECTDIR}/uart.p1 OBJECTFILES=${OBJECTDIR}/lcd/lcd.p1 ${OBJECTDIR}/mcc_generated_files/device_config.p1 ${OBJECTDIR}/mcc_generated_files/mcc.p1 ${OBJECTDIR}/mcc_generated_files/pin_manager.p1 ${OBJECTDIR}/mcc_generated_files/adc.p1 ${OBJECTDIR}/mcc_generated_files/epwm1.p1 ${OBJECTDIR}/mcc_generated_files/tmr2.p1 ${OBJECTDIR}/mcc_generated_files/eusart1.p1 ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1 ${OBJECTDIR}/mcc_generated_files/tmr0.p1 ${OBJECTDIR}/main.p1 ${OBJECTDIR}/crc.p1 ${OBJECTDIR}/measure.p1 ${OBJECTDIR}/modbus.p1
# Source Files # Source Files
SOURCEFILES=lcd/lcd.c mcc_generated_files/device_config.c mcc_generated_files/mcc.c mcc_generated_files/pin_manager.c mcc_generated_files/adc.c mcc_generated_files/epwm1.c mcc_generated_files/tmr2.c mcc_generated_files/eusart1.c mcc_generated_files/interrupt_manager.c mcc_generated_files/tmr0.c main.c crc.c measure.c modbus.c uart.c SOURCEFILES=lcd/lcd.c mcc_generated_files/device_config.c mcc_generated_files/mcc.c mcc_generated_files/pin_manager.c mcc_generated_files/adc.c mcc_generated_files/epwm1.c mcc_generated_files/tmr2.c mcc_generated_files/eusart1.c mcc_generated_files/interrupt_manager.c mcc_generated_files/tmr0.c main.c crc.c measure.c modbus.c
@ -206,14 +206,6 @@ ${OBJECTDIR}/modbus.p1: modbus.c nbproject/Makefile-${CND_CONF}.mk
@-${MV} ${OBJECTDIR}/modbus.d ${OBJECTDIR}/modbus.p1.d @-${MV} ${OBJECTDIR}/modbus.d ${OBJECTDIR}/modbus.p1.d
@${FIXDEPS} ${OBJECTDIR}/modbus.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ @${FIXDEPS} ${OBJECTDIR}/modbus.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
${OBJECTDIR}/uart.p1: uart.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} "${OBJECTDIR}"
@${RM} ${OBJECTDIR}/uart.p1.d
@${RM} ${OBJECTDIR}/uart.p1
${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -D__DEBUG=1 -mdebugger=snap -mdfp="${DFP_DIR}/xc8" -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto -o ${OBJECTDIR}/uart.p1 uart.c
@-${MV} ${OBJECTDIR}/uart.d ${OBJECTDIR}/uart.p1.d
@${FIXDEPS} ${OBJECTDIR}/uart.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
else else
${OBJECTDIR}/lcd/lcd.p1: lcd/lcd.c nbproject/Makefile-${CND_CONF}.mk ${OBJECTDIR}/lcd/lcd.p1: lcd/lcd.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} "${OBJECTDIR}/lcd" @${MKDIR} "${OBJECTDIR}/lcd"
@ -327,14 +319,6 @@ ${OBJECTDIR}/modbus.p1: modbus.c nbproject/Makefile-${CND_CONF}.mk
@-${MV} ${OBJECTDIR}/modbus.d ${OBJECTDIR}/modbus.p1.d @-${MV} ${OBJECTDIR}/modbus.d ${OBJECTDIR}/modbus.p1.d
@${FIXDEPS} ${OBJECTDIR}/modbus.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ @${FIXDEPS} ${OBJECTDIR}/modbus.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
${OBJECTDIR}/uart.p1: uart.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} "${OBJECTDIR}"
@${RM} ${OBJECTDIR}/uart.p1.d
@${RM} ${OBJECTDIR}/uart.p1
${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -mdfp="${DFP_DIR}/xc8" -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto -o ${OBJECTDIR}/uart.p1 uart.c
@-${MV} ${OBJECTDIR}/uart.d ${OBJECTDIR}/uart.p1.d
@${FIXDEPS} ${OBJECTDIR}/uart.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
endif endif
# ------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------

View File

@ -1,11 +1,11 @@
# #
#Thu Mar 09 15:57:40 CET 2023 #Tue Mar 14 13:52:25 CET 2023
default.languagetoolchain.version=2.40 default.languagetoolchain.version=2.40
default.Pack.dfplocation=C\:\\Program Files\\Microchip\\MPLABX\\v6.00\\packs\\Microchip\\PIC18F-J_DFP\\1.5.44 default.Pack.dfplocation=C\:\\Program Files\\Microchip\\MPLABX\\v6.00\\packs\\Microchip\\PIC18F-J_DFP\\1.5.44
conf.ids=default conf.ids=default
default.languagetoolchain.dir=C\:\\Program Files\\Microchip\\xc8\\v2.40\\bin default.languagetoolchain.dir=C\:\\Program Files\\Microchip\\xc8\\v2.40\\bin
host.id=3awj-afwq-rl host.id=3awj-afwq-rl
configurations-xml=5e78976b44c48e5125d650f70012f653 configurations-xml=4dc45b219db50423420a0eb2e1f688ad
default.com-microchip-mplab-mdbcore-snap-SnapToolImpl.md5=eaa336cefb7fc46db8b50b7b2b6e54ca default.com-microchip-mplab-mdbcore-snap-SnapToolImpl.md5=eaa336cefb7fc46db8b50b7b2b6e54ca
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=6e02ca5e9f5042ffd365b42ab82d3a9b com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=6e02ca5e9f5042ffd365b42ab82d3a9b
user-defined-mime-resolver-xml=none user-defined-mime-resolver-xml=none

View File

@ -23,7 +23,6 @@
<itemPath>crc.h</itemPath> <itemPath>crc.h</itemPath>
<itemPath>measure.h</itemPath> <itemPath>measure.h</itemPath>
<itemPath>modbus.h</itemPath> <itemPath>modbus.h</itemPath>
<itemPath>uart.h</itemPath>
</logicalFolder> </logicalFolder>
<logicalFolder name="LinkerScript" <logicalFolder name="LinkerScript"
displayName="Linker Files" displayName="Linker Files"
@ -52,7 +51,6 @@
<itemPath>crc.c</itemPath> <itemPath>crc.c</itemPath>
<itemPath>measure.c</itemPath> <itemPath>measure.c</itemPath>
<itemPath>modbus.c</itemPath> <itemPath>modbus.c</itemPath>
<itemPath>uart.c</itemPath>
</logicalFolder> </logicalFolder>
<logicalFolder name="ExternalFiles" <logicalFolder name="ExternalFiles"
displayName="Important Files" displayName="Important Files"
@ -188,7 +186,56 @@
<property key="remove-unused-sections" value="true"/> <property key="remove-unused-sections" value="true"/>
</HI-TECH-LINK> </HI-TECH-LINK>
<Tool> <Tool>
<property key="AutoSelectMemRanges" value="auto"/>
<property key="Freeze Peripherals" value="true"/>
<property key="ToolFirmwareFilePath"
value="Press to browse for a specific firmware version"/>
<property key="ToolFirmwareOption.UpdateOptions"
value="ToolFirmwareOption.UseLatest"/>
<property key="ToolFirmwareToolPack"
value="Press to select which tool pack to use"/>
<property key="communication.interface"
value="${communication.interface.default}"/>
<property key="communication.interface.jtag" value="2wire"/>
<property key="communication.speed" value="${communication.speed.default}"/>
<property key="debugoptions.debug-startup" value="Use system settings"/>
<property key="debugoptions.reset-behaviour" value="Use system settings"/>
<property key="debugoptions.simultaneous.debug" value="false"/>
<property key="debugoptions.useswbreakpoints" value="true"/> <property key="debugoptions.useswbreakpoints" value="true"/>
<property key="freeze.timers" value="false"/>
<property key="memories.aux" value="false"/>
<property key="memories.bootflash" value="true"/>
<property key="memories.configurationmemory" value="true"/>
<property key="memories.configurationmemory2" value="true"/>
<property key="memories.dataflash" value="true"/>
<property key="memories.eeprom" value="true"/>
<property key="memories.exclude.configurationmemory" value="true"/>
<property key="memories.flashdata" value="true"/>
<property key="memories.id" value="true"/>
<property key="memories.instruction.ram.ranges"
value="${memories.instruction.ram.ranges}"/>
<property key="memories.programmemory" value="true"/>
<property key="memories.programmemory.ranges" value="0-1fff7"/>
<property key="programmerToGoFilePath"
value="C:/Users/remi/MPLABXProjects/solar_panel/debug/default/default_ptg"/>
<property key="programoptions.donoteraseauxmem" value="false"/>
<property key="programoptions.eraseb4program" value="true"/>
<property key="programoptions.pgmentry.voltage" value="low"/>
<property key="programoptions.pgmspeed" value="Min"/>
<property key="programoptions.preservedataflash" value="false"/>
<property key="programoptions.preservedataflash.ranges"
value="${memories.dataflash.default}"/>
<property key="programoptions.preserveeeprom" value="false"/>
<property key="programoptions.preserveeeprom.ranges" value=""/>
<property key="programoptions.preserveprogram.ranges" value=""/>
<property key="programoptions.preserveprogramrange" value="false"/>
<property key="programoptions.programcalmem" value="false"/>
<property key="programoptions.programuserotp" value="false"/>
<property key="programoptions.testmodeentrymethod" value="VDDFirst"/>
<property key="toolpack.updateoptions"
value="toolpack.updateoptions.uselatestoolpack"/>
<property key="toolpack.updateoptions.packversion"
value="Press to select which tool pack to use"/>
</Tool> </Tool>
<XC8-CO> <XC8-CO>
<property key="coverage-enable" value=""/> <property key="coverage-enable" value=""/>
@ -210,7 +257,54 @@
<property key="wpo-lto" value="false"/> <property key="wpo-lto" value="false"/>
</XC8-config-global> </XC8-config-global>
<snap> <snap>
<property key="AutoSelectMemRanges" value="auto"/>
<property key="Freeze Peripherals" value="true"/>
<property key="ToolFirmwareFilePath"
value="Press to browse for a specific firmware version"/>
<property key="ToolFirmwareOption.UpdateOptions"
value="ToolFirmwareOption.UseLatest"/>
<property key="ToolFirmwareToolPack"
value="Press to select which tool pack to use"/>
<property key="communication.interface"
value="${communication.interface.default}"/>
<property key="communication.interface.jtag" value="2wire"/>
<property key="communication.speed" value="${communication.speed.default}"/>
<property key="debugoptions.debug-startup" value="Use system settings"/>
<property key="debugoptions.reset-behaviour" value="Use system settings"/>
<property key="debugoptions.simultaneous.debug" value="false"/>
<property key="debugoptions.useswbreakpoints" value="true"/> <property key="debugoptions.useswbreakpoints" value="true"/>
<property key="freeze.timers" value="false"/>
<property key="memories.aux" value="false"/>
<property key="memories.bootflash" value="true"/>
<property key="memories.configurationmemory" value="true"/>
<property key="memories.configurationmemory2" value="true"/>
<property key="memories.dataflash" value="true"/>
<property key="memories.eeprom" value="true"/>
<property key="memories.exclude.configurationmemory" value="true"/>
<property key="memories.flashdata" value="true"/>
<property key="memories.id" value="true"/>
<property key="memories.instruction.ram.ranges"
value="${memories.instruction.ram.ranges}"/>
<property key="memories.programmemory" value="true"/>
<property key="memories.programmemory.ranges" value="0-1fff7"/>
<property key="programoptions.donoteraseauxmem" value="false"/>
<property key="programoptions.eraseb4program" value="true"/>
<property key="programoptions.pgmentry.voltage" value="low"/>
<property key="programoptions.pgmspeed" value="Min"/>
<property key="programoptions.preservedataflash" value="false"/>
<property key="programoptions.preservedataflash.ranges"
value="${memories.dataflash.default}"/>
<property key="programoptions.preserveeeprom" value="false"/>
<property key="programoptions.preserveeeprom.ranges" value=""/>
<property key="programoptions.preserveprogram.ranges" value=""/>
<property key="programoptions.preserveprogramrange" value="false"/>
<property key="programoptions.programcalmem" value="false"/>
<property key="programoptions.programuserotp" value="false"/>
<property key="programoptions.testmodeentrymethod" value="VDDFirst"/>
<property key="toolpack.updateoptions"
value="toolpack.updateoptions.uselatestoolpack"/>
<property key="toolpack.updateoptions.packversion"
value="Press to select which tool pack to use"/>
</snap> </snap>
</conf> </conf>
</confs> </confs>

View File

@ -4,7 +4,7 @@
<defaultConf>0</defaultConf> <defaultConf>0</defaultConf>
<confs> <confs>
<conf name="default" type="2"> <conf name="default" type="2">
<platformToolSN>:=MPLABComm-USB-Microchip:=&lt;vid>04D8:=&lt;pid>9018:=&lt;rev>0100:=&lt;man>Microchip Technology Incorporated:=&lt;prod>MPLAB Snap ICD:=&lt;sn>BUR190971772:=&lt;drv>x:=&lt;xpt>b:=end</platformToolSN> <platformToolSN>:=MPLABComm-USB-Microchip:=&lt;vid>04D8:=&lt;pid>9018:=&lt;rev>0100:=&lt;man>Microchip Technology Incorporated:=&lt;prod>MPLAB Snap ICD:=&lt;sn>BUR190971824:=&lt;drv>x:=&lt;xpt>b:=end</platformToolSN>
<languageToolchainDir>C:\Program Files\Microchip\xc8\v2.40\bin</languageToolchainDir> <languageToolchainDir>C:\Program Files\Microchip\xc8\v2.40\bin</languageToolchainDir>
<mdbdebugger version="1"> <mdbdebugger version="1">
<placeholder1>place holder 1</placeholder1> <placeholder1>place holder 1</placeholder1>

View File

@ -3,15 +3,14 @@
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/> <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group> <group>
<file>file:/C:/Users/remi/Downloads/MCU/solar_panel/solar_panel.X/modbus.c</file> <file>file:/C:/Program%20Files/Microchip/xc8/v2.40/pic/sources/c99/common/doprnt.c</file>
<file>file:/C:/Users/remi/Downloads/MCU/solar_panel/solar_panel.X/measure.c</file> <file>file:/C:/Users/remi/MPLABXProjects/solar_panel/lcd/lcd.c</file>
<file>file:/C:/Users/remi/Downloads/MCU/solar_panel/solar_panel.X/modbus.h</file> <file>file:/C:/Users/remi/MPLABXProjects/solar_panel/modbus.h</file>
<file>file:/C:/Users/remi/Downloads/MCU/solar_panel/solar_panel.X/main.c</file> <file>file:/C:/Users/remi/MPLABXProjects/solar_panel/main.c</file>
<file>file:/C:/Program%20Files/Microchip/xc8/v2.40/pic/sources/c99/common/lwmod.c</file>
<file>file:/C:/Users/remi/Downloads/MCU/solar_panel/solar_panel.X/mcc_generated_files/interrupt_manager.c</file>
<file>file:/C:/Program%20Files/Microchip/xc8/v2.40/pic/sources/c99/common/aomod.c</file> <file>file:/C:/Program%20Files/Microchip/xc8/v2.40/pic/sources/c99/common/aomod.c</file>
<file>file:/C:/Users/remi/Downloads/MCU/solar_panel/solar_panel.X/mcc_generated_files/tmr0.c</file> <file>file:/C:/Users/remi/MPLABXProjects/solar_panel/modbus.c</file>
<file>file:/C:/Users/remi/Downloads/MCU/solar_panel/solar_panel.X/mcc_generated_files/eusart1.c</file> <file>file:/C:/Users/remi/MPLABXProjects/solar_panel/crc.c</file>
<file>file:/C:/Users/remi/MPLABXProjects/solar_panel/mcc_generated_files/tmr0.c</file>
</group> </group>
</open-files> </open-files>
</project-private> </project-private>

View File

@ -784,15 +784,15 @@
</entry> </entry>
<entry> <entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="EUSART1" name="baudRateComboBox"/> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="EUSART1" name="baudRateComboBox"/>
<value>9600</value> <value>9600.614</value>
</entry> </entry>
<entry> <entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="EUSART1" name="baudRateErrorLabel"/> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="EUSART1" name="baudRateErrorLabel"/>
<value>Error: 0.006 %</value> <value>Register set</value>
</entry> </entry>
<entry> <entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="EUSART1" name="baudprocessmode"/> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="EUSART1" name="baudprocessmode"/>
<value>easysetup</value> <value>register</value>
</entry> </entry>
<entry> <entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="EUSART1" name="dt_pin_direction"/> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="EUSART1" name="dt_pin_direction"/>
@ -1004,7 +1004,7 @@
</entry> </entry>
<entry> <entry>
<key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="EUSART1" registerAlias="TXSTA"/> <key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="EUSART1" registerAlias="TXSTA"/>
<value>228</value> <value>229</value>
</entry> </entry>
<entry> <entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="EUSART1" registerAlias="BAUDCON" settingAlias="ABDEN"/> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="EUSART1" registerAlias="BAUDCON" settingAlias="ABDEN"/>
@ -1124,7 +1124,7 @@
</entry> </entry>
<entry> <entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="EUSART1" registerAlias="TXSTA" settingAlias="TX9D"/> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="EUSART1" registerAlias="TXSTA" settingAlias="TX9D"/>
<value>0</value> <value>1</value>
</entry> </entry>
<entry> <entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="EUSART1" registerAlias="TXSTA" settingAlias="TXEN"/> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="EUSART1" registerAlias="TXSTA" settingAlias="TXEN"/>
@ -5648,7 +5648,7 @@
</entry> </entry>
<entry> <entry>
<key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="TMR0" name="timerstart"/> <key class="com.microchip.mcc.core.tokenManager.CustomKey" moduleName="TMR0" name="timerstart"/>
<value>enabled</value> <value>disabled</value>
</entry> </entry>
<entry> <entry>
<key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="TMR0" registerAlias="T0CON" settingAlias="PS" alias="1:128"/> <key class="com.microchip.mcc.core.tokenManager.OptionKey" moduleName="TMR0" registerAlias="T0CON" settingAlias="PS" alias="1:128"/>
@ -5724,7 +5724,7 @@
</entry> </entry>
<entry> <entry>
<key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="TMR0" registerAlias="T0CON"/> <key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="TMR0" registerAlias="T0CON"/>
<value>152</value> <value>24</value>
</entry> </entry>
<entry> <entry>
<key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="TMR0" registerAlias="TMR0H"/> <key class="com.microchip.mcc.core.tokenManager.RegisterKey" moduleName="TMR0" registerAlias="TMR0H"/>
@ -5748,7 +5748,7 @@
</entry> </entry>
<entry> <entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="TMR0" registerAlias="T0CON" settingAlias="TMR0ON"/> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="TMR0" registerAlias="T0CON" settingAlias="TMR0ON"/>
<value>enabled</value> <value>disabled</value>
</entry> </entry>
<entry> <entry>
<key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="TMR0" registerAlias="T0CON" settingAlias="TMRCS"/> <key class="com.microchip.mcc.core.tokenManager.SettingKey" moduleName="TMR0" registerAlias="T0CON" settingAlias="TMRCS"/>
@ -5967,82 +5967,82 @@
<value>131.07200</value> <value>131.07200</value>
</entry> </entry>
</tokenMap> </tokenMap>
<generatedFileHashHistoryMap class="java.util.HashMap"> <generatedFileHashHistoryMap class="java.util.TreeMap">
<entry>
<file>mcc_generated_files\mcc.h</file>
<hash>52b447a5dc446f42c76e7a13f2403349cfdc20fc87fe880892a4f08ac41ec7ec</hash>
</entry>
<entry>
<file>mcc_generated_files\device_config.h</file>
<hash>e658a4cb6ac1c79b2a52ab2754ebce26d229cbe4bd8464122f3272d1e76e5881</hash>
</entry>
<entry>
<file>mcc_generated_files\interrupt_manager.h</file>
<hash>5c311e57ab563c3fadc6e5c40b1e425436e9366c40e5772f46f393a9f8ed9d39</hash>
</entry>
<entry>
<file>mcc_generated_files\eusart1.h</file>
<hash>cb7a354159e217ac3955f23cce6d01d65df54018be773e73654ec951df42a7e9</hash>
</entry>
<entry>
<file>mcc_generated_files\tmr0.h</file>
<hash>60487f4faa42d9fec7389ebc68c7a0a01ec6343892ddd4f936b3e776d62a07b0</hash>
</entry>
<entry> <entry>
<file>main.c</file> <file>main.c</file>
<hash>30e3e0e5956e494fcd566f1509f2f2bbc404d25265a77934114af7c9d1fcdbd7</hash> <hash>30e3e0e5956e494fcd566f1509f2f2bbc404d25265a77934114af7c9d1fcdbd7</hash>
</entry> </entry>
<entry>
<file>mcc_generated_files\device_config.c</file>
<hash>0c1446568049fa17e32a6aec2aad01e6cabc65cf60b9d57aceffd79e04f930c2</hash>
</entry>
<entry>
<file>mcc_generated_files\tmr2.h</file>
<hash>9c49623fe191eb686818b525571464bbc0f83e271367728272f8bce53b917f55</hash>
</entry>
<entry>
<file>mcc_generated_files\tmr2.c</file>
<hash>05c23c08bae910023f51fd801fa4b4107358a34dbad1624e66d9a30249d1fe86</hash>
</entry>
<entry>
<file>mcc_generated_files\pin_manager.h</file>
<hash>87e93cc6f9494828e660861178e9a299efbe16d73a441d92e3dca2a1cf6d54ed</hash>
</entry>
<entry>
<file>mcc_generated_files\adc.h</file>
<hash>58eb4471903133ed806f7edbfce9c3cc4e0af3536917c8f81ad1cbdb72d919fc</hash>
</entry>
<entry>
<file>mcc_generated_files\epwm1.h</file>
<hash>e1dacec839b43c4ec99f1710c3a7872ce32d2ea6dfe3856eb466e690b7ea75c9</hash>
</entry>
<entry>
<file>mcc_generated_files\tmr0.c</file>
<hash>f8a9d57b93e4810bdf2401ef043ce48c9d645ba81f2241dee96977286f6fb164</hash>
</entry>
<entry>
<file>mcc_generated_files\pin_manager.c</file>
<hash>1f9236370706611180887eedcb54392c08476036ee99409ce0d9a1f39ef165fb</hash>
</entry>
<entry>
<file>mcc_generated_files\epwm1.c</file>
<hash>db307f67f622483528ffff92c5560b35b38162e4f93d1659723c7276b7265601</hash>
</entry>
<entry> <entry>
<file>mcc_generated_files\adc.c</file> <file>mcc_generated_files\adc.c</file>
<hash>62188981f98a350cfcc3227def37b9ded03569aedb061a1566fc3d03028da8f1</hash> <hash>62188981f98a350cfcc3227def37b9ded03569aedb061a1566fc3d03028da8f1</hash>
</entry> </entry>
<entry> <entry>
<file>mcc_generated_files\mcc.c</file> <file>mcc_generated_files\adc.h</file>
<hash>32ff3e2dadb25f5b8ccb3d70520f2b25f98e471a9bccb87758edd960e922e48c</hash> <hash>58eb4471903133ed806f7edbfce9c3cc4e0af3536917c8f81ad1cbdb72d919fc</hash>
</entry>
<entry>
<file>mcc_generated_files\device_config.c</file>
<hash>0c1446568049fa17e32a6aec2aad01e6cabc65cf60b9d57aceffd79e04f930c2</hash>
</entry>
<entry>
<file>mcc_generated_files\device_config.h</file>
<hash>e658a4cb6ac1c79b2a52ab2754ebce26d229cbe4bd8464122f3272d1e76e5881</hash>
</entry>
<entry>
<file>mcc_generated_files\epwm1.c</file>
<hash>db307f67f622483528ffff92c5560b35b38162e4f93d1659723c7276b7265601</hash>
</entry>
<entry>
<file>mcc_generated_files\epwm1.h</file>
<hash>e1dacec839b43c4ec99f1710c3a7872ce32d2ea6dfe3856eb466e690b7ea75c9</hash>
</entry>
<entry>
<file>mcc_generated_files\eusart1.c</file>
<hash>4b28289ec5a9f1dd41eb4000a98bdf15a60c73701c716add6c562a154a431809</hash>
</entry>
<entry>
<file>mcc_generated_files\eusart1.h</file>
<hash>cb7a354159e217ac3955f23cce6d01d65df54018be773e73654ec951df42a7e9</hash>
</entry> </entry>
<entry> <entry>
<file>mcc_generated_files\interrupt_manager.c</file> <file>mcc_generated_files\interrupt_manager.c</file>
<hash>9bec65c4415d6a1861d1d33f5aecfcf2c426de3ac2962449aec821b45c527ef2</hash> <hash>9bec65c4415d6a1861d1d33f5aecfcf2c426de3ac2962449aec821b45c527ef2</hash>
</entry> </entry>
<entry> <entry>
<file>mcc_generated_files\eusart1.c</file> <file>mcc_generated_files\interrupt_manager.h</file>
<hash>d8ed730bd093892491a853d1821faa71f3a66365e71b5728f5d34612524be6ec</hash> <hash>5c311e57ab563c3fadc6e5c40b1e425436e9366c40e5772f46f393a9f8ed9d39</hash>
</entry>
<entry>
<file>mcc_generated_files\mcc.c</file>
<hash>32ff3e2dadb25f5b8ccb3d70520f2b25f98e471a9bccb87758edd960e922e48c</hash>
</entry>
<entry>
<file>mcc_generated_files\mcc.h</file>
<hash>52b447a5dc446f42c76e7a13f2403349cfdc20fc87fe880892a4f08ac41ec7ec</hash>
</entry>
<entry>
<file>mcc_generated_files\pin_manager.c</file>
<hash>1f9236370706611180887eedcb54392c08476036ee99409ce0d9a1f39ef165fb</hash>
</entry>
<entry>
<file>mcc_generated_files\pin_manager.h</file>
<hash>87e93cc6f9494828e660861178e9a299efbe16d73a441d92e3dca2a1cf6d54ed</hash>
</entry>
<entry>
<file>mcc_generated_files\tmr0.c</file>
<hash>5999b6142463be670db096db3ffefc4be674ac36a27ce3d5bc69c9811eb5c55f</hash>
</entry>
<entry>
<file>mcc_generated_files\tmr0.h</file>
<hash>60487f4faa42d9fec7389ebc68c7a0a01ec6343892ddd4f936b3e776d62a07b0</hash>
</entry>
<entry>
<file>mcc_generated_files\tmr2.c</file>
<hash>05c23c08bae910023f51fd801fa4b4107358a34dbad1624e66d9a30249d1fe86</hash>
</entry>
<entry>
<file>mcc_generated_files\tmr2.h</file>
<hash>9c49623fe191eb686818b525571464bbc0f83e271367728272f8bce53b917f55</hash>
</entry> </entry>
</generatedFileHashHistoryMap> </generatedFileHashHistoryMap>
</config> </config>