diff --git a/.gitignore b/.gitignore index 4c111fb..013cac4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ solar_panel.X/build/ solar_panel.X/debug/ -solar_panel.X/dist/ \ No newline at end of file +solar_panel.X/dist/ +build/ +debug/ +dist/ \ No newline at end of file diff --git a/solar_panel.X/Makefile b/Makefile similarity index 100% rename from solar_panel.X/Makefile rename to Makefile diff --git a/solar_panel.X/crc.c b/crc.c similarity index 100% rename from solar_panel.X/crc.c rename to crc.c diff --git a/solar_panel.X/crc.h b/crc.h similarity index 100% rename from solar_panel.X/crc.h rename to crc.h diff --git a/solar_panel.X/lcd/arialRoundedMTBold18ptBitmaps.c b/lcd/arialRoundedMTBold18ptBitmaps.c similarity index 100% rename from solar_panel.X/lcd/arialRoundedMTBold18ptBitmaps.c rename to lcd/arialRoundedMTBold18ptBitmaps.c diff --git a/solar_panel.X/lcd/ft5xx6.c b/lcd/ft5xx6.c similarity index 100% rename from solar_panel.X/lcd/ft5xx6.c rename to lcd/ft5xx6.c diff --git a/solar_panel.X/lcd/ft5xx6.h b/lcd/ft5xx6.h similarity index 100% rename from solar_panel.X/lcd/ft5xx6.h rename to lcd/ft5xx6.h diff --git a/solar_panel.X/lcd/lcd.c b/lcd/lcd.c similarity index 100% rename from solar_panel.X/lcd/lcd.c rename to lcd/lcd.c diff --git a/solar_panel.X/lcd/lcd.h b/lcd/lcd.h similarity index 100% rename from solar_panel.X/lcd/lcd.h rename to lcd/lcd.h diff --git a/solar_panel.X/lcd/ssd1963_cmd.h b/lcd/ssd1963_cmd.h similarity index 100% rename from solar_panel.X/lcd/ssd1963_cmd.h rename to lcd/ssd1963_cmd.h diff --git a/solar_panel.X/mcc_generated_files/adc.c b/mcc_generated_files/adc.c similarity index 100% rename from solar_panel.X/mcc_generated_files/adc.c rename to mcc_generated_files/adc.c diff --git a/solar_panel.X/mcc_generated_files/adc.h b/mcc_generated_files/adc.h similarity index 100% rename from solar_panel.X/mcc_generated_files/adc.h rename to mcc_generated_files/adc.h diff --git a/solar_panel.X/mcc_generated_files/device_config.c b/mcc_generated_files/device_config.c similarity index 100% rename from solar_panel.X/mcc_generated_files/device_config.c rename to mcc_generated_files/device_config.c diff --git a/solar_panel.X/mcc_generated_files/device_config.h b/mcc_generated_files/device_config.h similarity index 100% rename from solar_panel.X/mcc_generated_files/device_config.h rename to mcc_generated_files/device_config.h diff --git a/solar_panel.X/mcc_generated_files/epwm1.c b/mcc_generated_files/epwm1.c similarity index 100% rename from solar_panel.X/mcc_generated_files/epwm1.c rename to mcc_generated_files/epwm1.c diff --git a/solar_panel.X/mcc_generated_files/epwm1.h b/mcc_generated_files/epwm1.h similarity index 100% rename from solar_panel.X/mcc_generated_files/epwm1.h rename to mcc_generated_files/epwm1.h diff --git a/solar_panel.X/mcc_generated_files/eusart1.c b/mcc_generated_files/eusart1.c similarity index 100% rename from solar_panel.X/mcc_generated_files/eusart1.c rename to mcc_generated_files/eusart1.c diff --git a/solar_panel.X/mcc_generated_files/eusart1.h b/mcc_generated_files/eusart1.h similarity index 100% rename from solar_panel.X/mcc_generated_files/eusart1.h rename to mcc_generated_files/eusart1.h diff --git a/solar_panel.X/mcc_generated_files/interrupt_manager.c b/mcc_generated_files/interrupt_manager.c similarity index 100% rename from solar_panel.X/mcc_generated_files/interrupt_manager.c rename to mcc_generated_files/interrupt_manager.c diff --git a/solar_panel.X/mcc_generated_files/interrupt_manager.h b/mcc_generated_files/interrupt_manager.h similarity index 100% rename from solar_panel.X/mcc_generated_files/interrupt_manager.h rename to mcc_generated_files/interrupt_manager.h diff --git a/solar_panel.X/mcc_generated_files/mcc.c b/mcc_generated_files/mcc.c similarity index 100% rename from solar_panel.X/mcc_generated_files/mcc.c rename to mcc_generated_files/mcc.c diff --git a/solar_panel.X/mcc_generated_files/mcc.h b/mcc_generated_files/mcc.h similarity index 100% rename from solar_panel.X/mcc_generated_files/mcc.h rename to mcc_generated_files/mcc.h diff --git a/solar_panel.X/mcc_generated_files/pin_manager.c b/mcc_generated_files/pin_manager.c similarity index 100% rename from solar_panel.X/mcc_generated_files/pin_manager.c rename to mcc_generated_files/pin_manager.c diff --git a/solar_panel.X/mcc_generated_files/pin_manager.h b/mcc_generated_files/pin_manager.h similarity index 100% rename from solar_panel.X/mcc_generated_files/pin_manager.h rename to mcc_generated_files/pin_manager.h diff --git a/solar_panel.X/mcc_generated_files/tmr0.c b/mcc_generated_files/tmr0.c similarity index 100% rename from solar_panel.X/mcc_generated_files/tmr0.c rename to mcc_generated_files/tmr0.c diff --git a/solar_panel.X/mcc_generated_files/tmr0.h b/mcc_generated_files/tmr0.h similarity index 100% rename from solar_panel.X/mcc_generated_files/tmr0.h rename to mcc_generated_files/tmr0.h diff --git a/solar_panel.X/mcc_generated_files/tmr2.c b/mcc_generated_files/tmr2.c similarity index 100% rename from solar_panel.X/mcc_generated_files/tmr2.c rename to mcc_generated_files/tmr2.c diff --git a/solar_panel.X/mcc_generated_files/tmr2.h b/mcc_generated_files/tmr2.h similarity index 100% rename from solar_panel.X/mcc_generated_files/tmr2.h rename to mcc_generated_files/tmr2.h diff --git a/solar_panel.X/measure.c b/measure.c similarity index 100% rename from solar_panel.X/measure.c rename to measure.c diff --git a/solar_panel.X/measure.h b/measure.h similarity index 100% rename from solar_panel.X/measure.h rename to measure.h diff --git a/solar_panel.X/modbus.c b/modbus.c similarity index 100% rename from solar_panel.X/modbus.c rename to modbus.c diff --git a/solar_panel.X/modbus.h b/modbus.h similarity index 100% rename from solar_panel.X/modbus.h rename to modbus.h diff --git a/solar_panel.X/nbproject/Makefile-default.mk b/nbproject/Makefile-default.mk similarity index 95% rename from solar_panel.X/nbproject/Makefile-default.mk rename to nbproject/Makefile-default.mk index b0689c8..c184ead 100644 --- a/solar_panel.X/nbproject/Makefile-default.mk +++ b/nbproject/Makefile-default.mk @@ -30,12 +30,12 @@ ifeq ($(TYPE_IMAGE), DEBUG_RUN) IMAGE_TYPE=debug OUTPUT_SUFFIX=elf DEBUGGABLE_SUFFIX=elf -FINAL_IMAGE=${DISTDIR}/solar_panel.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} +FINAL_IMAGE=${DISTDIR}/solar_panel.${IMAGE_TYPE}.${OUTPUT_SUFFIX} else IMAGE_TYPE=production OUTPUT_SUFFIX=hex DEBUGGABLE_SUFFIX=elf -FINAL_IMAGE=${DISTDIR}/solar_panel.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} +FINAL_IMAGE=${DISTDIR}/solar_panel.${IMAGE_TYPE}.${OUTPUT_SUFFIX} endif ifeq ($(COMPARE_BUILD), true) @@ -88,7 +88,7 @@ FIXDEPS=fixDeps ifneq ($(INFORMATION_MESSAGE), ) @echo $(INFORMATION_MESSAGE) endif - ${MAKE} -f nbproject/Makefile-default.mk ${DISTDIR}/solar_panel.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} + ${MAKE} -f nbproject/Makefile-default.mk ${DISTDIR}/solar_panel.${IMAGE_TYPE}.${OUTPUT_SUFFIX} MP_PROCESSOR_OPTION=18F97J60 # ------------------------------------------------------------------------------------ @@ -352,15 +352,15 @@ endif # ------------------------------------------------------------------------------------ # Rules for buildStep: link ifeq ($(TYPE_IMAGE), DEBUG_RUN) -${DISTDIR}/solar_panel.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk +${DISTDIR}/solar_panel.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} ${DISTDIR} - ${MP_CC} $(MP_EXTRA_LD_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -Wl,-Map=${DISTDIR}/solar_panel.X.${IMAGE_TYPE}.map -D__DEBUG=1 -mdebugger=snap -DXPRJ_default=$(CND_CONF) -Wl,--defsym=__MPLAB_BUILD=1 -mdfp="${DFP_DIR}/xc8" -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto $(COMPARISON_BUILD) -Wl,--memorysummary,${DISTDIR}/memoryfile.xml -o ${DISTDIR}/solar_panel.X.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} - @${RM} ${DISTDIR}/solar_panel.X.${IMAGE_TYPE}.hex + ${MP_CC} $(MP_EXTRA_LD_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -Wl,-Map=${DISTDIR}/solar_panel.${IMAGE_TYPE}.map -D__DEBUG=1 -mdebugger=snap -DXPRJ_default=$(CND_CONF) -Wl,--defsym=__MPLAB_BUILD=1 -mdfp="${DFP_DIR}/xc8" -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto $(COMPARISON_BUILD) -Wl,--memorysummary,${DISTDIR}/memoryfile.xml -o ${DISTDIR}/solar_panel.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} + @${RM} ${DISTDIR}/solar_panel.${IMAGE_TYPE}.hex else -${DISTDIR}/solar_panel.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk +${DISTDIR}/solar_panel.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} ${DISTDIR} - ${MP_CC} $(MP_EXTRA_LD_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -Wl,-Map=${DISTDIR}/solar_panel.X.${IMAGE_TYPE}.map -DXPRJ_default=$(CND_CONF) -Wl,--defsym=__MPLAB_BUILD=1 -mdfp="${DFP_DIR}/xc8" -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto $(COMPARISON_BUILD) -Wl,--memorysummary,${DISTDIR}/memoryfile.xml -o ${DISTDIR}/solar_panel.X.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} + ${MP_CC} $(MP_EXTRA_LD_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -Wl,-Map=${DISTDIR}/solar_panel.${IMAGE_TYPE}.map -DXPRJ_default=$(CND_CONF) -Wl,--defsym=__MPLAB_BUILD=1 -mdfp="${DFP_DIR}/xc8" -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto $(COMPARISON_BUILD) -Wl,--memorysummary,${DISTDIR}/memoryfile.xml -o ${DISTDIR}/solar_panel.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} endif diff --git a/solar_panel.X/nbproject/Makefile-genesis.properties b/nbproject/Makefile-genesis.properties similarity index 86% rename from solar_panel.X/nbproject/Makefile-genesis.properties rename to nbproject/Makefile-genesis.properties index 7884d01..2dac5f0 100644 --- a/solar_panel.X/nbproject/Makefile-genesis.properties +++ b/nbproject/Makefile-genesis.properties @@ -1,5 +1,5 @@ # -#Fri Mar 03 16:00:47 CET 2023 +#Thu Mar 09 15:57:40 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 @@ -10,5 +10,5 @@ default.com-microchip-mplab-mdbcore-snap-SnapToolImpl.md5=eaa336cefb7fc46db8b50b com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=6e02ca5e9f5042ffd365b42ab82d3a9b user-defined-mime-resolver-xml=none default.com-microchip-mplab-nbide-toolchain-xc8-XC8LanguageToolchain.md5=ab1e0737b447a24f7366e9fd8fe5a2f0 -proj.dir=C\:\\Users\\remi\\Downloads\\MCU\\solar_panel\\solar_panel.X +proj.dir=C\:\\Users\\remi\\MPLABXProjects\\solar_panel host.platform=windows diff --git a/solar_panel.X/nbproject/Makefile-impl.mk b/nbproject/Makefile-impl.mk similarity index 98% rename from solar_panel.X/nbproject/Makefile-impl.mk rename to nbproject/Makefile-impl.mk index f72cccd..a5b9960 100644 --- a/solar_panel.X/nbproject/Makefile-impl.mk +++ b/nbproject/Makefile-impl.mk @@ -24,7 +24,7 @@ CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}} # Project Name -PROJECTNAME=solar_panel.X +PROJECTNAME=solar_panel # Active Configuration DEFAULTCONF=default diff --git a/solar_panel.X/nbproject/Makefile-local-default.mk b/nbproject/Makefile-local-default.mk similarity index 100% rename from solar_panel.X/nbproject/Makefile-local-default.mk rename to nbproject/Makefile-local-default.mk diff --git a/nbproject/Makefile-variables.mk b/nbproject/Makefile-variables.mk new file mode 100644 index 0000000..3b32a6c --- /dev/null +++ b/nbproject/Makefile-variables.mk @@ -0,0 +1,10 @@ +# +# Generated - do not edit! +# +# NOCDDL +# +CND_BASEDIR=`pwd` +# default configuration +CND_ARTIFACT_DIR_default=dist/default/production +CND_ARTIFACT_NAME_default=solar_panel.production.hex +CND_ARTIFACT_PATH_default=dist/default/production/solar_panel.production.hex diff --git a/solar_panel.X/nbproject/configurations.xml b/nbproject/configurations.xml similarity index 100% rename from solar_panel.X/nbproject/configurations.xml rename to nbproject/configurations.xml diff --git a/solar_panel.X/nbproject/private/configurations.xml b/nbproject/private/configurations.xml similarity index 100% rename from solar_panel.X/nbproject/private/configurations.xml rename to nbproject/private/configurations.xml diff --git a/solar_panel.X/nbproject/private/private.xml b/nbproject/private/private.xml similarity index 100% rename from solar_panel.X/nbproject/private/private.xml rename to nbproject/private/private.xml diff --git a/solar_panel.X/nbproject/project.xml b/nbproject/project.xml similarity index 100% rename from solar_panel.X/nbproject/project.xml rename to nbproject/project.xml diff --git a/solar_panel.X/old_main.c b/old_main.c similarity index 100% rename from solar_panel.X/old_main.c rename to old_main.c diff --git a/solar_panel.X/main.c b/solar_panel.X/main.c deleted file mode 100644 index de0ff6a..0000000 --- a/solar_panel.X/main.c +++ /dev/null @@ -1,120 +0,0 @@ -/** - Generated Main Source File - - Company: - Microchip Technology Inc. - - File Name: - main.c - - Summary: - This is the main file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs - - Description: - This header file provides implementations for driver APIs for all modules selected in the GUI. - Generation Information : - Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.81.8 - Device : PIC18F97J60 - Driver Version : 2.00 -*/ - -/* - (c) 2018 Microchip Technology Inc. and its subsidiaries. - - Subject to your compliance with these terms, you may use Microchip software and any - derivatives exclusively with Microchip products. It is your responsibility to comply with third party - license terms applicable to your use of third party software (including open source software) that - may accompany Microchip software. - - THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER - EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY - IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS - FOR A PARTICULAR PURPOSE. - - IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, - INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND - WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP - HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO - THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL - CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT - OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS - SOFTWARE. -*/ - -#include "mcc_generated_files/mcc.h" -#include "lcd/lcd.h" -#include "measure.h" -#include "modbus.h" - -#define MAX_COL 16 -/* - Main application - */ -void resetTMR0(void); -void endFrame(void); - -void main(void) -{ - // Initialize the device - SYSTEM_Initialize(); - EPWM1_LoadDutyValue(0); - - Lcd_Init(); - adc_init(); - modbus_init(0x80); - uint16_t offsetCurrent = 0; - offsetCurrent = measure_current(offsetCurrent); - - // If using interrupts in PIC18 High/Low Priority Mode you need to enable the Global High and Low Interrupts - // If using interrupts in PIC Mid-Range Compatibility Mode you need to enable the Global and Peripheral Interrupts - // Use the following macros to: - - // Enable the Global Interrupts - INTERRUPT_GlobalInterruptEnable(); - - // Disable the Global Interrupts - //INTERRUPT_GlobalInterruptDisable(); - - // Enable the Peripheral Interrupts - INTERRUPT_PeripheralInterruptEnable(); - - // Disable the Peripheral Interrupts - //INTERRUPT_PeripheralInterruptDisable(); - uint16_t foo = 512; - EUSART1_SetRxInterruptHandler(resetTMR0); - TMR0_SetInterruptHandler(endFrame); - while (1) - { - foo = ++foo%1023; - EPWM1_LoadDutyValue(foo); - uint16_t valueV = measure_voltage(); - uint16_t valueI = measure_current(offsetCurrent); - - char msg[MAX_COL+1]; - //LCD_2x16_WriteCmd(0x01); // clear display - - sprintf(msg, "U = %04d [mV] ", valueV); - LCD_2x16_WriteMsg(msg,0); - - sprintf(msg, "I = %04d [uA] ", valueI); - LCD_2x16_WriteMsg(msg,1); - - } -} - - -void resetTMR0(void){ - INTCONbits.TMR0IF = 0; - TMR0_Reload(); - TMR0_StartTimer(); -} - -void endFrame(void){ - TMR0_StopTimer(); - modbus_analyse_and_answer(); - - // TODO -} -/** - End of File -*/ \ No newline at end of file diff --git a/solar_panel.X/nbproject/Makefile-variables.mk b/solar_panel.X/nbproject/Makefile-variables.mk deleted file mode 100644 index dcae15c..0000000 --- a/solar_panel.X/nbproject/Makefile-variables.mk +++ /dev/null @@ -1,10 +0,0 @@ -# -# Generated - do not edit! -# -# NOCDDL -# -CND_BASEDIR=`pwd` -# default configuration -CND_ARTIFACT_DIR_default=dist/default/production -CND_ARTIFACT_NAME_default=solar_panel.X.production.hex -CND_ARTIFACT_PATH_default=dist/default/production/solar_panel.X.production.hex diff --git a/solar_panel.X/solar_panel.mc3 b/solar_panel.mc3 similarity index 100% rename from solar_panel.X/solar_panel.mc3 rename to solar_panel.mc3 diff --git a/solar_panel.X/uart.c b/uart.c similarity index 100% rename from solar_panel.X/uart.c rename to uart.c diff --git a/solar_panel.X/uart.h b/uart.h similarity index 100% rename from solar_panel.X/uart.h rename to uart.h