Skip to content

Commit

Permalink
verified bitwise logic
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhinavA10 committed Jan 8, 2018
1 parent 70f2478 commit 4003abe
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 42 deletions.
7 changes: 2 additions & 5 deletions PS2RCCar.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@

/*TODOLIST:
* comments
* converting clock freq. to timespent
* is it better to do bitwise ops/shifts everytime, or just pre-program, and then anding it? (mask etc (gamdev url). or current setup)
* verify bitwise logic of is pressed function
* verify command sequencing with CuriousInventor page
*/

Expand Down Expand Up @@ -109,15 +106,15 @@ unsigned char SendCMD_ReceiveDATA(unsigned char cmd) {
} else {
CMDLINE = 0; //send a 0 by setting CMDLine Low
}
__delay_us(2);
__delay_us(1);

cmd = cmd >> 1; //shift command byte over, for the next bit when looped

CLOCKLINE = 1;
if (DATALINE == 1) {
dat = (dat | 0b10000000); // add a value of 1 to the MSb of "data"
}
__delay_us(2);
__delay_us(1);
if (i != 1) dat = dat >> 1; // shift the contents over for the next bit if it's not the last bit
}
__delay_us(16);
Expand Down
Binary file added docs/MyNotes/Thumbs.db
Binary file not shown.
Binary file added docs/Sources/Thumbs.db
Binary file not shown.
22 changes: 14 additions & 8 deletions nbproject/Makefile-default.mk
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ ifeq ($(TYPE_IMAGE), DEBUG_RUN)
IMAGE_TYPE=debug
OUTPUT_SUFFIX=elf
DEBUGGABLE_SUFFIX=elf
FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
else
IMAGE_TYPE=production
OUTPUT_SUFFIX=hex
DEBUGGABLE_SUFFIX=elf
FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
endif

ifeq ($(COMPARE_BUILD), true)
Expand All @@ -44,6 +44,12 @@ else
COMPARISON_BUILD=
endif

ifdef SUB_IMAGE_ADDRESS

else
SUB_IMAGE_ADDRESS_COMMAND=
endif

# Object Directory
OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE}

Expand Down Expand Up @@ -81,7 +87,7 @@ FIXDEPS=fixDeps
ifneq ($(INFORMATION_MESSAGE), )
@echo $(INFORMATION_MESSAGE)
endif
${MAKE} -f nbproject/Makefile-default.mk dist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
${MAKE} -f nbproject/Makefile-default.mk dist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.${IMAGE_TYPE}.${OUTPUT_SUFFIX}

MP_PROCESSOR_OPTION=16F1459
# ------------------------------------------------------------------------------------
Expand Down Expand Up @@ -147,15 +153,15 @@ endif
# ------------------------------------------------------------------------------------
# Rules for buildStep: link
ifeq ($(TYPE_IMAGE), DEBUG_RUN)
dist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk
dist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE}
${MP_CC} $(MP_EXTRA_LD_PRE) --chip=$(MP_PROCESSOR_OPTION) -G -mdist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.X.${IMAGE_TYPE}.map -D__DEBUG=1 --debugger=none --double=24 --float=24 --rom=default,-0-C03 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --codeoffset=0xC04 --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" $(COMPARISON_BUILD) --memorysummary dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml -odist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.X.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED}
@${RM} dist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.X.${IMAGE_TYPE}.hex
${MP_CC} $(MP_EXTRA_LD_PRE) --chip=$(MP_PROCESSOR_OPTION) -G -mdist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.${IMAGE_TYPE}.map -D__DEBUG=1 --debugger=none --double=24 --float=24 --rom=default,-0-C03 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --codeoffset=0xC04 --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" $(COMPARISON_BUILD) --memorysummary dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml -odist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED}
@${RM} dist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.${IMAGE_TYPE}.hex

