From ee81349055aa0947bb8bd6d19eb906a083f54d5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Tue, 14 Mar 2023 15:45:05 +0100 Subject: [PATCH] End of laboratory (should be final version) --- main.c | 3 +- nbproject/Makefile-default.mk | 26 +----- nbproject/Makefile-genesis.properties | 4 +- nbproject/configurations.xml | 2 - nbproject/private/configurations.xml | 2 +- nbproject/private/private.xml | 6 +- solar_panel.mc3 | 128 +++++++++++++------------- 7 files changed, 79 insertions(+), 92 deletions(-) diff --git a/main.c b/main.c index 24a7ef1..2749f6c 100644 --- a/main.c +++ b/main.c @@ -86,8 +86,9 @@ void main(void) EPWM1_LoadDutyValue(holding_registers[0]); input_registers[0] = measure_voltage(); + input_registers[1] = measure_current(offsetCurrent); uint16_t valueV = input_registers[0]; - uint16_t valueI = measure_current(offsetCurrent); + uint16_t valueI = input_registers[1]; char msg[MAX_COL+1]; //LCD_2x16_WriteCmd(0x01); // clear display diff --git a/nbproject/Makefile-default.mk b/nbproject/Makefile-default.mk index c184ead..daf6948 100644 --- a/nbproject/Makefile-default.mk +++ b/nbproject/Makefile-default.mk @@ -57,17 +57,17 @@ OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} # 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 -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 -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 +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 # 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 -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 @${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 ${OBJECTDIR}/lcd/lcd.p1: lcd/lcd.c nbproject/Makefile-${CND_CONF}.mk @${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 @${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 # ------------------------------------------------------------------------------------ diff --git a/nbproject/Makefile-genesis.properties b/nbproject/Makefile-genesis.properties index 58b7953..e0e3ccb 100644 --- a/nbproject/Makefile-genesis.properties +++ b/nbproject/Makefile-genesis.properties @@ -1,11 +1,11 @@ # -#Fri Mar 10 16:03:22 CET 2023 +#Tue Mar 14 13:52:25 CET 2023 default.languagetoolchain.version=2.40 default.Pack.dfplocation=C\:\\Program Files\\Microchip\\MPLABX\\v6.00\\packs\\Microchip\\PIC18F-J_DFP\\1.5.44 conf.ids=default default.languagetoolchain.dir=C\:\\Program Files\\Microchip\\xc8\\v2.40\\bin host.id=3awj-afwq-rl -configurations-xml=fddef5f935cc83784d98c896c2327263 +configurations-xml=4dc45b219db50423420a0eb2e1f688ad default.com-microchip-mplab-mdbcore-snap-SnapToolImpl.md5=eaa336cefb7fc46db8b50b7b2b6e54ca com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=6e02ca5e9f5042ffd365b42ab82d3a9b user-defined-mime-resolver-xml=none diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml index 8717c5e..8f2b7d6 100644 --- a/nbproject/configurations.xml +++ b/nbproject/configurations.xml @@ -23,7 +23,6 @@ crc.h measure.h modbus.h - uart.h crc.c measure.c modbus.c - uart.c 0 - :=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>9018:=<rev>0100:=<man>Microchip Technology Incorporated:=<prod>MPLAB Snap ICD:=<sn>BUR190971815:=<drv>x:=<xpt>b:=end + :=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>9018:=<rev>0100:=<man>Microchip Technology Incorporated:=<prod>MPLAB Snap ICD:=<sn>BUR190971824:=<drv>x:=<xpt>b:=end C:\Program Files\Microchip\xc8\v2.40\bin place holder 1 diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml index 5e6973e..05cea5c 100644 --- a/nbproject/private/private.xml +++ b/nbproject/private/private.xml @@ -3,9 +3,13 @@ - file:/C:/Users/remi/MPLABXProjects/solar_panel/mcc_generated_files/interrupt_manager.c + file:/C:/Program%20Files/Microchip/xc8/v2.40/pic/sources/c99/common/doprnt.c + file:/C:/Users/remi/MPLABXProjects/solar_panel/lcd/lcd.c + file:/C:/Users/remi/MPLABXProjects/solar_panel/modbus.h file:/C:/Users/remi/MPLABXProjects/solar_panel/main.c + file:/C:/Program%20Files/Microchip/xc8/v2.40/pic/sources/c99/common/aomod.c file:/C:/Users/remi/MPLABXProjects/solar_panel/modbus.c + file:/C:/Users/remi/MPLABXProjects/solar_panel/crc.c file:/C:/Users/remi/MPLABXProjects/solar_panel/mcc_generated_files/tmr0.c diff --git a/solar_panel.mc3 b/solar_panel.mc3 index 77b8116..c17b2d9 100644 --- a/solar_panel.mc3 +++ b/solar_panel.mc3 @@ -784,15 +784,15 @@ - 9600 + 9600.614 - Error: 0.006 % + Register set - easysetup + register @@ -5967,82 +5967,82 @@ 131.07200 - - - mcc_generated_files\mcc.h - 52b447a5dc446f42c76e7a13f2403349cfdc20fc87fe880892a4f08ac41ec7ec - - - mcc_generated_files\device_config.h - e658a4cb6ac1c79b2a52ab2754ebce26d229cbe4bd8464122f3272d1e76e5881 - - - mcc_generated_files\interrupt_manager.h - 5c311e57ab563c3fadc6e5c40b1e425436e9366c40e5772f46f393a9f8ed9d39 - - - mcc_generated_files\eusart1.h - cb7a354159e217ac3955f23cce6d01d65df54018be773e73654ec951df42a7e9 - - - mcc_generated_files\tmr0.h - 60487f4faa42d9fec7389ebc68c7a0a01ec6343892ddd4f936b3e776d62a07b0 - + main.c 30e3e0e5956e494fcd566f1509f2f2bbc404d25265a77934114af7c9d1fcdbd7 - - mcc_generated_files\device_config.c - 0c1446568049fa17e32a6aec2aad01e6cabc65cf60b9d57aceffd79e04f930c2 - - - mcc_generated_files\tmr2.h - 9c49623fe191eb686818b525571464bbc0f83e271367728272f8bce53b917f55 - - - mcc_generated_files\pin_manager.h - 87e93cc6f9494828e660861178e9a299efbe16d73a441d92e3dca2a1cf6d54ed - - - mcc_generated_files\tmr2.c - 05c23c08bae910023f51fd801fa4b4107358a34dbad1624e66d9a30249d1fe86 - - - mcc_generated_files\adc.h - 58eb4471903133ed806f7edbfce9c3cc4e0af3536917c8f81ad1cbdb72d919fc - - - mcc_generated_files\tmr0.c - 5999b6142463be670db096db3ffefc4be674ac36a27ce3d5bc69c9811eb5c55f - - - mcc_generated_files\epwm1.h - e1dacec839b43c4ec99f1710c3a7872ce32d2ea6dfe3856eb466e690b7ea75c9 - - - mcc_generated_files\pin_manager.c - 1f9236370706611180887eedcb54392c08476036ee99409ce0d9a1f39ef165fb - - - mcc_generated_files\epwm1.c - db307f67f622483528ffff92c5560b35b38162e4f93d1659723c7276b7265601 - mcc_generated_files\adc.c 62188981f98a350cfcc3227def37b9ded03569aedb061a1566fc3d03028da8f1 - mcc_generated_files\mcc.c - 32ff3e2dadb25f5b8ccb3d70520f2b25f98e471a9bccb87758edd960e922e48c + mcc_generated_files\adc.h + 58eb4471903133ed806f7edbfce9c3cc4e0af3536917c8f81ad1cbdb72d919fc + + + mcc_generated_files\device_config.c + 0c1446568049fa17e32a6aec2aad01e6cabc65cf60b9d57aceffd79e04f930c2 + + + mcc_generated_files\device_config.h + e658a4cb6ac1c79b2a52ab2754ebce26d229cbe4bd8464122f3272d1e76e5881 + + + mcc_generated_files\epwm1.c + db307f67f622483528ffff92c5560b35b38162e4f93d1659723c7276b7265601 + + + mcc_generated_files\epwm1.h + e1dacec839b43c4ec99f1710c3a7872ce32d2ea6dfe3856eb466e690b7ea75c9 + + + mcc_generated_files\eusart1.c + 4b28289ec5a9f1dd41eb4000a98bdf15a60c73701c716add6c562a154a431809 + + + mcc_generated_files\eusart1.h + cb7a354159e217ac3955f23cce6d01d65df54018be773e73654ec951df42a7e9 mcc_generated_files\interrupt_manager.c 9bec65c4415d6a1861d1d33f5aecfcf2c426de3ac2962449aec821b45c527ef2 - mcc_generated_files\eusart1.c - 4b28289ec5a9f1dd41eb4000a98bdf15a60c73701c716add6c562a154a431809 + mcc_generated_files\interrupt_manager.h + 5c311e57ab563c3fadc6e5c40b1e425436e9366c40e5772f46f393a9f8ed9d39 + + + mcc_generated_files\mcc.c + 32ff3e2dadb25f5b8ccb3d70520f2b25f98e471a9bccb87758edd960e922e48c + + + mcc_generated_files\mcc.h + 52b447a5dc446f42c76e7a13f2403349cfdc20fc87fe880892a4f08ac41ec7ec + + + mcc_generated_files\pin_manager.c + 1f9236370706611180887eedcb54392c08476036ee99409ce0d9a1f39ef165fb + + + mcc_generated_files\pin_manager.h + 87e93cc6f9494828e660861178e9a299efbe16d73a441d92e3dca2a1cf6d54ed + + + mcc_generated_files\tmr0.c + 5999b6142463be670db096db3ffefc4be674ac36a27ce3d5bc69c9811eb5c55f + + + mcc_generated_files\tmr0.h + 60487f4faa42d9fec7389ebc68c7a0a01ec6343892ddd4f936b3e776d62a07b0 + + + mcc_generated_files\tmr2.c + 05c23c08bae910023f51fd801fa4b4107358a34dbad1624e66d9a30249d1fe86 + + + mcc_generated_files\tmr2.h + 9c49623fe191eb686818b525571464bbc0f83e271367728272f8bce53b917f55 \ No newline at end of file