diff --git a/Attiny_Solar_Energy_Harvest/code/mplab/tests2.X/nbproject/private/private.xml b/Attiny_Solar_Energy_Harvest/code/mplab/tests2.X/nbproject/private/private.xml
new file mode 100644
index 0000000..7e63a9b
--- /dev/null
+++ b/Attiny_Solar_Energy_Harvest/code/mplab/tests2.X/nbproject/private/private.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+ file:/home/dev/delete/Electronics_Projects_2020/Attiny_Solar_Energy_Harvest/code/mplab/tests2.X/main.c
+
+
+
diff --git a/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/Makefile b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/Makefile
new file mode 100644
index 0000000..fca8e2c
--- /dev/null
+++ b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.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/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/build/default/production/main.o b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/build/default/production/main.o
new file mode 100644
index 0000000..ac245ea
Binary files /dev/null and b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/build/default/production/main.o differ
diff --git a/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/build/default/production/main.o.d b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/build/default/production/main.o.d
new file mode 100644
index 0000000..37bbc46
--- /dev/null
+++ b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/build/default/production/main.o.d
@@ -0,0 +1,64 @@
+build/default/production/main.o.d build/default/production/main.o: main.c \
+ /opt/microchip/xc8/v2.10/avr/lib/gcc/avr/5.4.0/include/xc.h \
+ /opt/microchip/xc8/v2.10/avr/lib/gcc/avr/5.4.0/include/cci.h \
+ /opt/microchip/xc8/v2.10/avr/avr/include/avr/io.h \
+ /opt/microchip/xc8/v2.10/avr/avr/include/avr/sfr_defs.h \
+ /opt/microchip/xc8/v2.10/avr/avr/include/inttypes.h \
+ /opt/microchip/xc8/v2.10/avr/lib/gcc/avr/5.4.0/include/stdint.h \
+ /opt/microchip/xc8/v2.10/avr/avr/include/stdint.h \
+ /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/include/avr/iotn10.h \
+ /opt/microchip/xc8/v2.10/avr/avr/include/avr/portpins.h \
+ /opt/microchip/xc8/v2.10/avr/avr/include/avr/common.h \
+ /opt/microchip/xc8/v2.10/avr/avr/include/avr/version.h \
+ /opt/microchip/xc8/v2.10/avr/avr/include/avr/xmega.h \
+ /opt/microchip/xc8/v2.10/avr/avr/include/avr/fuse.h \
+ /opt/microchip/xc8/v2.10/avr/avr/include/avr/lock.h \
+ /opt/microchip/xc8/v2.10/avr/avr/include/util/delay.h \
+ /opt/microchip/xc8/v2.10/avr/avr/include/util/delay_basic.h \
+ /opt/microchip/xc8/v2.10/avr/avr/include/math.h \
+ /opt/microchip/xc8/v2.10/avr/avr/include/avr/interrupt.h \
+ /opt/microchip/xc8/v2.10/avr/avr/include/avr/sleep.h \
+ /opt/microchip/xc8/v2.10/avr/avr/include/util/atomic.h \
+ /opt/microchip/xc8/v2.10/avr/avr/include/avr/wdt.h
+
+/opt/microchip/xc8/v2.10/avr/lib/gcc/avr/5.4.0/include/xc.h:
+
+/opt/microchip/xc8/v2.10/avr/lib/gcc/avr/5.4.0/include/cci.h:
+
+/opt/microchip/xc8/v2.10/avr/avr/include/avr/io.h:
+
+/opt/microchip/xc8/v2.10/avr/avr/include/avr/sfr_defs.h:
+
+/opt/microchip/xc8/v2.10/avr/avr/include/inttypes.h:
+
+/opt/microchip/xc8/v2.10/avr/lib/gcc/avr/5.4.0/include/stdint.h:
+
+/opt/microchip/xc8/v2.10/avr/avr/include/stdint.h:
+
+/home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/include/avr/iotn10.h:
+
+/opt/microchip/xc8/v2.10/avr/avr/include/avr/portpins.h:
+
+/opt/microchip/xc8/v2.10/avr/avr/include/avr/common.h:
+
+/opt/microchip/xc8/v2.10/avr/avr/include/avr/version.h:
+
+/opt/microchip/xc8/v2.10/avr/avr/include/avr/xmega.h:
+
+/opt/microchip/xc8/v2.10/avr/avr/include/avr/fuse.h:
+
+/opt/microchip/xc8/v2.10/avr/avr/include/avr/lock.h:
+
+/opt/microchip/xc8/v2.10/avr/avr/include/util/delay.h:
+
+/opt/microchip/xc8/v2.10/avr/avr/include/util/delay_basic.h:
+
+/opt/microchip/xc8/v2.10/avr/avr/include/math.h:
+
+/opt/microchip/xc8/v2.10/avr/avr/include/avr/interrupt.h:
+
+/opt/microchip/xc8/v2.10/avr/avr/include/avr/sleep.h:
+
+/opt/microchip/xc8/v2.10/avr/avr/include/util/atomic.h:
+
+/opt/microchip/xc8/v2.10/avr/avr/include/avr/wdt.h:
diff --git a/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/dist/default/production/memoryfile.xml b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/dist/default/production/memoryfile.xml
new file mode 100644
index 0000000..3cb6af6
--- /dev/null
+++ b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/dist/default/production/memoryfile.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ bytes
+ 1024
+ 156
+ 868
+
+
+ bytes
+ 32
+ 0
+ 32
+
+
+
diff --git a/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/dist/default/production/tests2.X.production.elf b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/dist/default/production/tests2.X.production.elf
new file mode 100755
index 0000000..dbaace3
Binary files /dev/null and b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/dist/default/production/tests2.X.production.elf differ
diff --git a/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/dist/default/production/tests2.X.production.hex b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/dist/default/production/tests2.X.production.hex
new file mode 100644
index 0000000..0b448d0
--- /dev/null
+++ b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/dist/default/production/tests2.X.production.hex
@@ -0,0 +1,6 @@
+:100000000AC01BC01AC019C018C017C016C015C03E
+:1000100014C013C012C011271FBFCFE5D0E0DEBF50
+:0A002000CDBF03D000C0F894FFCF5D
+:10002A0048ED4CBF41E047BF44E041B940B9FECF7B
+:02003A00E2CF13
+:00000001FF
diff --git a/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/dist/default/production/tests2.X.production.map b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/dist/default/production/tests2.X.production.map
new file mode 100644
index 0000000..891b53d
--- /dev/null
+++ b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/dist/default/production/tests2.X.production.map
@@ -0,0 +1,395 @@
+Archive member included to satisfy reference by file (symbol)
+
+/opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o (exit)
+
+Discarded input sections
+
+ .data 0x00000000 0x0 /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ .bss 0x00000000 0x0 /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ .text 0x00000000 0x0 build/default/production/main.o
+ .data 0x00000000 0x0 build/default/production/main.o
+ .bss 0x00000000 0x0 build/default/production/main.o
+ .text 0x00000000 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ .data 0x00000000 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ .bss 0x00000000 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ .text.libgcc.mul
+ 0x00000000 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ .text.libgcc.div
+ 0x00000000 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ .text.libgcc.prologue
+ 0x00000000 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ .text.libgcc 0x00000000 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ .text.libgcc.builtins
+ 0x00000000 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ .text.libgcc.fmul
+ 0x00000000 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ .text.libgcc.fixed
+ 0x00000000 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+
+Memory Configuration
+
+Name Origin Length Attributes
+text 0x00000000 0x00000400 xr
+data 0x00800040 0x00000020 rw !x
+config 0x00820000 0x00000001 rw !x
+lock 0x00830000 0x00000002 rw !x
+signature 0x00840000 0x00000004 rw !x
+*default* 0x00000000 0xffffffff
+
+Linker script and memory map
+
+ 0x00004000 __RODATA_PM_OFFSET__ = 0x4000
+LOAD /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ 0x00000001 __MPLAB_BUILD = 0x1
+LOAD build/default/production/main.o
+START GROUP
+LOAD /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrtiny/libm.a
+END GROUP
+START GROUP
+LOAD /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a
+LOAD /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrtiny/libm.a
+LOAD /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrtiny/libc.a
+LOAD /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/libattiny10.a
+END GROUP
+ 0x00000000 __TEXT_REGION_ORIGIN__ = DEFINED (__TEXT_REGION_ORIGIN__)?__TEXT_REGION_ORIGIN__:0x0
+ [0x00800040] __DATA_REGION_ORIGIN__ = DEFINED (__DATA_REGION_ORIGIN__)?__DATA_REGION_ORIGIN__:0x800040
+ [0x00000400] __TEXT_REGION_LENGTH__ = DEFINED (__TEXT_REGION_LENGTH__)?__TEXT_REGION_LENGTH__:0x1000
+ [0x00000020] __DATA_REGION_LENGTH__ = DEFINED (__DATA_REGION_LENGTH__)?__DATA_REGION_LENGTH__:0x100
+ [0x00000001] __FUSE_REGION_LENGTH__ = DEFINED (__FUSE_REGION_LENGTH__)?__FUSE_REGION_LENGTH__:0x2
+ 0x00000002 __LOCK_REGION_LENGTH__ = DEFINED (__LOCK_REGION_LENGTH__)?__LOCK_REGION_LENGTH__:0x2
+ 0x00000004 __SIGNATURE_REGION_LENGTH__ = DEFINED (__SIGNATURE_REGION_LENGTH__)?__SIGNATURE_REGION_LENGTH__:0x4
+ 0x00004000 __RODATA_PM_OFFSET__ = DEFINED (__RODATA_PM_OFFSET__)?__RODATA_PM_OFFSET__:0x4000
+
+.hash
+ *(.hash)
+
+.dynsym
+ *(.dynsym)
+
+.dynstr
+ *(.dynstr)
+
+.gnu.version
+ *(.gnu.version)
+
+.gnu.version_d
+ *(.gnu.version_d)
+
+.gnu.version_r
+ *(.gnu.version_r)
+
+.rel.init
+ *(.rel.init)
+
+.rela.init
+ *(.rela.init)
+
+.rel.text
+ *(.rel.text)
+ *(.rel.text.*)
+ *(.rel.gnu.linkonce.t*)
+
+.rela.text
+ *(.rela.text)
+ *(.rela.text.*)
+ *(.rela.gnu.linkonce.t*)
+
+.rel.fini
+ *(.rel.fini)
+
+.rela.fini
+ *(.rela.fini)
+
+.rel.rodata
+ *(.rel.rodata)
+ *(.rel.rodata.*)
+ *(.rel.gnu.linkonce.r*)
+
+.rela.rodata
+ *(.rela.rodata)
+ *(.rela.rodata.*)
+ *(.rela.gnu.linkonce.r*)
+
+.rel.data
+ *(.rel.data)
+ *(.rel.data.*)
+ *(.rel.gnu.linkonce.d*)
+
+.rela.data
+ *(.rela.data)
+ *(.rela.data.*)
+ *(.rela.gnu.linkonce.d*)
+
+.rel.ctors
+ *(.rel.ctors)
+
+.rela.ctors
+ *(.rela.ctors)
+
+.rel.dtors
+ *(.rel.dtors)
+
+.rela.dtors
+ *(.rela.dtors)
+
+.rel.got
+ *(.rel.got)
+
+.rela.got
+ *(.rela.got)
+
+.rel.bss
+ *(.rel.bss)
+
+.rela.bss
+ *(.rela.bss)
+
+.rel.plt
+ *(.rel.plt)
+
+.rela.plt
+ *(.rela.plt)
+
+.text 0x00000000 0x2a
+ *(.vectors)
+ .vectors 0x00000000 0x16 /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ 0x00000000 __vectors
+ 0x00000000 __vector_default
+ *(.vectors)
+ *(.progmem.gcc*)
+ *(.dinit)
+ .dinit 0x00000016 0x0 data_init
+ 0x00000016 . = ALIGN (0x2)
+ 0x00000016 __trampolines_start = .
+ *(.trampolines)
+ .trampolines 0x00000016 0x0 linker stubs
+ *(.trampolines*)
+ 0x00000016 __trampolines_end = .
+ *libprintf_flt.a:*(.progmem.data)
+ *libc.a:*(.progmem.data)
+ 0x00000016 . = ALIGN (0x2)
+ *(.jumptables)
+ *(.jumptables*)
+ *(.lowtext)
+ *(.lowtext*)
+ 0x00000016 __ctors_start = .
+ *(.ctors)
+ 0x00000016 __ctors_end = .
+ 0x00000016 __dtors_start = .
+ *(.dtors)
+ 0x00000016 __dtors_end = .
+ SORT(*)(.ctors)
+ SORT(*)(.dtors)
+ *(.init0)
+ .init0 0x00000016 0x0 /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ 0x00000016 __init
+ *(.init0)
+ *(.init1)
+ *(.init1)
+ *(.init2)
+ .init2 0x00000016 0xc /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ *(.init2)
+ *(.init3)
+ *(.init3)
+ *(.init4)
+ *(.init4)
+ *(.init5)
+ *(.init5)
+ *(.init6)
+ *(.init6)
+ *(.init7)
+ *(.init7)
+ *(.init8)
+ *(.init8)
+ *(.init9)
+ .init9 0x00000022 0x4 /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ *(.init9)
+ 0x00000026 . = ALIGN (0x2)
+ *(.fini9)
+ .fini9 0x00000026 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ 0x00000026 exit
+ 0x00000026 _exit
+ *(.fini9)
+ *(.fini8)
+ *(.fini8)
+ *(.fini7)
+ *(.fini7)
+ *(.fini6)
+ *(.fini6)
+ *(.fini5)
+ *(.fini5)
+ *(.fini4)
+ *(.fini4)
+ *(.fini3)
+ *(.fini3)
+ *(.fini2)
+ *(.fini2)
+ *(.fini1)
+ *(.fini1)
+ *(.fini0)
+ .fini0 0x00000026 0x4 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ *(.fini0)
+ 0x0000002a _etext = .
+
+.rodata
+ *(.rodata)
+ *(.rodata*)
+ *(.gnu.linkonce.r*)
+
+.data 0x00800040 0x0 load address 0x0000002a
+ [!provide] PROVIDE (__data_start, .)
+ *(.gnu.linkonce.d*)
+ 0x00800040 . = ALIGN (0x2)
+ 0x00800040 _edata = .
+ [!provide] PROVIDE (__data_end, .)
+
+.bss 0x00800040 0x0
+ [!provide] PROVIDE (__bss_start, .)
+ *(COMMON)
+ [!provide] PROVIDE (__bss_end, .)
+ 0x0000002a __data_load_start = LOADADDR (.data)
+ 0x0000002a __data_load_end = (__data_load_start + SIZEOF (.data))
+
+.noinit 0x00800040 0x0
+ [!provide] PROVIDE (__noinit_start, .)
+ *(.noinit*)
+ [!provide] PROVIDE (__noinit_end, .)
+ 0x00800040 _end = .
+
+.lock
+ *(.lock*)
+
+.signature
+ *(.signature*)
+
+.config
+ *(.fuse)
+ *(.lfuse)
+ *(.hfuse)
+ *(.efuse)
+ *(.config*)
+
+.stab
+ *(.stab)
+
+.stabstr
+ *(.stabstr)
+
+.stab.excl
+ *(.stab.excl)
+
+.stab.exclstr
+ *(.stab.exclstr)
+
+.stab.index
+ *(.stab.index)
+
+.stab.indexstr
+ *(.stab.indexstr)
+
+.comment 0x00000000 0x2f
+ *(.comment)
+ .comment 0x00000000 0x2f build/default/production/main.o
+ 0x30 (size before relaxing)
+
+.note.gnu.build-id
+ *(.note.gnu.build-id)
+
+.debug
+ *(.debug)
+
+.line
+ *(.line)
+
+.debug_srcinfo
+ *(.debug_srcinfo)
+
+.debug_sfnames
+ *(.debug_sfnames)
+
+.debug_aranges 0x00000000 0x20
+ *(.debug_aranges)
+ .debug_aranges
+ 0x00000000 0x20 build/default/production/main.o
+
+.debug_pubnames
+ *(.debug_pubnames)
+
+.debug_info 0x00000000 0x530
+ *(.debug_info .gnu.linkonce.wi.*)
+ .debug_info 0x00000000 0x305 /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ .debug_info 0x00000305 0x22b build/default/production/main.o
+
+.debug_abbrev 0x00000000 0x324
+ *(.debug_abbrev)
+ .debug_abbrev 0x00000000 0x2d9 /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ .debug_abbrev 0x000002d9 0x4b build/default/production/main.o
+
+.debug_line 0x00000000 0x15c
+ *(.debug_line .debug_line.* .debug_line_end)
+ .debug_line 0x00000000 0xd9 /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ .debug_line 0x000000d9 0x83 build/default/production/main.o
+
+.debug_frame 0x00000000 0x24
+ *(.debug_frame)
+ .debug_frame 0x00000000 0x24 build/default/production/main.o
+
+.debug_str 0x00000000 0x115
+ *(.debug_str)
+ .debug_str 0x00000000 0x115 /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ .debug_str 0x00000115 0x0 build/default/production/main.o
+
+.debug_loc
+ *(.debug_loc)
+
+.debug_macinfo
+ *(.debug_macinfo)
+
+.debug_weaknames
+ *(.debug_weaknames)
+
+.debug_funcnames
+ *(.debug_funcnames)
+
+.debug_typenames
+ *(.debug_typenames)
+
+.debug_varnames
+ *(.debug_varnames)
+
+.debug_pubtypes
+ *(.debug_pubtypes)
+
+.debug_ranges 0x00000000 0x10
+ *(.debug_ranges)
+ .debug_ranges 0x00000000 0x10 build/default/production/main.o
+
+.debug_macro
+ *(.debug_macro)
+OUTPUT(dist/default/production/tests2.X.production.elf elf32-avr)
+LOAD linker stubs
+LOAD data_init
+
+.note.gnu.avr.deviceinfo
+ 0x00000000 0x3c
+ .note.gnu.avr.deviceinfo
+ 0x00000000 0x3c /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+
+.text.main 0x0000002a 0x10
+ .text.main 0x0000002a 0x10 build/default/production/main.o
+ 0x0000002a main
+
+.text 0x0000003a 0x2
+ .text 0x0000003a 0x2 /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ 0x0000003a __vector_1
+ 0x0000003a __bad_interrupt
+ 0x0000003a __vector_6
+ 0x0000003a __vector_3
+ 0x0000003a __vector_7
+ 0x0000003a __vector_5
+ 0x0000003a __vector_4
+ 0x0000003a __vector_9
+ 0x0000003a __vector_2
+ 0x0000003a __vector_8
+ 0x0000003a __vector_10
diff --git a/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/dist/default/production/tests3.X.production.elf b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/dist/default/production/tests3.X.production.elf
new file mode 100755
index 0000000..7d0d030
Binary files /dev/null and b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/dist/default/production/tests3.X.production.elf differ
diff --git a/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/dist/default/production/tests3.X.production.hex b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/dist/default/production/tests3.X.production.hex
new file mode 100644
index 0000000..4ed21de
--- /dev/null
+++ b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/dist/default/production/tests3.X.production.hex
@@ -0,0 +1,14 @@
+:100000000AC04AC049C048C047C046C045C044C0F5
+:1000100044C042C041C011271FBFCFE5D0E0DEBFC2
+:0A002000CDBF2ED000C0F894FFCF32
+:10002A00A89583FD02C048E001C048E28770842B8E
+:10003A0048ED0FB7F894A8954CBF81BF0FBF41B7E1
+:10004A00406441BF4AB7417F44604ABF4AB74160F2
+:10005A004ABF4FB77894889558ED60E00FB7F89487
+:10006A00A8955CBF61B7677F61BF0FBF4FBF4AB733
+:06007A004E7F4ABF08950D
+:10008000789448ED4CBF41E047BF44E041B944E0BB
+:0800900040B986E0CADFFBCF96
+:02009800B3CFE4
+:02009A001895B7
+:00000001FF
diff --git a/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/dist/default/production/tests3.X.production.map b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/dist/default/production/tests3.X.production.map
new file mode 100644
index 0000000..e09dc99
--- /dev/null
+++ b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/dist/default/production/tests3.X.production.map
@@ -0,0 +1,407 @@
+Archive member included to satisfy reference by file (symbol)
+
+/opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o (exit)
+
+Discarded input sections
+
+ .data 0x00000000 0x0 /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ .bss 0x00000000 0x0 /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ .text 0x00000000 0x0 build/default/production/main.o
+ .data 0x00000000 0x0 build/default/production/main.o
+ .bss 0x00000000 0x0 build/default/production/main.o
+ .text 0x00000000 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ .data 0x00000000 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ .bss 0x00000000 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ .text.libgcc.mul
+ 0x00000000 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ .text.libgcc.div
+ 0x00000000 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ .text.libgcc.prologue
+ 0x00000000 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ .text.libgcc 0x00000000 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ .text.libgcc.builtins
+ 0x00000000 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ .text.libgcc.fmul
+ 0x00000000 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ .text.libgcc.fixed
+ 0x00000000 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+
+Memory Configuration
+
+Name Origin Length Attributes
+text 0x00000000 0x00000400 xr
+data 0x00800040 0x00000020 rw !x
+config 0x00820000 0x00000001 rw !x
+lock 0x00830000 0x00000002 rw !x
+signature 0x00840000 0x00000004 rw !x
+*default* 0x00000000 0xffffffff
+
+Linker script and memory map
+
+ 0x00004000 __RODATA_PM_OFFSET__ = 0x4000
+LOAD /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ 0x00000001 __MPLAB_BUILD = 0x1
+LOAD build/default/production/main.o
+START GROUP
+LOAD /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrtiny/libm.a
+END GROUP
+START GROUP
+LOAD /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a
+LOAD /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrtiny/libm.a
+LOAD /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrtiny/libc.a
+LOAD /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/libattiny10.a
+END GROUP
+ 0x00000000 __TEXT_REGION_ORIGIN__ = DEFINED (__TEXT_REGION_ORIGIN__)?__TEXT_REGION_ORIGIN__:0x0
+ [0x00800040] __DATA_REGION_ORIGIN__ = DEFINED (__DATA_REGION_ORIGIN__)?__DATA_REGION_ORIGIN__:0x800040
+ [0x00000400] __TEXT_REGION_LENGTH__ = DEFINED (__TEXT_REGION_LENGTH__)?__TEXT_REGION_LENGTH__:0x1000
+ [0x00000020] __DATA_REGION_LENGTH__ = DEFINED (__DATA_REGION_LENGTH__)?__DATA_REGION_LENGTH__:0x100
+ [0x00000001] __FUSE_REGION_LENGTH__ = DEFINED (__FUSE_REGION_LENGTH__)?__FUSE_REGION_LENGTH__:0x2
+ 0x00000002 __LOCK_REGION_LENGTH__ = DEFINED (__LOCK_REGION_LENGTH__)?__LOCK_REGION_LENGTH__:0x2
+ 0x00000004 __SIGNATURE_REGION_LENGTH__ = DEFINED (__SIGNATURE_REGION_LENGTH__)?__SIGNATURE_REGION_LENGTH__:0x4
+ 0x00004000 __RODATA_PM_OFFSET__ = DEFINED (__RODATA_PM_OFFSET__)?__RODATA_PM_OFFSET__:0x4000
+
+.hash
+ *(.hash)
+
+.dynsym
+ *(.dynsym)
+
+.dynstr
+ *(.dynstr)
+
+.gnu.version
+ *(.gnu.version)
+
+.gnu.version_d
+ *(.gnu.version_d)
+
+.gnu.version_r
+ *(.gnu.version_r)
+
+.rel.init
+ *(.rel.init)
+
+.rela.init
+ *(.rela.init)
+
+.rel.text
+ *(.rel.text)
+ *(.rel.text.*)
+ *(.rel.gnu.linkonce.t*)
+
+.rela.text
+ *(.rela.text)
+ *(.rela.text.*)
+ *(.rela.gnu.linkonce.t*)
+
+.rel.fini
+ *(.rel.fini)
+
+.rela.fini
+ *(.rela.fini)
+
+.rel.rodata
+ *(.rel.rodata)
+ *(.rel.rodata.*)
+ *(.rel.gnu.linkonce.r*)
+
+.rela.rodata
+ *(.rela.rodata)
+ *(.rela.rodata.*)
+ *(.rela.gnu.linkonce.r*)
+
+.rel.data
+ *(.rel.data)
+ *(.rel.data.*)
+ *(.rel.gnu.linkonce.d*)
+
+.rela.data
+ *(.rela.data)
+ *(.rela.data.*)
+ *(.rela.gnu.linkonce.d*)
+
+.rel.ctors
+ *(.rel.ctors)
+
+.rela.ctors
+ *(.rela.ctors)
+
+.rel.dtors
+ *(.rel.dtors)
+
+.rela.dtors
+ *(.rela.dtors)
+
+.rel.got
+ *(.rel.got)
+
+.rela.got
+ *(.rela.got)
+
+.rel.bss
+ *(.rel.bss)
+
+.rela.bss
+ *(.rela.bss)
+
+.rel.plt
+ *(.rel.plt)
+
+.rela.plt
+ *(.rela.plt)
+
+.text 0x00000000 0x2a
+ *(.vectors)
+ .vectors 0x00000000 0x16 /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ 0x00000000 __vectors
+ 0x00000000 __vector_default
+ *(.vectors)
+ *(.progmem.gcc*)
+ *(.dinit)
+ .dinit 0x00000016 0x0 data_init
+ 0x00000016 . = ALIGN (0x2)
+ 0x00000016 __trampolines_start = .
+ *(.trampolines)
+ .trampolines 0x00000016 0x0 linker stubs
+ *(.trampolines*)
+ 0x00000016 __trampolines_end = .
+ *libprintf_flt.a:*(.progmem.data)
+ *libc.a:*(.progmem.data)
+ 0x00000016 . = ALIGN (0x2)
+ *(.jumptables)
+ *(.jumptables*)
+ *(.lowtext)
+ *(.lowtext*)
+ 0x00000016 __ctors_start = .
+ *(.ctors)
+ 0x00000016 __ctors_end = .
+ 0x00000016 __dtors_start = .
+ *(.dtors)
+ 0x00000016 __dtors_end = .
+ SORT(*)(.ctors)
+ SORT(*)(.dtors)
+ *(.init0)
+ .init0 0x00000016 0x0 /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ 0x00000016 __init
+ *(.init0)
+ *(.init1)
+ *(.init1)
+ *(.init2)
+ .init2 0x00000016 0xc /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ *(.init2)
+ *(.init3)
+ *(.init3)
+ *(.init4)
+ *(.init4)
+ *(.init5)
+ *(.init5)
+ *(.init6)
+ *(.init6)
+ *(.init7)
+ *(.init7)
+ *(.init8)
+ *(.init8)
+ *(.init9)
+ .init9 0x00000022 0x4 /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ *(.init9)
+ 0x00000026 . = ALIGN (0x2)
+ *(.fini9)
+ .fini9 0x00000026 0x0 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ 0x00000026 exit
+ 0x00000026 _exit
+ *(.fini9)
+ *(.fini8)
+ *(.fini8)
+ *(.fini7)
+ *(.fini7)
+ *(.fini6)
+ *(.fini6)
+ *(.fini5)
+ *(.fini5)
+ *(.fini4)
+ *(.fini4)
+ *(.fini3)
+ *(.fini3)
+ *(.fini2)
+ *(.fini2)
+ *(.fini1)
+ *(.fini1)
+ *(.fini0)
+ .fini0 0x00000026 0x4 /opt/microchip/xc8/v2.10/avr/bin/../lib/gcc/avr/5.4.0/avrtiny/libgcc.a(_exit.o)
+ *(.fini0)
+ 0x0000002a _etext = .
+
+.rodata
+ *(.rodata)
+ *(.rodata*)
+ *(.gnu.linkonce.r*)
+
+.data 0x00800040 0x0 load address 0x0000002a
+ [!provide] PROVIDE (__data_start, .)
+ *(.gnu.linkonce.d*)
+ 0x00800040 . = ALIGN (0x2)
+ 0x00800040 _edata = .
+ [!provide] PROVIDE (__data_end, .)
+
+.bss 0x00800040 0x0
+ [!provide] PROVIDE (__bss_start, .)
+ *(COMMON)
+ [!provide] PROVIDE (__bss_end, .)
+ 0x0000002a __data_load_start = LOADADDR (.data)
+ 0x0000002a __data_load_end = (__data_load_start + SIZEOF (.data))
+
+.noinit 0x00800040 0x0
+ [!provide] PROVIDE (__noinit_start, .)
+ *(.noinit*)
+ [!provide] PROVIDE (__noinit_end, .)
+ 0x00800040 _end = .
+
+.lock
+ *(.lock*)
+
+.signature
+ *(.signature*)
+
+.config
+ *(.fuse)
+ *(.lfuse)
+ *(.hfuse)
+ *(.efuse)
+ *(.config*)
+
+.stab
+ *(.stab)
+
+.stabstr
+ *(.stabstr)
+
+.stab.excl
+ *(.stab.excl)
+
+.stab.exclstr
+ *(.stab.exclstr)
+
+.stab.index
+ *(.stab.index)
+
+.stab.indexstr
+ *(.stab.indexstr)
+
+.comment 0x00000000 0x2f
+ *(.comment)
+ .comment 0x00000000 0x2f build/default/production/main.o
+ 0x30 (size before relaxing)
+
+.note.gnu.build-id
+ *(.note.gnu.build-id)
+
+.debug
+ *(.debug)
+
+.line
+ *(.line)
+
+.debug_srcinfo
+ *(.debug_srcinfo)
+
+.debug_sfnames
+ *(.debug_sfnames)
+
+.debug_aranges 0x00000000 0x30
+ *(.debug_aranges)
+ .debug_aranges
+ 0x00000000 0x30 build/default/production/main.o
+
+.debug_pubnames
+ *(.debug_pubnames)
+
+.debug_info 0x00000000 0x65e
+ *(.debug_info .gnu.linkonce.wi.*)
+ .debug_info 0x00000000 0x305 /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ .debug_info 0x00000305 0x359 build/default/production/main.o
+
+.debug_abbrev 0x00000000 0x414
+ *(.debug_abbrev)
+ .debug_abbrev 0x00000000 0x2d9 /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ .debug_abbrev 0x000002d9 0x13b build/default/production/main.o
+
+.debug_line 0x00000000 0x252
+ *(.debug_line .debug_line.* .debug_line_end)
+ .debug_line 0x00000000 0xd9 /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ .debug_line 0x000000d9 0x179 build/default/production/main.o
+
+.debug_frame 0x00000000 0x44
+ *(.debug_frame)
+ .debug_frame 0x00000000 0x44 build/default/production/main.o
+
+.debug_str 0x00000000 0x115
+ *(.debug_str)
+ .debug_str 0x00000000 0x115 /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ .debug_str 0x00000115 0x0 build/default/production/main.o
+
+.debug_loc 0x00000000 0x6c
+ *(.debug_loc)
+ .debug_loc 0x00000000 0x6c build/default/production/main.o
+
+.debug_macinfo
+ *(.debug_macinfo)
+
+.debug_weaknames
+ *(.debug_weaknames)
+
+.debug_funcnames
+ *(.debug_funcnames)
+
+.debug_typenames
+ *(.debug_typenames)
+
+.debug_varnames
+ *(.debug_varnames)
+
+.debug_pubtypes
+ *(.debug_pubtypes)
+
+.debug_ranges 0x00000000 0x20
+ *(.debug_ranges)
+ .debug_ranges 0x00000000 0x20 build/default/production/main.o
+
+.debug_macro
+ *(.debug_macro)
+OUTPUT(dist/default/production/tests3.X.production.elf elf32-avr)
+LOAD linker stubs
+LOAD data_init
+
+.note.gnu.avr.deviceinfo
+ 0x00000000 0x3c
+ .note.gnu.avr.deviceinfo
+ 0x00000000 0x3c /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+
+.text.delay_power_down_wdt
+ 0x0000002a 0x56
+ .text.delay_power_down_wdt
+ 0x0000002a 0x56 build/default/production/main.o
+ 0x0000002a delay_power_down_wdt
+
+.text.main 0x00000080 0x18
+ .text.main 0x00000080 0x18 build/default/production/main.o
+ 0x00000080 main
+
+.text 0x00000098 0x2
+ .text 0x00000098 0x2 /home/dev/.mchp_packs/Microchip/ATtiny_DFP/2.0.10/gcc/dev/attiny10/avrtiny/crtattiny10.o
+ 0x00000098 __vector_1
+ 0x00000098 __bad_interrupt
+ 0x00000098 __vector_6
+ 0x00000098 __vector_3
+ 0x00000098 __vector_7
+ 0x00000098 __vector_5
+ 0x00000098 __vector_4
+ 0x00000098 __vector_9
+ 0x00000098 __vector_2
+ 0x00000098 __vector_10
+
+.text.__vector_8
+ 0x0000009a 0x2
+ .text.__vector_8
+ 0x0000009a 0x2 build/default/production/main.o
+ 0x0000009a __vector_8
diff --git a/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/main.c b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/main.c
new file mode 100644
index 0000000..13f9983
--- /dev/null
+++ b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/main.c
@@ -0,0 +1,75 @@
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+//reference: https://www.avrfreaks.net/forum/sample-project-attiny10
+
+
+// Wake up by WDT interrupt.
+// Don't need to do anything here but (auto-) clearing the interrupt flag.
+EMPTY_INTERRUPT(WDT_vect);
+
+/*
+ Delay in powerdown mode. Wake up by watchdog interrupt.
+ */
+void delay_power_down_wdt(uint8_t wdto)
+{
+ wdt_reset();
+ wdt_enable(wdto);
+ WDTCSR |= (1<.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/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/nbproject/Makefile-local-default.mk b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/nbproject/Makefile-local-default.mk
new file mode 100644
index 0000000..62e3bb2
--- /dev/null
+++ b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/nbproject/Makefile-local-default.mk
@@ -0,0 +1,36 @@
+#
+# 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" ...
+#
+PATH_TO_IDE_BIN=/opt/microchip/mplabx/v5.25/mplab_platform/platform/../mplab_ide/modules/../../bin/
+# Adding MPLAB X bin directory to path.
+PATH:=/opt/microchip/mplabx/v5.25/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH)
+# Path to java used to run MPLAB X when this makefile was created
+MP_JAVA_PATH="/opt/microchip/mplabx/v5.25/sys/java/jre1.8.0_181/bin/"
+OS_CURRENT="$(shell uname -s)"
+MP_CC="/opt/microchip/xc8/v2.10/bin/xc8-cc"
+# MP_CPPC is not defined
+# MP_BC is not defined
+MP_AS="/opt/microchip/xc8/v2.10/bin/xc8-cc"
+MP_LD="/opt/microchip/xc8/v2.10/bin/xc8-cc"
+MP_AR="/opt/microchip/xc8/v2.10/bin/xc8-ar"
+DEP_GEN=${MP_JAVA_PATH}java -jar "/opt/microchip/mplabx/v5.25/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar"
+MP_CC_DIR="/opt/microchip/xc8/v2.10/bin"
+# MP_CPPC_DIR is not defined
+# MP_BC_DIR is not defined
+MP_AS_DIR="/opt/microchip/xc8/v2.10/bin"
+MP_LD_DIR="/opt/microchip/xc8/v2.10/bin"
+MP_AR_DIR="/opt/microchip/xc8/v2.10/bin"
+# MP_BC_DIR is not defined
diff --git a/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/nbproject/Makefile-variables.mk b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/nbproject/Makefile-variables.mk
new file mode 100644
index 0000000..1fc5ca7
--- /dev/null
+++ b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.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=tests3.X.production.hex
+CND_ARTIFACT_PATH_default=dist/default/production/tests3.X.production.hex
+CND_PACKAGE_DIR_default=${CND_DISTDIR}/default/package
+CND_PACKAGE_NAME_default=tests3.x.tar
+CND_PACKAGE_PATH_default=${CND_DISTDIR}/default/package/tests3.x.tar
diff --git a/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/nbproject/Package-default.bash b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/nbproject/Package-default.bash
new file mode 100644
index 0000000..569eacd
--- /dev/null
+++ b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.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}/tests3.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
+OUTPUT_BASENAME=tests3.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
+PACKAGE_TOP_DIR=tests3.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}/tests3.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/tests3.x.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/tests3.x.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/nbproject/configurations.xml b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/nbproject/configurations.xml
new file mode 100644
index 0000000..70bc52a
--- /dev/null
+++ b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/nbproject/configurations.xml
@@ -0,0 +1,160 @@
+
+
+
+
+
+
+
+
+ main.c
+
+
+ Makefile
+
+
+ Makefile
+
+
+
+ localhost
+ ATtiny10
+
+
+
+ XC8
+ 2.10
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+ false
+
+
+
+
+
+
+ false
+
+ false
+
+ false
+ false
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/nbproject/private/configurations.xml b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/nbproject/private/configurations.xml
new file mode 100644
index 0000000..e61d739
--- /dev/null
+++ b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/nbproject/private/configurations.xml
@@ -0,0 +1,25 @@
+
+
+ Makefile
+ 0
+
+
+
+ /opt/microchip/xc8/v2.10/bin
+
+ place holder 1
+ place holder 2
+
+
+
+
+ true
+ 0
+ 0
+ 0
+
+
+
+
+
+
diff --git a/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/nbproject/private/private.xml b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/nbproject/private/private.xml
new file mode 100644
index 0000000..9fbce5d
--- /dev/null
+++ b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/nbproject/private/private.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+ file:/home/dev/Desktop/code/electronics/attiny10_mplab_test/tests3.X/main.c
+
+
+
diff --git a/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/nbproject/project.xml b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/nbproject/project.xml
new file mode 100644
index 0000000..efc4abd
--- /dev/null
+++ b/Attiny_Solar_Energy_Harvest/code/mplab/tests3.X/nbproject/project.xml
@@ -0,0 +1,31 @@
+
+
+ com.microchip.mplab.nbide.embedded.makeproject
+
+
+ tests3
+ tests2
+ tests1
+ test2
+ test1
+ 1f6b2f6c-8c6d-40dd-a737-d73d987b2bef
+ 0
+ c
+
+
+
+ ISO-8859-1
+
+
+
+
+ default
+ 2
+
+
+
+ false
+
+
+
+
diff --git a/Attiny_Solar_Energy_Harvest/datasheets/ATtiny4-5-9-10-Data-Sheet-DS40002060A_FULL.pdf b/Attiny_Solar_Energy_Harvest/datasheets/ATtiny4-5-9-10-Data-Sheet-DS40002060A_FULL.pdf
new file mode 100644
index 0000000..83f34c3
Binary files /dev/null and b/Attiny_Solar_Energy_Harvest/datasheets/ATtiny4-5-9-10-Data-Sheet-DS40002060A_FULL.pdf differ
diff --git a/Attiny_Solar_Energy_Harvest/datasheets/ina169.pdf b/Attiny_Solar_Energy_Harvest/datasheets/ina169.pdf
new file mode 100644
index 0000000..14fc5d1
Binary files /dev/null and b/Attiny_Solar_Energy_Harvest/datasheets/ina169.pdf differ
diff --git a/Attiny_Solar_Energy_Harvest/resources/ATtiny4_5_9_10_20_40Programmer/ATtiny4_5_9_10_20_40Programmer.ino b/Attiny_Solar_Energy_Harvest/resources/ATtiny4_5_9_10_20_40Programmer/ATtiny4_5_9_10_20_40Programmer.ino
index 91aa727..7fbf7f0 100644
--- a/Attiny_Solar_Energy_Harvest/resources/ATtiny4_5_9_10_20_40Programmer/ATtiny4_5_9_10_20_40Programmer.ino
+++ b/Attiny_Solar_Energy_Harvest/resources/ATtiny4_5_9_10_20_40Programmer/ATtiny4_5_9_10_20_40Programmer.ino
@@ -1,114 +1,114 @@
/**************************************************
- * TPI programmer for ATtiny4/5/9/10/20/40
- *
- * Make the connections as shown below.
- *
- * To use:
+ TPI programmer for ATtiny4/5/9/10/20/40
+
+ Make the connections as shown below.
+
+ To use:
***** Buad rate must be set to 9600 ****
- *
- * - Upload to arduino and power off
- * - Connect ATtiny10 as shown
- * - Power on and open the serial monitor
- * - If things are working so far you should
- * see "NVM enabled" and "ATtiny10/20/40 connected".
- * - Input one-letter commands via serial monitor:
- *
- * D = dump memory. Displays all current memory
- * on the chip
- *
- * E = erase chip. Erases all program memory
- * automatically done at time of programming
- *
- * P = write program. After sending this, paste
- * the program from the hex file into the
- * serial monitor.
- *
- * S = set fuse. follow the instructions to set
- * one of the three fuses.
- *
- * C = clear fuse. follow the instructions to clear
- * one of the three fuses.
- *
- * L = Set Lock Bits No further programming & verification
- * possible
- *
- * H = Toggle High Voltage Programming
- *
- * T = Toggle +12v enabled by High, or Low
- *
- * R/r = Quick reset
- *
- * - Finally, power off the arduino and remove the
- * Attiny10/20/40
- *
- *
- * Arduino ATtiny10 *
- * ----------+ +---------------- *
- * (SS#) 10 |--[R]-----| 6 (RESET#/PB3) *
- * | | *
- * (MOSI) 11 |--[R]--+--| 1 (TPIDATA/PB0) *
- * | | | *
- * (MISO) 12 |--[R]--+ | *
- * | | *
- * (SCK) 13 |--[R]-----| 3 (TPICLK/PB1) *
- * ----------+ +---------------- *
+
+ - Upload to arduino and power off
+ - Connect ATtiny10 as shown
+ - Power on and open the serial monitor
+ - If things are working so far you should
+ see "NVM enabled" and "ATtiny10/20/40 connected".
+ - Input one-letter commands via serial monitor:
+
+ D = dump memory. Displays all current memory
+ on the chip
+
+ E = erase chip. Erases all program memory
+ automatically done at time of programming
+
+ P = write program. After sending this, paste
+ the program from the hex file into the
+ serial monitor.
+
+ S = set fuse. follow the instructions to set
+ one of the three fuses.
+
+ C = clear fuse. follow the instructions to clear
+ one of the three fuses.
+
+ L = Set Lock Bits No further programming & verification
+ possible
+
+ H = Toggle High Voltage Programming
+
+ T = Toggle +12v enabled by High, or Low
+
+ R/r = Quick reset
+
+ - Finally, power off the arduino and remove the
+ Attiny10/20/40
+
+
+ Arduino ATtiny10
+ ----------+ +----------------
+ (SS#) 10 |--[R]-----| 6 (RESET#/PB3)
+ | |
+ (MOSI) 11 |--[R]--+--| 1 (TPIDATA/PB0)
+ | | |
+ (MISO) 12 |--[R]--+ |
+ | |
+ (SCK) 13 |--[R]-----| 3 (TPICLK/PB1)
+ ----------+ +----------------
* *
- * ----------+ +---------------- *
- * (HVP) 9 |--- | 6 (RESET#/PB3) *
- * | | *
+ ----------+ +----------------
+ (HVP) 9 |--- | 6 (RESET#/PB3)
+ | |
* *
- * -[R]- = a 220 - 1K Ohm resistor *
+ -[R]- = a 220 - 1K Ohm resistor
* *
- * this picture : 2011/12/08 by pcm1723 *
- * modified :2015/02/27 by KD *
+ this picture : 2011/12/08 by pcm1723
+ modified :2015/02/27 by KD
* *
- * thanks to pcm1723 for tpitest.pde upon which *
- * this is based *
+ thanks to pcm1723 for tpitest.pde upon which
+ this is based
**************************************************
- Updates:
-
+ Updates:
+
Apr 02, 2018: Ksdsksd@gmail.com
- * Added Lock bit setting to main menu
-
+ Added Lock bit setting to main menu
+
Jan 23, 2017: Ksdsksd@gmail.com
- * Thanks to InoueTaichi Fixed incorrect #define Tiny40
-
+ Thanks to InoueTaichi Fixed incorrect #define Tiny40
+
Mar 05, 2015: Ksdsksd@gamil.com
- * Added notifications to setting and clearing the system flags.
-
+ Added notifications to setting and clearing the system flags.
+
Feb 23, 2015: Ksdsksd@gamil.com
- * Changed the programmer Diagram, This is the config I use, and get a sucessful programming of a tiny10 at 9600 baud.
-
+ Changed the programmer Diagram, This is the config I use, and get a sucessful programming of a tiny10 at 9600 baud.
+
Mar 22, 2014: Ksdsksd@gmail.com
- * Added the quick reset to high before resetting the device.
- * Added code to stop the SPI and float the pins for testing the device while connected.
+ Added the quick reset to high before resetting the device.
+ Added code to stop the SPI and float the pins for testing the device while connected.
Mar 20, 2014: Ksdsksd@gmail.com
- * Added a quick reset by sending 'r' or 'R' via the serial monitor.
- * Added a High voltage programming option from pin 9, toggled by 'H'
- * Added a High/low option for providing 12v to the reset pin, toggled by 'T'
+ Added a quick reset by sending 'r' or 'R' via the serial monitor.
+ Added a High voltage programming option from pin 9, toggled by 'H'
+ Added a High/low option for providing 12v to the reset pin, toggled by 'T'
Mar 17, 2014: Ksdsksd@gmail.com
- * Had some trouble with the nibbles being swapped when programming on the 10 & 20,
+ Had some trouble with the nibbles being swapped when programming on the 10 & 20,
added b1,b2 to hold the serial data before calling byteval()
- * Added Nat Blundell's patch to the code
+ Added Nat Blundell's patch to the code
Apr 10, 2013: Ksdsksd@gmail.com
- * Applied Fix for setting and clearing flags
+ Applied Fix for setting and clearing flags
Feb 7, 2013: Ksdsksd@gmail.com
- * Fixed programming timer, had intitial start at zero instead of current time.
+ Fixed programming timer, had intitial start at zero instead of current time.
Dec 11, 2012: Ksdsksd@gmail.com
- * Added detect and programming for 4/5/9
+ Added detect and programming for 4/5/9
Dec 5-6, 2012: Ksdsksd@gmail.com
- * Incorperated read, and verify into program. Now have no program size limitation by using 328p.
- * Changed the outHex routines consolidated them into 1, number to be printed, and number of nibbles
- * Added a type check to distinguish between Tiny10/20/40
- * Added an auto word size check to ensure that there is the proper amount of words written for a 10/20/40
- * Removed Read program, Verify, and Finish from options
- * Changed baud rate to 19200 for delay from data written to the chip, to prevent serial buffer overrun.
+ Incorperated read, and verify into program. Now have no program size limitation by using 328p.
+ Changed the outHex routines consolidated them into 1, number to be printed, and number of nibbles
+ Added a type check to distinguish between Tiny10/20/40
+ Added an auto word size check to ensure that there is the proper amount of words written for a 10/20/40
+ Removed Read program, Verify, and Finish from options
+ Changed baud rate to 19200 for delay from data written to the chip, to prevent serial buffer overrun.
Oct 5, 2012: Ksdsksd@gmail.com
*** Noticed that when programming, the verification fails
@@ -116,8 +116,8 @@
Quick fix was adding 3 NOP's to the end the Tiny's code, and ignoring the errors, the Tiny then performed as expected.
Oct 4, 2012: Ksdsksd@gmail.com
- * Moved all Serial printed strings to program space
- * Added code to detect Tiny20
+ Moved all Serial printed strings to program space
+ Added code to detect Tiny20
*/
#include
@@ -174,62 +174,62 @@ char type; // type of chip connected 1 = Tiny10, 2 = Tiny20
char HVP = 0;
char HVON = 0;
-void setup(){
+void setup() {
// set up serial
Serial.begin(9600); // you cant increase this, it'll overrun the buffer
Serial.println(F("setupend")); //anything?
// set up SPI
-/* SPI.begin();
- SPI.setBitOrder(LSBFIRST);
- SPI.setDataMode(SPI_MODE0);
- SPI.setClockDivider(SPI_CLOCK_DIV32);
+ /* SPI.begin();
+ SPI.setBitOrder(LSBFIRST);
+ SPI.setDataMode(SPI_MODE0);
+ SPI.setClockDivider(SPI_CLOCK_DIV32);
-*/ start_tpi();
+ */ start_tpi();
pinMode(HVReset, OUTPUT);
- // initialize memory pointer register
- setPointer(0x0000);
-
+ // initialize memory pointer register
+ setPointer(0x0000);
+
- timeout = 20000;
- idChecked = false;
+ timeout = 20000;
+ idChecked = false;
} // end setup()
void hvserial()
{
- if(HVP)
- Serial.println(F("***High Voltage Programming Enabled***"));
- else
- Serial.println(F("High Voltage Programming Disabled"));
+ if (HVP)
+ Serial.println(F("***High Voltage Programming Enabled***"));
+ else
+ Serial.println(F("High Voltage Programming Disabled"));
-// M
- Serial.print(HVON?F("HIGH"):F("LOW"));
- Serial.print(F(" supplies 12v"));
+ // M
+ Serial.print(HVON ? F("HIGH") : F("LOW"));
+ Serial.print(F(" supplies 12v"));
}
void hvReset(char highLow)
{
- if(HVP)
- {
- if(HVON) //if high enables 12v
- highLow = !highLow; // invert the typical reset
- digitalWrite(HVReset, highLow);
- }
- else
- digitalWrite(SS, highLow);
+ if (HVP)
+ {
+ if (HVON) //if high enables 12v
+ highLow = !highLow; // invert the typical reset
+ digitalWrite(HVReset, highLow);
+ }
+ else
+ digitalWrite(SS, highLow);
}
void quickReset()
{
- digitalWrite(SS,HIGH);
- delay(1);
- digitalWrite(SS,LOW);
- delay(10);
- digitalWrite(SS,HIGH);
+ digitalWrite(SS, HIGH);
+ delay(1);
+ digitalWrite(SS, LOW);
+ delay(10);
+ digitalWrite(SS, HIGH);
}
void start_tpi() {
@@ -238,10 +238,10 @@ void start_tpi() {
SPI.setDataMode(SPI_MODE0);
SPI.setClockDivider(SPI_CLOCK_DIV32);
- // enter TPI programming mode
- hvReset(LOW);
-// digitalWrite(SS, LOW); // assert RESET on tiny
- delay(1); // t_RST min = 400 ns @ Vcc = 5 V
+ // enter TPI programming mode
+ hvReset(LOW);
+ // digitalWrite(SS, LOW); // assert RESET on tiny
+ delay(1); // t_RST min = 400 ns @ Vcc = 5 V
SPI.transfer(0xff); // activate TPI by emitting
SPI.transfer(0xff); // 16 or more pulses on TPICLK
@@ -251,18 +251,18 @@ void start_tpi() {
send_skey(NVM_PROGRAM_ENABLE); // enable NVM interface
// wait for NVM to be enabled
- while((readCSS(0x00) & 0x02) < 1){
+ while ((readCSS(0x00) & 0x02) < 1) {
// wait
}
Serial.println(F("NVM enabled"));
}
-void setLockBits(){
+void setLockBits() {
Serial.print(F("Locking... Are you sure? Y/N"));
- while(Serial.available() < 1);
+ while (Serial.available() < 1);
char yn = Serial.read();
- if(yn == 'n' || yn == 'N')
+ if (yn == 'n' || yn == 'N')
return;
setPointer(0x3F00);
@@ -274,21 +274,21 @@ void setLockBits(){
tpi_send_byte(0xFF);
- while((readIO(NVMCSR) & (1<<7)) != 0x00);
+ while ((readIO(NVMCSR) & (1 << 7)) != 0x00);
Serial.print(F("Locked..."));
}
-void loop(){
+void loop() {
Serial.print(F("Start"));
- if(!idChecked){
-// start_tpi();
+ if (!idChecked) {
+ // start_tpi();
checkID();
idChecked = true;
finish();
}
// when ready, send ready signal '.' and wait
Serial.print(F("\n>"));
- while(Serial.available() < 1){
+ while (Serial.available() < 1) {
// wait
}
start_tpi();
@@ -303,54 +303,54 @@ void loop(){
char comnd = Sread();
- switch( comnd ){
+ switch ( comnd ) {
case 'r':
case'R':
- quickReset();
- break;
+ quickReset();
+ break;
case 'D':
dumpMemory();
break;
- case 'H':
- HVP = !HVP;
- hvserial();
- break;
+ case 'H':
+ HVP = !HVP;
+ hvserial();
+ break;
- case 'T':
- HVON = !HVON;
- hvserial();
- break;
+ case 'T':
+ HVON = !HVON;
+ hvserial();
+ break;
- case 'P':
- if(!writeProgram()){
+ case 'P':
+ if (!writeProgram()) {
startTime = millis();
- while(millis()-startTime < 8000)
+ while (millis() - startTime < 8000)
Serial.read();// if exited due to error, disregard all other serial data
}
- break;
+ break;
- case 'E':
- eraseChip();
- break;
+ case 'E':
+ eraseChip();
+ break;
- case 'S':
- setConfig(true);
- break;
+ case 'S':
+ setConfig(true);
+ break;
- case 'C':
- setConfig(false);
- break;
+ case 'C':
+ setConfig(false);
+ break;
case 'L':
setLockBits();
break;
- default:
- Serial.println(F("Received unknown command"));
+ default:
+ Serial.println(F("Received unknown command"));
}
finish();
@@ -365,7 +365,7 @@ void ERROR_pgmSize(void)
void ERROR_data(char i)
{
Serial.println(F("couldn't receive data:"));
- switch(i){
+ switch (i) {
case TimeOut:
Serial.println(F("timed out"));
break;
@@ -384,20 +384,20 @@ void ERROR_data(char i)
// print the register, SRAM, config and signature memory
-void dumpMemory(){
+void dumpMemory() {
unsigned int len;
uint8_t i;
// initialize memory pointer register
setPointer(0x0000);
Serial.println(F("Current memory state:"));
- if(type != Tiny4_5)
+ if (type != Tiny4_5)
len = 0x400 * type; //the memory length for a 10/20/40 is 1024/2048/4096
else
len = 0x200; //tiny 4/5 has 512 bytes
len += 0x4000;
- while(adrs < len){
+ while (adrs < len) {
// read the byte at the current pointer address
// and increment address
tpi_send_byte(SLDp);
@@ -406,25 +406,37 @@ void dumpMemory(){
// read all the memory, but only print
// the register, SRAM, config and signature memory
if ((0x0000 <= adrs && adrs <= 0x005F) // register/SRAM
- |(0x3F00 <= adrs && adrs <= 0x3F01) // NVM lock bits
- |(0x3F40 <= adrs && adrs <= 0x3F41) // config
- |(0x3F80 <= adrs && adrs <= 0x3F81) // calibration
- |(0x3FC0 <= adrs && adrs <= 0x3FC3) // ID
- |(0x4000 <= adrs && adrs <= len-1) ) { // program
+ | (0x3F00 <= adrs && adrs <= 0x3F01) // NVM lock bits
+ | (0x3F40 <= adrs && adrs <= 0x3F41) // config
+ | (0x3F80 <= adrs && adrs <= 0x3F81) // calibration
+ | (0x3FC0 <= adrs && adrs <= 0x3FC3) // ID
+ | (0x4000 <= adrs && adrs <= len - 1) ) { // program
// print +number along the top
if ((0x00 == adrs)
- |(0x3f00 == adrs) // NVM lock bits
- |(0x3F40 == adrs) // config
- |(0x3F80 == adrs) // calibration
- |(0x3FC0 == adrs) // ID
- |(0x4000 == adrs) ) {
+ | (0x3f00 == adrs) // NVM lock bits
+ | (0x3F40 == adrs) // config
+ | (0x3F80 == adrs) // calibration
+ | (0x3FC0 == adrs) // ID
+ | (0x4000 == adrs) ) {
Serial.println();
- if(adrs == 0x0000){ Serial.print(F("registers, SRAM")); }
- if(adrs == 0x3F00){ Serial.print(F("NVM lock")); }
- if(adrs == 0x3F40){ Serial.print(F("configuration")); }
- if(adrs == 0x3F80){ Serial.print(F("calibration")); }
- if(adrs == 0x3FC0){ Serial.print(F("device ID")); }
- if(adrs == 0x4000){ Serial.print(F("program")); }
+ if (adrs == 0x0000) {
+ Serial.print(F("registers, SRAM"));
+ }
+ if (adrs == 0x3F00) {
+ Serial.print(F("NVM lock"));
+ }
+ if (adrs == 0x3F40) {
+ Serial.print(F("configuration"));
+ }
+ if (adrs == 0x3F80) {
+ Serial.print(F("calibration"));
+ }
+ if (adrs == 0x3FC0) {
+ Serial.print(F("device ID"));
+ }
+ if (adrs == 0x4000) {
+ Serial.print(F("program"));
+ }
Serial.println();
for (i = 0; i < 5; i++)
Serial.print(F(" "));
@@ -439,11 +451,11 @@ void dumpMemory(){
outHex(adrs, 4);
Serial.print(F(": ")); // delimiter
}
- outHex(b, 2);
- Serial.print(F(" "));
+ outHex(b, 2);
+ Serial.print(F(" "));
}
adrs++; // increment memory address
- if(adrs == 0x0060){
+ if (adrs == 0x0060) {
// skip reserved memory
setPointer(0x3F00);
}
@@ -453,7 +465,7 @@ void dumpMemory(){
// receive and translate the contents of a hex file, Program and verify on the fly
-boolean writeProgram(){
+boolean writeProgram() {
char datlength[] = "00";
char addr[] = "0000";
char something[] = "00";
@@ -467,21 +479,21 @@ boolean writeProgram(){
correct = true;
unsigned long pgmStartTime = millis();
eraseChip(); // erase chip
- char words = (type!=Tiny4_5?type:1);
+ char words = (type != Tiny4_5 ? type : 1);
char b1, b2;
// read in the data and
- while(!fileEnd){
+ while (!fileEnd) {
startTime = millis();
- while(Serial.available() < 1){
- if(millis()-startTime > timeout){
+ while (Serial.available() < 1) {
+ if (millis() - startTime > timeout) {
ERROR_data(TimeOut);
return false;
}
- if(pgmStartTime == 0)
+ if (pgmStartTime == 0)
pgmStartTime = millis();
}
- if(Sread() != ':'){ // maybe it was a newline??
- if(Sread() != ':'){
+ if (Sread() != ':') { // maybe it was a newline??
+ if (Sread() != ':') {
ERROR_data(HexError);
return false;
}
@@ -497,67 +509,67 @@ boolean writeProgram(){
addr[1] = Sread();
addr[2] = Sread();
addr[3] = Sread();
- if(linelength != 0x00 && addr[0]=='0' && addr[1]=='0' && addr[2]=='0' && addr[3]=='0')
+ if (linelength != 0x00 && addr[0] == '0' && addr[1] == '0' && addr[2] == '0' && addr[3] == '0')
currentByte = 0;
// read type thingy. "01" means end of file
something[0] = Sread();
something[1] = Sread();
- if(something[1] == '1'){
+ if (something[1] == '1') {
fileEnd = true;
}
- if(something[1] == '2'){
- for (int i = 0; i<=linelength; i++){
+ if (something[1] == '2') {
+ for (int i = 0; i <= linelength; i++) {
Sread();
Sread();
}
}
- else{
+ else {
// read in the data
- for(int k=0; k timeout){
+ for (int k = 0; k < linelength; k++) {
+ while (Serial.available() < 1) {
+ if (millis() - startTime > timeout) {
ERROR_data(TimeOut);
return false;
}
}
- b1=Sread();
- b2=Sread();
+ b1 = Sread();
+ b2 = Sread();
data[currentByte] = byteval(b1, b2);
currentByte++;
progSize++;
- if(progSize > (type!=Tiny4_5?type*1024:512)){
+ if (progSize > (type != Tiny4_5 ? type * 1024 : 512)) {
ERROR_data(TooLarge);
return 0;
}
- if(fileEnd) //has the end of the file been reached?
- while(currentByte < 2 * words){// append zeros to align the word count to program
+ if (fileEnd) //has the end of the file been reached?
+ while (currentByte < 2 * words) { // append zeros to align the word count to program
data[currentByte] = 0;
currentByte++;
}
- if( currentByte == 2 * words ){// is the word/Dword/Qword here?
+ if ( currentByte == 2 * words ) { // is the word/Dword/Qword here?
currentByte = 0; // yes, reset counter
setPointer(tadrs); // point to the address to program
writeIO(NVMCMD, NVM_WORD_WRITE);
- for(int i = 0; i<2 * words; i+=2){// loop for each word size depending on micro
+ for (int i = 0; i < 2 * words; i += 2) { // loop for each word size depending on micro
// now write a word to program memory
tpi_send_byte(SSTp);
tpi_send_byte(data[i]); // LSB first
tpi_send_byte(SSTp);
- tpi_send_byte(data[i+1]); // then MSB
+ tpi_send_byte(data[i + 1]); // then MSB
SPI.transfer(0xff); //send idle between words
SPI.transfer(0xff); //send idle between words
}
- while((readIO(NVMCSR) & (1<<7)) != 0x00){} // wait for write to finish
+ while ((readIO(NVMCSR) & (1 << 7)) != 0x00) {} // wait for write to finish
writeIO(NVMCMD, NVM_NOP);
SPI.transfer(0xff);
@@ -566,60 +578,60 @@ boolean writeProgram(){
//verify written words
setPointer(tadrs);
- for (int c = 0; c < 2 * words; c++){
+ for (int c = 0; c < 2 * words; c++) {
tpi_send_byte(SLDp);
b = tpi_receive_byte(); // get data byte
- if(b != data[c]){
+ if (b != data[c]) {
correct = false;
Serial.println(F("program error:"));
Serial.print(F("byte "));
outHex(adrs, 4);
Serial.print(F(" expected "));
- outHex(data[c],2);
+ outHex(data[c], 2);
Serial.print(F(" read "));
- outHex(b,2);
+ outHex(b, 2);
Serial.println();
- if(!correct)
+ if (!correct)
return false;
}
}
tadrs += 2 * words;
+ }
}
- }
- // read in the checksum.
- startTime = millis();
- while(Serial.available() == 0){
- if(millis()-startTime > timeout){
- ERROR_data(TimeOut);
- return false;
+ // read in the checksum.
+ startTime = millis();
+ while (Serial.available() == 0) {
+ if (millis() - startTime > timeout) {
+ ERROR_data(TimeOut);
+ return false;
+ }
}
- }
- chksm[0] = Sread();
- chksm[1] = Sread();
+ chksm[0] = Sread();
+ chksm[1] = Sread();
- }
+ }
}
// the program was successfully written
Serial.print(F("Successfully wrote program: "));
Serial.print(progSize, DEC);
Serial.print(F(" of "));
- if(type != Tiny4_5)
+ if (type != Tiny4_5)
Serial.print(1024 * type, DEC);
else
Serial.print(512, DEC);
Serial.print(F(" bytes\n in "));
- Serial.print((millis()-pgmStartTime)/1000.0,DEC);
+ Serial.print((millis() - pgmStartTime) / 1000.0, DEC);
Serial.print(F(" Seconds"));
-// digitalWrite(SS, HIGH); // release RESET
+ // digitalWrite(SS, HIGH); // release RESET
return true;
}
-void eraseChip(){
+void eraseChip() {
// initialize memory pointer register
setPointer(0x4001); // need the +1 for chip erase
@@ -633,13 +645,13 @@ void eraseChip(){
tpi_send_byte(0xAA);
tpi_send_byte(SSTp);
tpi_send_byte(0xAA);
- while((readIO(NVMCSR) & (1<<7)) != 0x00){
+ while ((readIO(NVMCSR) & (1 << 7)) != 0x00) {
// wait for erasing to finish
}
Serial.println(F("chip erased"));
}
-void setConfig(boolean val){
+void setConfig(boolean val) {
// get current config byte
setPointer(0x3F40);
tpi_send_byte(SLD);
@@ -651,85 +663,85 @@ void setConfig(boolean val){
Serial.println(F("r = disable reset"));
Serial.println(F("x = cancel. don't change anything"));
- while(Serial.available() < 1){
+ while (Serial.available() < 1) {
// wait
}
char comnd = Serial.read();
setPointer(0x3F40);
writeIO(NVMCMD, (val ? NVM_WORD_WRITE : NVM_SECTION_ERASE) );
- if(comnd == 'c'){
+ if (comnd == 'c') {
tpi_send_byte(SSTp);
- if(val){
- tpi_send_byte(b & 0b11111011);
- }else{
+ if (val) {
+ tpi_send_byte(b & 0b11111011);
+ } else {
tpi_send_byte(b | 0x04);
}
- tpi_send_byte(SSTp);
- tpi_send_byte(0xFF);
- }else if(comnd == 'w'){
tpi_send_byte(SSTp);
- if(val){
- tpi_send_byte(b & 0b11111101);
- }else{
+ tpi_send_byte(0xFF);
+ } else if (comnd == 'w') {
+ tpi_send_byte(SSTp);
+ if (val) {
+ tpi_send_byte(b & 0b11111101);
+ } else {
tpi_send_byte(b | 0x02);
}
- tpi_send_byte(SSTp);
- tpi_send_byte(0xFF);
- }else if(comnd == 'r'){
tpi_send_byte(SSTp);
- if(val){
+ tpi_send_byte(0xFF);
+ } else if (comnd == 'r') {
+ tpi_send_byte(SSTp);
+ if (val) {
tpi_send_byte(b & 0b11111110);
- }else{
+ } else {
tpi_send_byte(b | 0x01);
}
tpi_send_byte(SSTp);
tpi_send_byte(0xFF);
- }else if(comnd == 'x'){
+ } else if (comnd == 'x') {
// do nothing
- }else{
+ } else {
Serial.println(F("received unknown command. Cancelling"));
}
- while((readIO(NVMCSR) & (1<<7)) != 0x00){
+ while ((readIO(NVMCSR) & (1 << 7)) != 0x00) {
// wait for write to finish
}
writeIO(NVMCMD, NVM_NOP);
SPI.transfer(0xff);
SPI.transfer(0xff);
- if(comnd != 'x'){
-
+ if (comnd != 'x') {
+
Serial.print(F("\n\nSuccessfully "));
- if(val)
+ if (val)
Serial.print(F("Set "));
- else
+ else
Serial.print(F("Cleared "));
-
+
Serial.print(F("\""));
- if(comnd == 'w')
+ if (comnd == 'w')
Serial.print(F("Watchdog"));
- else if(comnd == 'c')
+ else if (comnd == 'c')
Serial.print(F("Clock Output"));
- else if(comnd == 'r')
+ else if (comnd == 'r')
Serial.print(F("Reset"));
-
+
Serial.println(F("\" Flag\n"));
}
}
-void finish(){
+void finish() {
writeCSS(0x00, 0x00);
SPI.transfer(0xff);
SPI.transfer(0xff);
- hvReset(HIGH);
-// digitalWrite(SS, HIGH); // release RESET
+ hvReset(HIGH);
+ // digitalWrite(SS, HIGH); // release RESET
delay(1); // t_RST min = 400 ns @ Vcc = 5 V
SPI.end();
DDRB &= 0b11000011; //tri-state spi so target can be tested
PORTB &= 0b11000011;
}
-void checkID(){
+void checkID() {
// check the device ID
uint8_t id1, id2, id3;
setPointer(0x3FC0);
@@ -740,37 +752,37 @@ void checkID(){
id2 = tpi_receive_byte();
tpi_send_byte(SLDp);
id3 = tpi_receive_byte();
- if(id1==0x1E && id2==0x8F && id3==0x0A){
+ if (id1 == 0x1E && id2 == 0x8F && id3 == 0x0A) {
Serial.print(F("ATtiny4"));
type = Tiny4_5;
- }else if(id1==0x1E && id2==0x8F && id3==0x09){
+ } else if (id1 == 0x1E && id2 == 0x8F && id3 == 0x09) {
Serial.print(F("ATtiny5"));
type = Tiny4_5;
- }else if(id1==0x1E && id2==0x90 && id3==0x08){
+ } else if (id1 == 0x1E && id2 == 0x90 && id3 == 0x08) {
Serial.print(F("ATtiny9"));
type = Tiny9;
- }else if(id1==0x1E && id2==0x90 && id3==0x03){
+ } else if (id1 == 0x1E && id2 == 0x90 && id3 == 0x03) {
Serial.print(F("ATtiny10"));
type = Tiny10;
- }else if(id1==0x1E && id2==0x91 && id3==0x0f){
+ } else if (id1 == 0x1E && id2 == 0x91 && id3 == 0x0f) {
Serial.print(F("ATtiny20"));
type = Tiny20;
- }else if(id1==0x1E && id2==0x92 && id3==0x0e){
+ } else if (id1 == 0x1E && id2 == 0x92 && id3 == 0x0e) {
Serial.print(F("ATtiny40"));
type = Tiny40;
- }else{
+ } else {
Serial.print(F("Unknown chip"));
}
Serial.println(F(" connected"));
}
/*
-* send a byte in one TPI frame (12 bits)
-* (1 start + 8 data + 1 parity + 2 stop)
-* using 2 SPI data bytes (2 x 8 = 16 clocks)
-* (with 4 extra idle bits)
+ send a byte in one TPI frame (12 bits)
+ (1 start + 8 data + 1 parity + 2 stop)
+ using 2 SPI data bytes (2 x 8 = 16 clocks)
+ (with 4 extra idle bits)
*/
-void tpi_send_byte( uint8_t data ){
+void tpi_send_byte( uint8_t data ) {
// compute partiy bit
uint8_t par = data;
par ^= (par >> 4); // b[7:4] (+) b[3:0]
@@ -785,10 +797,10 @@ void tpi_send_byte( uint8_t data ){
} // end tpi_send_byte()
/*
-* receive TPI 12-bit format byte data
-* via SPI 2 bytes (16 clocks) or 3 bytes (24 clocks)
+ receive TPI 12-bit format byte data
+ via SPI 2 bytes (16 clocks) or 3 bytes (24 clocks)
*/
-uint8_t tpi_receive_byte( void ){
+uint8_t tpi_receive_byte( void ) {
//uint8_t b1, b2, b3;
// keep transmitting high(idle) while waiting for a start bit
do {
@@ -813,85 +825,86 @@ uint8_t tpi_receive_byte( void ){
b1 |= 0x01; // fill with idle bit (1)
}
// now the data byte is stored in b2
- return( b2 );
+ return ( b2 );
} // end tpi_receive_byte()
// send the 64 bit NVM key
-void send_skey(uint64_t nvm_key){
+void send_skey(uint64_t nvm_key) {
tpi_send_byte(SKEY);
- while(nvm_key){
+ while (nvm_key) {
tpi_send_byte(nvm_key & 0xFF);
nvm_key >>= 8;
}
} // end send_skey()
// sets the pointer address
-void setPointer(unsigned short address){
+void setPointer(unsigned short address) {
adrs = address;
tpi_send_byte(SSTPRL);
tpi_send_byte(address & 0xff);
tpi_send_byte(SSTPRH);
- tpi_send_byte((address>>8) & 0xff);
+ tpi_send_byte((address >> 8) & 0xff);
}
// writes using SOUT
-void writeIO(uint8_t address, uint8_t value){
+void writeIO(uint8_t address, uint8_t value) {
// SOUT 0b1aa1aaaa replace a with 6 address bits
tpi_send_byte(0x90 | (address & 0x0F) | ((address & 0x30) << 1));
tpi_send_byte(value);
}
// reads using SIN
-uint8_t readIO(uint8_t address){
+uint8_t readIO(uint8_t address) {
// SIN 0b0aa1aaaa replace a with 6 address bits
tpi_send_byte(0x10 | (address & 0x0F) | ((address & 0x30) << 1));
return tpi_receive_byte();
}
// writes to CSS
-void writeCSS(uint8_t address, uint8_t value){
+void writeCSS(uint8_t address, uint8_t value) {
tpi_send_byte(0xC0 | address);
tpi_send_byte(value);
}
// reads from CSS
-uint8_t readCSS(uint8_t address){
+uint8_t readCSS(uint8_t address) {
tpi_send_byte(0x80 | address);
return tpi_receive_byte();
}
// converts two chars to one byte
// c1 is MS, c2 is LS
-uint8_t byteval(char c1, char c2){
+uint8_t byteval(char c1, char c2) {
uint8_t by;
- if(c1 <= '9'){
- by = c1-'0';
- }else{
- by = c1-'A'+10;
+ if (c1 <= '9') {
+ by = c1 - '0';
+ } else {
+ by = c1 - 'A' + 10;
}
by = by << 4;
- if(c2 <= '9'){
- by += c2-'0';
- }else{
- by += c2-'A'+10;
+ if (c2 <= '9') {
+ by += c2 - '0';
+ } else {
+ by += c2 - 'A' + 10;
}
return by;
}
-char Sread(void){
- while(Serial.available()<1){}
+char Sread(void) {
+ while (Serial.available() < 1) {}
return Serial.read();
}
-void outHex(unsigned int n, char l){ // call with the number to be printed, and # of nibbles expected.
- for(char count = l-1; count > 0;count--){ // quick and dirty to add zeros to the hex value
- if(((n >> (count*4)) & 0x0f) == 0) // if MSB is 0
- Serial.print(F("0")); //prepend a 0
- else
- break; //exit the for loop
- }
- Serial.print(n, HEX);
+void outHex(unsigned int n, char l) { // call with the number to be printed, and # of nibbles expected.
+ for (char count = l - 1; count > 0; count--) { // quick and dirty to add zeros to the hex value
+ if (((n >> (count * 4)) & 0x0f) == 0) // if MSB is 0
+ Serial.print(F("0")); //prepend a 0
+ else
+ break; //exit the for loop
+ }
+ Serial.print(n, HEX);
}
// end of file
+