From 7d538f7a60e45b24394c4e9282d1f7312bcde8da Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Sun, 9 Feb 2020 09:51:39 -0600 Subject: s p a c i n g --- Lab_2B.X/lab2b_asm.s | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lab_2B.X/lab2b_asm.s b/Lab_2B.X/lab2b_asm.s index 4b983c2..3c3e19e 100644 --- a/Lab_2B.X/lab2b_asm.s +++ b/Lab_2B.X/lab2b_asm.s @@ -19,7 +19,7 @@ _wait_1ms: nop return -_write_0: ;2 cycles for function call +_write_0: ;2 cycles for function call inc LATA ;1 repeat #3 ;1 for load nop ;3+1=4 nop @@ -29,7 +29,7 @@ _write_0: ;2 cycles for function call return ;3 return -_write_1: ;2 cycle call +_write_1: ;2 cycle call inc LATA ;1 repeat #10;1 load nop ;1+10=11 nop -- cgit v1.2.3 From 35d19270a62063f85b842d5df2981e8a88b21bd9 Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Sun, 9 Feb 2020 11:30:30 -0600 Subject: redo? --- Lab_2B.X/lab2b_c.c | 85 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/Lab_2B.X/lab2b_c.c b/Lab_2B.X/lab2b_c.c index 21fdcba..7992b5b 100644 --- a/Lab_2B.X/lab2b_c.c +++ b/Lab_2B.X/lab2b_c.c @@ -36,73 +36,76 @@ int main(void) { } void writeColor(int r, int g, int b) { + int i = 0; LATA = 0x0000; wait_100us(); - - for (int i = 0; i < 8; i++){ + while (i < 8) { if (r & 1) { write_1(); } else { write_0(); } r >> 1; + ++i; } - for (int j = 0; j < 8; j++){ + while (i > 0) { if (g & 1) { write_1(); } else { write_0(); } - g >> 1; + g >> 1; + --i; } - for (int k = 0; k < 8; k++){ + while (i < 8){ if (b & 1) { write_1(); } else { write_0(); } b >> 1; + ++i; } } void loop(void) { while (1) { - LATA = 0x0000; - wait_100us(); +// LATA = 0x0000; +// wait_100us(); +// +// //RED +// write_1(); +// write_1(); +// write_1(); +// write_1(); +// +// write_1(); +// write_1(); +// write_1(); +// write_1(); +// +// //GREEN +// write_1(); +// write_0(); +// write_0(); +// write_1(); +// +// write_1(); +// write_0(); +// write_1(); +// write_1(); +// +// //BLUE +// write_0(); +// write_0(); +// write_0(); +// write_0(); +// +// write_0(); +// write_0(); +// write_0(); +// write_0(); - //RED - write_1(); - write_1(); - write_1(); - write_1(); - - write_1(); - write_1(); - write_1(); - write_1(); - - //GREEN - write_1(); - write_0(); - write_0(); - write_1(); - - write_1(); - write_0(); - write_1(); - write_1(); - - //BLUE - write_0(); - write_0(); - write_0(); - write_0(); - - write_0(); - write_0(); - write_0(); - write_0(); - - //writeColor(255, 155, 0); + writeColor(255, 155, 0); } } \ No newline at end of file -- cgit v1.2.3 From 98004bbcbed1ea89463d00dcf11a47ede5c43ef8 Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Sun, 9 Feb 2020 11:30:30 -0600 Subject: add some c o m m e n t s --- Lab_2B.X/lab2b_c.c | 88 +++++++++++++++++++++++++++++------------------------- 1 file changed, 47 insertions(+), 41 deletions(-) diff --git a/Lab_2B.X/lab2b_c.c b/Lab_2B.X/lab2b_c.c index 21fdcba..bf917a3 100644 --- a/Lab_2B.X/lab2b_c.c +++ b/Lab_2B.X/lab2b_c.c @@ -36,73 +36,79 @@ int main(void) { } void writeColor(int r, int g, int b) { + int i = 0; LATA = 0x0000; wait_100us(); - - for (int i = 0; i < 8; i++){ + //RED + while (i < 8) { if (r & 1) { write_1(); } else { write_0(); } r >> 1; + ++i; } - for (int j = 0; j < 8; j++){ + //GREEN + while (i > 0) { if (g & 1) { write_1(); } else { write_0(); } - g >> 1; + g >> 1; + --i; } - for (int k = 0; k < 8; k++){ + //BLUE + while (i < 8){ if (b & 1) { write_1(); } else { write_0(); } b >> 1; + ++i; } } void loop(void) { while (1) { - LATA = 0x0000; - wait_100us(); +// LATA = 0x0000; +// wait_100us(); +// +// //RED +// write_1(); +// write_1(); +// write_1(); +// write_1(); +// +// write_1(); +// write_1(); +// write_1(); +// write_1(); +// +// //GREEN +// write_1(); +// write_0(); +// write_0(); +// write_1(); +// +// write_1(); +// write_0(); +// write_1(); +// write_1(); +// +// //BLUE +// write_0(); +// write_0(); +// write_0(); +// write_0(); +// +// write_0(); +// write_0(); +// write_0(); +// write_0(); - //RED - write_1(); - write_1(); - write_1(); - write_1(); - - write_1(); - write_1(); - write_1(); - write_1(); - - //GREEN - write_1(); - write_0(); - write_0(); - write_1(); - - write_1(); - write_0(); - write_1(); - write_1(); - - //BLUE - write_0(); - write_0(); - write_0(); - write_0(); - - write_0(); - write_0(); - write_0(); - write_0(); - - //writeColor(255, 155, 0); + writeColor(255, 155, 0); } } \ No newline at end of file -- cgit v1.2.3 From 8d15625be9753e9898f44fa9a9a131191f48fece Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Sun, 9 Feb 2020 11:38:35 -0600 Subject: HELP --- Lab_2B.X/lab2b_c.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lab_2B.X/lab2b_c.c b/Lab_2B.X/lab2b_c.c index 7992b5b..893c812 100644 --- a/Lab_2B.X/lab2b_c.c +++ b/Lab_2B.X/lab2b_c.c @@ -39,6 +39,7 @@ void writeColor(int r, int g, int b) { int i = 0; LATA = 0x0000; wait_100us(); + //RED while (i < 8) { if (r & 1) { write_1(); @@ -48,6 +49,7 @@ void writeColor(int r, int g, int b) { r >> 1; ++i; } + //GREEN while (i > 0) { if (g & 1) { write_1(); @@ -57,6 +59,7 @@ void writeColor(int r, int g, int b) { g >> 1; --i; } + //BLUE while (i < 8){ if (b & 1) { write_1(); @@ -108,4 +111,4 @@ void loop(void) { writeColor(255, 155, 0); } -} \ No newline at end of file +} -- cgit v1.2.3 From 7ba4058996b07499a7e9a15751132ded28074774 Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Sun, 9 Feb 2020 11:39:00 -0600 Subject: A --- Lab 2.X/nbproject/private/private.xml | 9 ++ Lab_2B.X/Makefile | 113 ++++++++++++++ Lab_2B.X/dist/default/production/memoryfile.xml | 18 +++ Lab_2B.X/nbproject/Makefile-default.mk | 161 +++++++++++++++++++ Lab_2B.X/nbproject/Makefile-genesis.properties | 10 ++ Lab_2B.X/nbproject/Makefile-impl.mk | 69 +++++++++ Lab_2B.X/nbproject/Makefile-local-default.mk | 38 +++++ Lab_2B.X/nbproject/Makefile-variables.mk | 13 ++ Lab_2B.X/nbproject/Package-default.bash | 73 +++++++++ Lab_2B.X/nbproject/configurations.xml | 197 ++++++++++++++++++++++++ Lab_2B.X/nbproject/private/configurations.xml | 25 +++ Lab_2B.X/nbproject/project.xml | 29 ++++ 12 files changed, 755 insertions(+) create mode 100644 Lab 2.X/nbproject/private/private.xml create mode 100644 Lab_2B.X/Makefile create mode 100644 Lab_2B.X/dist/default/production/memoryfile.xml create mode 100644 Lab_2B.X/nbproject/Makefile-default.mk create mode 100644 Lab_2B.X/nbproject/Makefile-genesis.properties create mode 100644 Lab_2B.X/nbproject/Makefile-impl.mk create mode 100644 Lab_2B.X/nbproject/Makefile-local-default.mk create mode 100644 Lab_2B.X/nbproject/Makefile-variables.mk create mode 100644 Lab_2B.X/nbproject/Package-default.bash create mode 100644 Lab_2B.X/nbproject/configurations.xml create mode 100644 Lab_2B.X/nbproject/private/configurations.xml create mode 100644 Lab_2B.X/nbproject/project.xml diff --git a/Lab 2.X/nbproject/private/private.xml b/Lab 2.X/nbproject/private/private.xml new file mode 100644 index 0000000..669243b --- /dev/null +++ b/Lab 2.X/nbproject/private/private.xml @@ -0,0 +1,9 @@ + + + + + + file:/C:/Users/Ross/MPLABXProjects/EE2361Projects/Lab%202.X/Lab2A.s + + + diff --git a/Lab_2B.X/Makefile b/Lab_2B.X/Makefile new file mode 100644 index 0000000..fca8e2c --- /dev/null +++ b/Lab_2B.X/Makefile @@ -0,0 +1,113 @@ +# +# There exist several targets which are by default empty and which can be +# used for execution of your targets. These targets are usually executed +# before and after some main targets. They are: +# +# .build-pre: called before 'build' target +# .build-post: called after 'build' target +# .clean-pre: called before 'clean' target +# .clean-post: called after 'clean' target +# .clobber-pre: called before 'clobber' target +# .clobber-post: called after 'clobber' target +# .all-pre: called before 'all' target +# .all-post: called after 'all' target +# .help-pre: called before 'help' target +# .help-post: called after 'help' target +# +# Targets beginning with '.' are not intended to be called on their own. +# +# Main targets can be executed directly, and they are: +# +# build build a specific configuration +# clean remove built files from a configuration +# clobber remove all built files +# all build all configurations +# help print help mesage +# +# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and +# .help-impl are implemented in nbproject/makefile-impl.mk. +# +# Available make variables: +# +# CND_BASEDIR base directory for relative paths +# CND_DISTDIR default top distribution directory (build artifacts) +# CND_BUILDDIR default top build directory (object files, ...) +# CONF name of current configuration +# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration) +# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration) +# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration) +# CND_PACKAGE_DIR_${CONF} directory of package (current configuration) +# CND_PACKAGE_NAME_${CONF} name of package (current configuration) +# CND_PACKAGE_PATH_${CONF} path to package (current configuration) +# +# NOCDDL + + +# Environment +MKDIR=mkdir +CP=cp +CCADMIN=CCadmin +RANLIB=ranlib + + +# build +build: .build-post + +.build-pre: +# Add your pre 'build' code here... + +.build-post: .build-impl +# Add your post 'build' code here... + + +# clean +clean: .clean-post + +.clean-pre: +# Add your pre 'clean' code here... +# WARNING: the IDE does not call this target since it takes a long time to +# simply run make. Instead, the IDE removes the configuration directories +# under build and dist directly without calling make. +# This target is left here so people can do a clean when running a clean +# outside the IDE. + +.clean-post: .clean-impl +# Add your post 'clean' code here... + + +# clobber +clobber: .clobber-post + +.clobber-pre: +# Add your pre 'clobber' code here... + +.clobber-post: .clobber-impl +# Add your post 'clobber' code here... + + +# all +all: .all-post + +.all-pre: +# Add your pre 'all' code here... + +.all-post: .all-impl +# Add your post 'all' code here... + + +# help +help: .help-post + +.help-pre: +# Add your pre 'help' code here... + +.help-post: .help-impl +# Add your post 'help' code here... + + + +# include project implementation makefile +include nbproject/Makefile-impl.mk + +# include project make variables +include nbproject/Makefile-variables.mk diff --git a/Lab_2B.X/dist/default/production/memoryfile.xml b/Lab_2B.X/dist/default/production/memoryfile.xml new file mode 100644 index 0000000..94e91e3 --- /dev/null +++ b/Lab_2B.X/dist/default/production/memoryfile.xml @@ -0,0 +1,18 @@ + + + + + + bytes + 8192 + 0 + 8192 + + + bytes + 65274 + 591 + 64683 + + + diff --git a/Lab_2B.X/nbproject/Makefile-default.mk b/Lab_2B.X/nbproject/Makefile-default.mk new file mode 100644 index 0000000..1a98ea7 --- /dev/null +++ b/Lab_2B.X/nbproject/Makefile-default.mk @@ -0,0 +1,161 @@ +# +# Generated Makefile - do not edit! +# +# Edit the Makefile in the project folder instead (../Makefile). Each target +# has a -pre and a -post target defined where you can add customized code. +# +# This makefile implements configuration specific macros and targets. + + +# Include project Makefile +ifeq "${IGNORE_LOCAL}" "TRUE" +# do not include local makefile. User is passing all local related variables already +else +include Makefile +# Include makefile containing local settings +ifeq "$(wildcard nbproject/Makefile-local-default.mk)" "nbproject/Makefile-local-default.mk" +include nbproject/Makefile-local-default.mk +endif +endif + +# Environment +MKDIR=gnumkdir -p +RM=rm -f +MV=mv +CP=cp + +# Macros +CND_CONF=default +ifeq ($(TYPE_IMAGE), DEBUG_RUN) +IMAGE_TYPE=debug +OUTPUT_SUFFIX=elf +DEBUGGABLE_SUFFIX=elf +FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/Lab_2B.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} +else +IMAGE_TYPE=production +OUTPUT_SUFFIX=hex +DEBUGGABLE_SUFFIX=elf +FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/Lab_2B.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} +endif + +ifeq ($(COMPARE_BUILD), true) +COMPARISON_BUILD=-mafrlcsj +else +COMPARISON_BUILD= +endif + +ifdef SUB_IMAGE_ADDRESS +SUB_IMAGE_ADDRESS_COMMAND=--image-address $(SUB_IMAGE_ADDRESS) +else +SUB_IMAGE_ADDRESS_COMMAND= +endif + +# Object Directory +OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} + +# Distribution Directory +DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} + +# Source Files Quoted if spaced +SOURCEFILES_QUOTED_IF_SPACED=lab2b_asm.s + +# Object Files Quoted if spaced +OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/lab2b_asm.o +POSSIBLE_DEPFILES=${OBJECTDIR}/lab2b_asm.o.d + +# Object Files +OBJECTFILES=${OBJECTDIR}/lab2b_asm.o + +# Source Files +SOURCEFILES=lab2b_asm.s + + + +CFLAGS= +ASFLAGS= +LDLIBSOPTIONS= + +############# Tool locations ########################################## +# If you copy a project from one host to another, the path where the # +# compiler is installed may be different. # +# If you open this project with MPLAB X in the new host, this # +# makefile will be regenerated and the paths will be corrected. # +####################################################################### +# fixDeps replaces a bunch of sed/cat/printf statements that slow down the build +FIXDEPS=fixDeps + +.build-conf: ${BUILD_SUBPROJECTS} +ifneq ($(INFORMATION_MESSAGE), ) + @echo $(INFORMATION_MESSAGE) +endif + ${MAKE} -f nbproject/Makefile-default.mk dist/${CND_CONF}/${IMAGE_TYPE}/Lab_2B.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} + +MP_PROCESSOR_OPTION=24FJ64GA002 +MP_LINKER_FILE_OPTION=,--script=p24FJ64GA002.gld +# ------------------------------------------------------------------------------------ +# Rules for buildStep: compile +ifeq ($(TYPE_IMAGE), DEBUG_RUN) +else +endif + +# ------------------------------------------------------------------------------------ +# Rules for buildStep: assemble +ifeq ($(TYPE_IMAGE), DEBUG_RUN) +${OBJECTDIR}/lab2b_asm.o: lab2b_asm.s nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}" + @${RM} ${OBJECTDIR}/lab2b_asm.o.d + @${RM} ${OBJECTDIR}/lab2b_asm.o + ${MP_CC} $(MP_EXTRA_AS_PRE) lab2b_asm.s -o ${OBJECTDIR}/lab2b_asm.o -c -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc -Wa,-MD,"${OBJECTDIR}/lab2b_asm.o.d",--defsym=__MPLAB_BUILD=1,--defsym=__ICD2RAM=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,--defsym=__MPLAB_DEBUGGER_PK3=1,-g,--no-relax$(MP_EXTRA_AS_POST) -mdfp=${DFP_DIR}/xc16 + @${FIXDEPS} "${OBJECTDIR}/lab2b_asm.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ + +else +${OBJECTDIR}/lab2b_asm.o: lab2b_asm.s nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}" + @${RM} ${OBJECTDIR}/lab2b_asm.o.d + @${RM} ${OBJECTDIR}/lab2b_asm.o + ${MP_CC} $(MP_EXTRA_AS_PRE) lab2b_asm.s -o ${OBJECTDIR}/lab2b_asm.o -c -mcpu=$(MP_PROCESSOR_OPTION) -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc -Wa,-MD,"${OBJECTDIR}/lab2b_asm.o.d",--defsym=__MPLAB_BUILD=1,-g,--no-relax$(MP_EXTRA_AS_POST) -mdfp=${DFP_DIR}/xc16 + @${FIXDEPS} "${OBJECTDIR}/lab2b_asm.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ + +endif + +# ------------------------------------------------------------------------------------ +# Rules for buildStep: assemblePreproc +ifeq ($(TYPE_IMAGE), DEBUG_RUN) +else +endif + +# ------------------------------------------------------------------------------------ +# Rules for buildStep: link +ifeq ($(TYPE_IMAGE), DEBUG_RUN) +dist/${CND_CONF}/${IMAGE_TYPE}/Lab_2B.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} + ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/Lab_2B.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG=__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -mreserve=data@0x800:0x81F -mreserve=data@0x820:0x821 -mreserve=data@0x822:0x823 -mreserve=data@0x824:0x825 -mreserve=data@0x826:0x84F -Wl,,,--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,-D__DEBUG=__DEBUG,--defsym=__MPLAB_DEBUGGER_PK3=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,-Map="${DISTDIR}/${PROJECTNAME}.${IMAGE_TYPE}.map",--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) -mdfp=${DFP_DIR}/xc16 + +else +dist/${CND_CONF}/${IMAGE_TYPE}/Lab_2B.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} + ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/Lab_2B.X.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -Wl,,,--defsym=__MPLAB_BUILD=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,-Map="${DISTDIR}/${PROJECTNAME}.${IMAGE_TYPE}.map",--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) -mdfp=${DFP_DIR}/xc16 + ${MP_CC_DIR}\\xc16-bin2hex dist/${CND_CONF}/${IMAGE_TYPE}/Lab_2B.X.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} -a -omf=elf -mdfp=${DFP_DIR}/xc16 + +endif + + +# Subprojects +.build-subprojects: + + +# Subprojects +.clean-subprojects: + +# Clean Targets +.clean-conf: ${CLEAN_SUBPROJECTS} + ${RM} -r build/default + ${RM} -r dist/default + +# Enable dependency checking +.dep.inc: .depcheck-impl + +DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES}) +ifneq (${DEPFILES},) +include ${DEPFILES} +endif diff --git a/Lab_2B.X/nbproject/Makefile-genesis.properties b/Lab_2B.X/nbproject/Makefile-genesis.properties new file mode 100644 index 0000000..8858704 --- /dev/null +++ b/Lab_2B.X/nbproject/Makefile-genesis.properties @@ -0,0 +1,10 @@ +# +#Sun Feb 09 11:33:23 CST 2020 +default.Pack.dfplocation=C\:\\Program Files (x86)\\Microchip\\MPLABX\\v5.30\\packs\\Microchip\\PIC24F-GA-GB_DFP\\1.1.74 +default.com-microchip-mplab-nbide-toolchainXC16-XC16LanguageToolchain.md5=3de759bc6af06f5ee7453ec146192402 +default.languagetoolchain.dir=C\:\\Program Files (x86)\\Microchip\\xc16\\v1.41\\bin +configurations-xml=2eaa5545d402158412725c16a60e9fc5 +com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=7cd2eead2ea6964989cbf02efe721a76 +default.languagetoolchain.version=1.41 +host.platform=windows +conf.ids=default diff --git a/Lab_2B.X/nbproject/Makefile-impl.mk b/Lab_2B.X/nbproject/Makefile-impl.mk new file mode 100644 index 0000000..d19ad88 --- /dev/null +++ b/Lab_2B.X/nbproject/Makefile-impl.mk @@ -0,0 +1,69 @@ +# +# Generated Makefile - do not edit! +# +# Edit the Makefile in the project folder instead (../Makefile). Each target +# has a pre- and a post- target defined where you can add customization code. +# +# This makefile implements macros and targets common to all configurations. +# +# NOCDDL + + +# Building and Cleaning subprojects are done by default, but can be controlled with the SUB +# macro. If SUB=no, subprojects will not be built or cleaned. The following macro +# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf +# and .clean-reqprojects-conf unless SUB has the value 'no' +SUB_no=NO +SUBPROJECTS=${SUB_${SUB}} +BUILD_SUBPROJECTS_=.build-subprojects +BUILD_SUBPROJECTS_NO= +BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}} +CLEAN_SUBPROJECTS_=.clean-subprojects +CLEAN_SUBPROJECTS_NO= +CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}} + + +# Project Name +PROJECTNAME=Lab_2B.X + +# Active Configuration +DEFAULTCONF=default +CONF=${DEFAULTCONF} + +# All Configurations +ALLCONFS=default + + +# build +.build-impl: .build-pre + ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf + + +# clean +.clean-impl: .clean-pre + ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf + +# clobber +.clobber-impl: .clobber-pre .depcheck-impl + ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default clean + + + +# all +.all-impl: .all-pre .depcheck-impl + ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default build + + + +# dependency checking support +.depcheck-impl: +# @echo "# This code depends on make tool being used" >.dep.inc +# @if [ -n "${MAKE_VERSION}" ]; then \ +# echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \ +# echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \ +# echo "include \$${DEPFILES}" >>.dep.inc; \ +# echo "endif" >>.dep.inc; \ +# else \ +# echo ".KEEP_STATE:" >>.dep.inc; \ +# echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \ +# fi diff --git a/Lab_2B.X/nbproject/Makefile-local-default.mk b/Lab_2B.X/nbproject/Makefile-local-default.mk new file mode 100644 index 0000000..214e7fa --- /dev/null +++ b/Lab_2B.X/nbproject/Makefile-local-default.mk @@ -0,0 +1,38 @@ +# +# Generated Makefile - do not edit! +# +# +# This file contains information about the location of compilers and other tools. +# If you commmit this file into your revision control server, you will be able to +# to checkout the project and build it from the command line with make. However, +# if more than one person works on the same project, then this file might show +# conflicts since different users are bound to have compilers in different places. +# In that case you might choose to not commit this file and let MPLAB X recreate this file +# for each user. The disadvantage of not commiting this file is that you must run MPLAB X at +# least once so the file gets created and the project can be built. Finally, you can also +# avoid using this file at all if you are only building from the command line with make. +# You can invoke make with the values of the macros: +# $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... +# +SHELL=cmd.exe +PATH_TO_IDE_BIN=C:/Program Files (x86)/Microchip/MPLABX/v5.30/mplab_platform/platform/../mplab_ide/modules/../../bin/ +# Adding MPLAB X bin directory to path. +PATH:=C:/Program Files (x86)/Microchip/MPLABX/v5.30/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH) +# Path to java used to run MPLAB X when this makefile was created +MP_JAVA_PATH="C:\Program Files (x86)\Microchip\MPLABX\v5.30\sys\java\jre1.8.0_181/bin/" +OS_CURRENT="$(shell uname -s)" +MP_CC="C:\Program Files (x86)\Microchip\xc16\v1.41\bin\xc16-gcc.exe" +# MP_CPPC is not defined +# MP_BC is not defined +MP_AS="C:\Program Files (x86)\Microchip\xc16\v1.41\bin\xc16-as.exe" +MP_LD="C:\Program Files (x86)\Microchip\xc16\v1.41\bin\xc16-ld.exe" +MP_AR="C:\Program Files (x86)\Microchip\xc16\v1.41\bin\xc16-ar.exe" +DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files (x86)/Microchip/MPLABX/v5.30/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" +MP_CC_DIR="C:\Program Files (x86)\Microchip\xc16\v1.41\bin" +# MP_CPPC_DIR is not defined +# MP_BC_DIR is not defined +MP_AS_DIR="C:\Program Files (x86)\Microchip\xc16\v1.41\bin" +MP_LD_DIR="C:\Program Files (x86)\Microchip\xc16\v1.41\bin" +MP_AR_DIR="C:\Program Files (x86)\Microchip\xc16\v1.41\bin" +# MP_BC_DIR is not defined +DFP_DIR="C:/Program Files (x86)/Microchip/MPLABX/v5.30/packs/Microchip/PIC24F-GA-GB_DFP/1.1.74" diff --git a/Lab_2B.X/nbproject/Makefile-variables.mk b/Lab_2B.X/nbproject/Makefile-variables.mk new file mode 100644 index 0000000..739f16b --- /dev/null +++ b/Lab_2B.X/nbproject/Makefile-variables.mk @@ -0,0 +1,13 @@ +# +# Generated - do not edit! +# +# NOCDDL +# +CND_BASEDIR=`pwd` +# default configuration +CND_ARTIFACT_DIR_default=dist/default/production +CND_ARTIFACT_NAME_default=Lab_2B.X.production.hex +CND_ARTIFACT_PATH_default=dist/default/production/Lab_2B.X.production.hex +CND_PACKAGE_DIR_default=${CND_DISTDIR}/default/package +CND_PACKAGE_NAME_default=lab2b.x.tar +CND_PACKAGE_PATH_default=${CND_DISTDIR}/default/package/lab2b.x.tar diff --git a/Lab_2B.X/nbproject/Package-default.bash b/Lab_2B.X/nbproject/Package-default.bash new file mode 100644 index 0000000..c137317 --- /dev/null +++ b/Lab_2B.X/nbproject/Package-default.bash @@ -0,0 +1,73 @@ +#!/bin/bash -x + +# +# Generated - do not edit! +# + +# Macros +TOP=`pwd` +CND_CONF=default +CND_DISTDIR=dist +TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging +TMPDIRNAME=tmp-packaging +OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/Lab_2B.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} +OUTPUT_BASENAME=Lab_2B.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} +PACKAGE_TOP_DIR=lab2b.x/ + +# Functions +function checkReturnCode +{ + rc=$? + if [ $rc != 0 ] + then + exit $rc + fi +} +function makeDirectory +# $1 directory path +# $2 permission (optional) +{ + mkdir -p "$1" + checkReturnCode + if [ "$2" != "" ] + then + chmod $2 "$1" + checkReturnCode + fi +} +function copyFileToTmpDir +# $1 from-file path +# $2 to-file path +# $3 permission +{ + cp "$1" "$2" + checkReturnCode + if [ "$3" != "" ] + then + chmod $3 "$2" + checkReturnCode + fi +} + +# Setup +cd "${TOP}" +mkdir -p ${CND_DISTDIR}/${CND_CONF}/package +rm -rf ${TMPDIR} +mkdir -p ${TMPDIR} + +# Copy files and create directories and links +cd "${TOP}" +makeDirectory ${TMPDIR}/lab2b.x/bin +copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 + + +# Generate tar file +cd "${TOP}" +rm -f ${CND_DISTDIR}/${CND_CONF}/package/lab2b.x.tar +cd ${TMPDIR} +tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/lab2b.x.tar * +checkReturnCode + +# Cleanup +cd "${TOP}" +rm -rf ${TMPDIR} diff --git a/Lab_2B.X/nbproject/configurations.xml b/Lab_2B.X/nbproject/configurations.xml new file mode 100644 index 0000000..cf139a5 --- /dev/null +++ b/Lab_2B.X/nbproject/configurations.xml @@ -0,0 +1,197 @@ + + + + + + + + + lab2b_asm.s + lab2b_header.h + + + Makefile + + + + . + + Makefile + + + + localhost + PIC24FJ64GA002 + + + PK3OBPlatformTool + XC16 + 1.41 + 3 + + + + + + + + + + + + + false + false + + + + + + + false + + false + + false + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Lab_2B.X/nbproject/private/configurations.xml b/Lab_2B.X/nbproject/private/configurations.xml new file mode 100644 index 0000000..dcd118a --- /dev/null +++ b/Lab_2B.X/nbproject/private/configurations.xml @@ -0,0 +1,25 @@ + + + Makefile + 0 + + + :=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>8108:=<rev>0002:=<man>Digilent:=<prod>chipKitProgrammer:=<sn>DA63CA1:=<drv>x:=<xpt>h:=end + C:\Program Files (x86)\Microchip\xc16\v1.41\bin + + place holder 1 + place holder 2 + + + + + true + 0 + 0 + 0 + + + + + + diff --git a/Lab_2B.X/nbproject/project.xml b/Lab_2B.X/nbproject/project.xml new file mode 100644 index 0000000..678f75d --- /dev/null +++ b/Lab_2B.X/nbproject/project.xml @@ -0,0 +1,29 @@ + + + com.microchip.mplab.nbide.embedded.makeproject + + + LAB_2B + ad7fe9ed-f02a-439c-9233-24f02477fa64 + 0 + + + h + + ISO-8859-1 + + + . + + + + default + 2 + + + + false + + + + -- cgit v1.2.3 From 02d5204a1ae23b759888ba55c0458d1471281eae Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Sun, 9 Feb 2020 12:38:01 -0600 Subject: ? --- Lab_2B.X/lab2b_asm.s | 14 +++++++------- Lab_2B.X/lab2b_c.c | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Lab_2B.X/lab2b_asm.s b/Lab_2B.X/lab2b_asm.s index 3c3e19e..675987e 100644 --- a/Lab_2B.X/lab2b_asm.s +++ b/Lab_2B.X/lab2b_asm.s @@ -21,19 +21,19 @@ _wait_1ms: _write_0: ;2 cycles for function call inc LATA ;1 - repeat #3 ;1 for load - nop ;3+1=4 nop + repeat #2 ;1 for load + nop ;2+1=3 nop clr LATA ;1 - repeat #6 ;1 for load - nop ;1+6=7 nop + repeat #7 ;1 for load + nop ;1+7=8 nop return ;3 return _write_1: ;2 cycle call inc LATA ;1 - repeat #10;1 load - nop ;1+10=11 nop + repeat #8 ;1 load + nop ;1+9=10 nop clr LATA ;1 - nop ;1 + nop ;1 return ;3 return \ No newline at end of file diff --git a/Lab_2B.X/lab2b_c.c b/Lab_2B.X/lab2b_c.c index 893c812..4976231 100644 --- a/Lab_2B.X/lab2b_c.c +++ b/Lab_2B.X/lab2b_c.c @@ -25,7 +25,7 @@ void setup(void) { TRISB = 0x0000; wait_100us(); } -void writeColor(int r, int g, int b); +void writeColor(short r, short g, short b); void loop(void); int main(void) { @@ -35,8 +35,8 @@ int main(void) { return 0; } -void writeColor(int r, int g, int b) { - int i = 0; +void writeColor(short r, short g, short b) { + short i = 0; LATA = 0x0000; wait_100us(); //RED @@ -46,7 +46,7 @@ void writeColor(int r, int g, int b) { } else { write_0(); } - r >> 1; + r >>= 1; ++i; } //GREEN @@ -56,7 +56,7 @@ void writeColor(int r, int g, int b) { } else { write_0(); } - g >> 1; + g >>= 1; --i; } //BLUE @@ -66,7 +66,7 @@ void writeColor(int r, int g, int b) { } else { write_0(); } - b >> 1; + b >>= 1; ++i; } } @@ -108,7 +108,7 @@ void loop(void) { // write_0(); // write_0(); // write_0(); - +// writeColor(255, 155, 0); } } -- cgit v1.2.3 From 8a843dfe4de06538b41793a54b8d42d1b1cf4317 Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Sun, 9 Feb 2020 12:48:47 -0600 Subject: ? --- Lab_2B.X/dist/default/debug/memoryfile.xml | 18 ++++++++++++++++++ Lab_2B.X/nbproject/private/private.xml | 7 +++++++ 2 files changed, 25 insertions(+) create mode 100644 Lab_2B.X/dist/default/debug/memoryfile.xml create mode 100644 Lab_2B.X/nbproject/private/private.xml diff --git a/Lab_2B.X/dist/default/debug/memoryfile.xml b/Lab_2B.X/dist/default/debug/memoryfile.xml new file mode 100644 index 0000000..d566b37 --- /dev/null +++ b/Lab_2B.X/dist/default/debug/memoryfile.xml @@ -0,0 +1,18 @@ + + + + + + bytes + 8192 + 0 + 8192 + + + bytes + 65274 + 618 + 64656 + + + diff --git a/Lab_2B.X/nbproject/private/private.xml b/Lab_2B.X/nbproject/private/private.xml new file mode 100644 index 0000000..6807a2b --- /dev/null +++ b/Lab_2B.X/nbproject/private/private.xml @@ -0,0 +1,7 @@ + + + + + + + -- cgit v1.2.3 From f40feb65a7098dc2851463c0612f899885cb2f49 Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Sun, 9 Feb 2020 12:51:58 -0600 Subject: Fix some dumb stuff --- Lab_2B.X/lab2b_c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lab_2B.X/lab2b_c.c b/Lab_2B.X/lab2b_c.c index d2dd8e4..4c63087 100644 --- a/Lab_2B.X/lab2b_c.c +++ b/Lab_2B.X/lab2b_c.c @@ -109,6 +109,6 @@ void loop(void) { // write_0(); // write_0(); // write_0(); - writeColor(255, 155, 0); + writeColor(255, 155, 000); } } -- cgit v1.2.3 From 3371ce7e13681190e4446836c908e53fd993d959 Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Sun, 9 Feb 2020 12:52:07 -0600 Subject: Fix some dumb stuff --- Lab_2B.X/lab2b_asm.s | 77 ++++++++++++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/Lab_2B.X/lab2b_asm.s b/Lab_2B.X/lab2b_asm.s index 675987e..ddee29b 100644 --- a/Lab_2B.X/lab2b_asm.s +++ b/Lab_2B.X/lab2b_asm.s @@ -1,39 +1,40 @@ -.include "xc.inc" - -.text ;BP (put the following data in ROM(program memory)) - -; This is a library, thus it can *not* contain a _main function: the C file will -; define main(). However, we -; we will need a .global statement to make available ASM functions to C code. -; All functions utilized outside of this file will need to have a leading -; underscore (_) and be included in a comment delimited list below. -.global _write_0, _write_1, _wait_100us, _wait_1ms - -_wait_100us: - repeat #1593 - nop - return - -_wait_1ms: - repeat #15993 - nop - return - -_write_0: ;2 cycles for function call - inc LATA ;1 - repeat #2 ;1 for load - nop ;2+1=3 nop - clr LATA ;1 - repeat #7 ;1 for load - nop ;1+7=8 nop - return ;3 return - - -_write_1: ;2 cycle call - inc LATA ;1 - repeat #8 ;1 load - nop ;1+9=10 nop - clr LATA ;1 - nop ;1 - return ;3 return +.include "xc.inc" + +.text ;BP (put the following data in ROM(program memory)) + +; This is a library, thus it can *not* contain a _main function: the C file will +; define main(). However, we +; we will need a .global statement to make available ASM functions to C code. +; All functions utilized outside of this file will need to have a leading +; underscore (_) and be included in a comment delimited list below. +.global _write_0, _write_1, _wait_100us, _wait_1ms + +_wait_100us: + repeat #1593 + nop + return + +_wait_1ms: + repeat #15993 + nop + return + +_write_0: ;2 cycles for function call + inc LATA ;1 + repeat #2 ;1 for load + nop ;2+1=3 nop + clr LATA ;1 + repeat #6 ;1 for load + nop ;1+6=7 nop + return ;3 return + + +_write_1: ;2 cycle call + inc LATA ;1 + repeat #8 ;1 load + nop ;1+9=10 nop + clr LATA ;1 + nop ;1 + nop ;1 + return ;3 return \ No newline at end of file -- cgit v1.2.3 From 9c15ec86ca3366929eddc7dac9aa83a3a4b05780 Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Wed, 12 Feb 2020 10:33:16 -0600 Subject: Do lab 2b --- Lab_2B.X/lab2b_c.c | 141 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 101 insertions(+), 40 deletions(-) diff --git a/Lab_2B.X/lab2b_c.c b/Lab_2B.X/lab2b_c.c index 4c63087..ae32849 100644 --- a/Lab_2B.X/lab2b_c.c +++ b/Lab_2B.X/lab2b_c.c @@ -1,5 +1,6 @@ #include "xc.h" #include "lab2b_header.h" +#include "stdint.h" // CW1: FLASH CONFIGURATION WORD 1 (see PIC24 Family Reference Manual 24.1) #pragma config ICS = PGx1 // Comm Channel Select (Emulator EMUC1/EMUD1 pins are shared with PGC1/PGD1) #pragma config FWDTEN = OFF // Watchdog Timer Enable (Watchdog Timer is disabled) @@ -15,8 +16,18 @@ #pragma config FCKSM = CSECME // Clock Switching and Monitor (Clock switching is enabled, // Fail-Safe Clock Monitor is enabled) #pragma config FNOSC = FRCPLL // Oscillator Select (Fast RC Oscillator with PLL module (FRCPLL)) -#define PERIOD 5 +#define PERIOD 120 +//DEFINTIONS +void writeColor(int r, int g, int b); +void loop(void); +void delay(int delay_in_ms); +uint32_t packColor(unsigned char Red, unsigned char Grn, unsigned char Blu); +unsigned char getR(uint32_t RGBval); +unsigned char getG(uint32_t RGBval); +unsigned char getB(uint32_t RGBval); +void writePacCol(uint32_t PackedColor); +uint32_t Wheel(unsigned char WheelPos); void setup(void) { CLKDIVbits.RCDIV = 0; //Set RCDIV=1:1 (default 2:1) 32MHz or FCY/2=16M @@ -25,8 +36,6 @@ void setup(void) { TRISB = 0x0000; wait_100us(); } -void writeColor(short r, short g, short b); -void loop(void); int main(void) { setup(); @@ -35,43 +44,6 @@ int main(void) { return 0; } -void writeColor(short r, short g, short b) { - short i = 0; - LATA = 0x0000; - wait_100us(); - //RED - while (i < 8) { - if (r & 1) { - write_1(); - } else { - write_0(); - } - - r >>= 1; - ++i; - } - //GREEN - while (i > 0) { - if (g & 1) { - write_1(); - } else { - write_0(); - } - g >>= 1; - --i; - } - //BLUE - while (i < 8){ - if (b & 1) { - write_1(); - } else { - write_0(); - } - b >>= 1; - ++i; - } -} - void loop(void) { while (1) { // LATA = 0x0000; @@ -109,6 +81,95 @@ void loop(void) { // write_0(); // write_0(); // write_0(); +/* writeColor(255, 155, 000); +*/ + int byteFrameNumber = 0; + while (byteFrameNumber <= 255) { +// // COLOR GRADIENT +// writeColor(byteFrameNumber, 0 , 255 - byteFrameNumber); + //COLOR WHEEL + writePacCol(Wheel(byteFrameNumber)); + delay(PERIOD); + byteFrameNumber++; + } } } + +void writeColor(int r, int g, int b) { + short i = 0; + LATA = 0x0000; + wait_100us(); + //RED + while (i < 8) { + if (r & 1) { + write_1(); + } else { + write_0(); + } + + r >>= 1; + ++i; + } + //GREEN + while (i > 0) { + if (g & 1) { + write_1(); + } else { + write_0(); + } + g >>= 1; + --i; + } + //BLUE + while (i < 8){ + if (b & 1) { + write_1(); + } else { + write_0(); + } + b >>= 1; + ++i; + } +} + +void delay(int delay_in_ms) { + int i = 0; + while (i < delay_in_ms) { + wait_1ms(); + i++; + } +} + +uint32_t packColor(unsigned char Red, unsigned char Grn, unsigned char Blu) { + return ((long) Red << 16) | ((long) Grn << 8) | ((long) Blu); +} + +unsigned char getR(uint32_t RGBval) { + return (unsigned char) (RGBval >> 16); +} +unsigned char getG(uint32_t RGBval) { + return (unsigned char) (RGBval >> 8 ); +} +unsigned char getB(uint32_t RGBval) { + return (unsigned char) (RGBval >> 0 ); +} + +void writePacCol(uint32_t PackedColor) { + writeColor(getR(PackedColor), getG(PackedColor), getB(PackedColor)); +} + +uint32_t Wheel(unsigned char WheelPos) { +// Input a value 0 to 255 to get a color value. +// The colours are a transition r - g - b - back to r. + WheelPos = 255 - WheelPos; + if(WheelPos < 85) { + return packColor(255 - WheelPos * 3, 0, WheelPos * 3); + } + if(WheelPos < 170) { + WheelPos -= 85; + return packColor(0, WheelPos * 3, 255 - WheelPos * 3); + } + WheelPos -= 170; + return packColor(WheelPos * 3, 255 - WheelPos * 3, 0); +} \ No newline at end of file -- cgit v1.2.3