else
dist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk
dist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE}
${MP_CC} $(MP_EXTRA_LD_PRE) --chip=$(MP_PROCESSOR_OPTION) -G -mdist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.X.${IMAGE_TYPE}.map --double=24 --float=24 --rom=default,-0-C03 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --codeoffset=0xC04 --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" $(COMPARISON_BUILD) --memorysummary dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml -odist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.X.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED}
${MP_CC} $(MP_EXTRA_LD_PRE) --chip=$(MP_PROCESSOR_OPTION) -G -mdist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.${IMAGE_TYPE}.map --double=24 --float=24 --rom=default,-0-C03 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_default=$(CND_CONF) --summary=default,-psect,-class,+mem,-hex,-file --codeoffset=0xC04 --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" $(COMPARISON_BUILD) --memorysummary dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml -odist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED}

endif

Expand Down
12 changes: 6 additions & 6 deletions nbproject/Makefile-genesis.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#
#Mon Jan 08 00:34:53 EST 2018
default.languagetoolchain.dir=C\:\\Program Files (x86)\\Microchip\\xc8\\v1.41\\bin
configurations-xml=2dd523457780ae3e3a3c655b38c012d2
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=c5846fdec3197dd1203fbded137f6478
default.languagetoolchain.version=1.41
#Mon Jan 08 10:06:48 EST 2018
default.languagetoolchain.dir=C\:\\Program Files\\Microchip\\xc8\\v1.44\\bin
configurations-xml=7b101dae8c394b246a7d457a45ed114d
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=5d30ff5128b14865c8a3796a8f0bb8a0
default.languagetoolchain.version=1.44
host.platform=windows
conf.ids=default
default.com-microchip-mplab-nbide-toolchainXC8-XC8LanguageToolchain.md5=9c7431fa79cc2e2c2facfdb6b375cb88
default.com-microchip-mplab-nbide-toolchainXC8-XC8LanguageToolchain.md5=1ecde863556371fa9144cadd16f678d4
2 changes: 1 addition & 1 deletion nbproject/Makefile-impl.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}


# Project Name
PROJECTNAME=PS2-RC-Car.X
PROJECTNAME=PS2-RC-Car

