EEPROM help please.
Filip S
Posts: 54
I've been trying to use the I2C LowLevel object to interface with the main EEPROM on the demo board, so that I could save some data until the next time the propeller boots up. The problem is that i don't get it to work with that object, when i call i2cstart , it stops execution. And then when i tried to·send the data (without calling i2cstart)·0,1,1,0 and then recived the next eight bits, i got the result $FF.·Can someone please·help me?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my game page: http://maze3d.no-ip.org (Swedish only, sorry.)
Send me a message if you want me to translate it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my game page: http://maze3d.no-ip.org (Swedish only, sorry.)
Send me a message if you want me to translate it.
Comments
For the demo board's you have to pass "drivelines" as true when you initialize the i2cobject, as the board does not have a pull'up on the i2c clock line. I.e. (from the i2cDemoApp.spin)
' setup i2cobject
i2cObject.Init(i2cSDA, i2cSCL, true)
james
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my game page: http://maze3d.no-ip.org (Swedish only, sorry.)
If not, please tell me what's wrong. I'm quite sure that byte 1 in the EEPROM isn't $FF.
obj
x : "i2cObject"
pub main | y
x.start
x.init(29,28,true)
y := x.readlocation(0,1,16,8)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my game page: http://maze3d.no-ip.org (Swedish only, sorry.)
You're not passing the EEPROM address. The format of the command (for eeproms)·is:
so for your program and an EEPROM on the default address of 160 / %1010_0000 / A0 (decimal, bin, hex),
would return the byte·at address·1 in the EEPROM.
Have a look at the "i2cDemoApp" in the i2cObject library - it has an EEPROM_DEMO function which shows this in action.
James
James
Post Edited (Javalin) : 11/20/2006 8:53:40 PM GMT
It seems like it works now.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my game page: http://maze3d.no-ip.org (Swedish only, sorry.)
I use the .writelocation(%1010_0000,1,"Z",16,8) (after initialization)·and I think I'm doing as in the example.
It doesn't seem like it's working there either, pleas help me.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my game page: http://maze3d.no-ip.org (Swedish only, sorry.)
Try .writelocation(%1010_0000,1,90,16,8)
90 is the ASCII code for "Z".
Cannot remember how (if) the propeller changes ASCII-DEC. Anybody?
James
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my game page: http://maze3d.no-ip.org (Swedish only, sorry.)
Well all you should need to do is change the counters from 0..10 to 0..1000 on the EEPROM_DEMO function and that works to clear the EEPROM
James
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my game page: http://maze3d.no-ip.org (Swedish only, sorry.)
Watch the function SaveEEPROM, there it first checks the eeprom if the program is loaded into it, if so it saves the highscorelist to the right locations in the eeprom so that theyr'e loaded by the prop. at startup. Use a vga and a keyboard to run the game once (so you get something in the highscore) and then select Save Highscore.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my game page: http://maze3d.no-ip.org (Swedish only, sorry.)
Had a quick look - but I'd simplify it if I were you. Use a new program and the i2cObject, modify the eeprom_demo to prototype the save code, then build it into your program when you know thats working.
James
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my game page: http://maze3d.no-ip.org (Swedish only, sorry.)