aboutsummaryrefslogtreecommitdiff
path: root/write_prog_eeprom.py
diff options
context:
space:
mode:
Diffstat (limited to 'write_prog_eeprom.py')
-rw-r--r--write_prog_eeprom.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/write_prog_eeprom.py b/write_prog_eeprom.py
new file mode 100644
index 0000000..a7440cf
--- /dev/null
+++ b/write_prog_eeprom.py
@@ -0,0 +1,39 @@
+## This file write different programms to the EEPROM AT28C
+
+## programm start at 0x00
+
+import test_prog
+import fibonacci_prog
+
+
+import eeprom_pi as ep
+import sys
+
+prog = None
+
+if len(sys.argv) == 2:
+ if sys.argv[1] == "test":
+ prog = test_prog.prog
+
+
+if prog == None:
+ print("error: please specify a valid programm.")
+ print("valid programms are: test")
+ exit()
+
+## start at addres 0x0
+address = 0x0
+inst_nr = 0
+
+ep.init_board()
+
+for instruction in prog:
+ print("%s: %s" % (hex(address+inst_nr), hex(instruction)))
+ ep.write_data_at(address+inst_nr, instruction)
+ inst_nr += 1
+
+trash = raw_input("please unplug the power from the EEPORM and press any key to continue")
+
+ep.cleanup()
+
+