# Active Configuration
DEFAULTCONF=default
Expand Down
20 changes: 10 additions & 10 deletions nbproject/Makefile-local-default.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@
# $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ...
#
SHELL=cmd.exe
PATH_TO_IDE_BIN=C:/Program Files (x86)/Microchip/MPLABX/v3.55/mplab_ide/platform/../mplab_ide/modules/../../bin/
PATH_TO_IDE_BIN=C:/Program Files/Microchip/MPLABX/v4.05/mplab_ide/platform/../mplab_ide/modules/../../bin/
# Adding MPLAB X bin directory to path.
PATH:=C:/Program Files (x86)/Microchip/MPLABX/v3.55/mplab_ide/platform/../mplab_ide/modules/../../bin/:$(PATH)
PATH:=C:/Program Files/Microchip/MPLABX/v4.05/mplab_ide/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\v3.55\sys\java\jre1.8.0_91/bin/"
MP_JAVA_PATH="C:\Program Files\Microchip\MPLABX\v4.05\sys\java\jre1.8.0_144/bin/"
OS_CURRENT="$(shell uname -s)"
MP_CC="C:\Program Files (x86)\Microchip\xc8\v1.41\bin\xc8.exe"
MP_CC="C:\Program Files\Microchip\xc8\v1.44\bin\xc8.exe"
# MP_CPPC is not defined
# MP_BC is not defined
MP_AS="C:\Program Files (x86)\Microchip\xc8\v1.41\bin\xc8.exe"
MP_LD="C:\Program Files (x86)\Microchip\xc8\v1.41\bin\xc8.exe"
MP_AS="C:\Program Files\Microchip\xc8\v1.44\bin\xc8.exe"
MP_LD="C:\Program Files\Microchip\xc8\v1.44\bin\xc8.exe"
# MP_AR is not defined
DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files (x86)/Microchip/MPLABX/v3.55/mplab_ide/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar"
MP_CC_DIR="C:\Program Files (x86)\Microchip\xc8\v1.41\bin"
DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files/Microchip/MPLABX/v4.05/mplab_ide/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar"
MP_CC_DIR="C:\Program Files\Microchip\xc8\v1.44\bin"
# MP_CPPC_DIR is not defined
# MP_BC_DIR is not defined
MP_AS_DIR="C:\Program Files (x86)\Microchip\xc8\v1.41\bin"
MP_LD_DIR="C:\Program Files (x86)\Microchip\xc8\v1.41\bin"
MP_AS_DIR="C:\Program Files\Microchip\xc8\v1.44\bin"
MP_LD_DIR="C:\Program Files\Microchip\xc8\v1.44\bin"
# MP_AR_DIR is not defined
# MP_BC_DIR is not defined
8 changes: 4 additions & 4 deletions nbproject/Makefile-variables.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
CND_BASEDIR=`pwd`
# default configuration
CND_ARTIFACT_DIR_default=dist/default/production
CND_ARTIFACT_NAME_default=PS2-RC-Car.X.production.hex
CND_ARTIFACT_PATH_default=dist/default/production/PS2-RC-Car.X.production.hex
CND_ARTIFACT_NAME_default=PS2-RC-Car.production.hex
CND_ARTIFACT_PATH_default=dist/default/production/PS2-RC-Car.production.hex
CND_PACKAGE_DIR_default=${CND_DISTDIR}/default/package
CND_PACKAGE_NAME_default=ps2-rc-car.x.tar
CND_PACKAGE_PATH_default=${CND_DISTDIR}/default/package/ps2-rc-car.x.tar
CND_PACKAGE_NAME_default=ps2-rc-car.tar
CND_PACKAGE_PATH_default=${CND_DISTDIR}/default/package/ps2-rc-car.tar
12 changes: 6 additions & 6 deletions nbproject/Package-default.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ CND_CONF=default
CND_DISTDIR=dist
TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging
TMPDIRNAME=tmp-packaging
OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
OUTPUT_BASENAME=PS2-RC-Car.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
PACKAGE_TOP_DIR=ps2-rc-car.x/
OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/PS2-RC-Car.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
OUTPUT_BASENAME=PS2-RC-Car.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
PACKAGE_TOP_DIR=ps2-rc-car/

# Functions
function checkReturnCode
Expand Down Expand Up @@ -57,15 +57,15 @@ mkdir -p ${TMPDIR}

# Copy files and create directories and links
cd "${TOP}"
makeDirectory ${TMPDIR}/ps2-rc-car.x/bin
makeDirectory ${TMPDIR}/ps2-rc-car/bin
copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755


# Generate tar file
cd "${TOP}"
rm -f ${CND_DISTDIR}/${CND_CONF}/package/ps2-rc-car.x.tar
rm -f ${CND_DISTDIR}/${CND_CONF}/package/ps2-rc-car.tar
cd ${TMPDIR}
tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/ps2-rc-car.x.tar *
tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/ps2-rc-car.tar *
checkReturnCode

# Cleanup
Expand Down
2 changes: 1 addition & 1 deletion nbproject/configurations.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<targetPluginBoard></targetPluginBoard>
<platformTool>Simulator</platformTool>
<languageToolchain>XC8</languageToolchain>
<languageToolchainVersion>1.41</languageToolchainVersion>
<languageToolchainVersion>1.44</languageToolchainVersion>
<platform>3</platform>
</toolsSet>
<compileType>
Expand Down
2 changes: 1 addition & 1 deletion nbproject/private/configurations.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<confs>
<conf name="default" type="2">
<platformToolSN></platformToolSN>
<languageToolchainDir>C:\Program Files (x86)\Microchip\xc8\v1.41\bin</languageToolchainDir>
<languageToolchainDir>C:\Program Files\Microchip\xc8\v1.44\bin</languageToolchainDir>
<mdbdebugger version="1">
<placeholder1>place holder 1</placeholder1>
<placeholder2>place holder 2</placeholder2>
Expand Down

0 comments on commit 4003abe

Please sign in to comment.