## This file write different programms to the EEPROM AT28C ## programm start at 0x00 import test_prog import fibonacci import eeprom_pi as ep import sys prog = None if len(sys.argv) == 2: if sys.argv[1] == "test": prog = test_prog.prog elif sys.argv[1] == "fibonacci": prog = fibonacci.prog if prog == None: print("error: please specify a valid programm.") print("valid programms are: test, fibonacci") 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()