![]() |
Re: read/write EEPROM on 18F8520
Quote:
The former: writeEE(0x00,somechar); |
Re: read/write EEPROM on 18F8520
Quote:
But a couple more comments. Make sure you've included eeprom.h, since without the function prototype, the 0x00 may push a byte on the stack for the address parameter. Also, note that doing the write takes time, several milliseconds. If you do a writeEE immediately followed by readEE it won't work. If you'd like to send a bigger code sample I'll be happy to look at it. Bill |
Re: read/write EEPROM on 18F8520
Quote:
|
Re: read/write EEPROM on 18F8520
I used the code that Wizard posted in the second page and im having a little problem ... i added the eeprom.c and eeprom.h ... and included them ... this is my code right now :
Code:
int i=0;Code:
int i=0; |
Re: read/write EEPROM on 18F8520
Quote:
Code:
writeEE(0x00, 23 );Code:
processEEqueue();-Norm |
Re: read/write EEPROM on 18F8520
A HUGE THANKS! to Random Dude and Wizard of AZ for this code. It works great, and it saved me HOURS, nay, DAYS of work. And I really needed it. I bet a lot of people do.
-Norm |
Re: read/write EEPROM on 18F8520
Wow... I just wanna say thank you for including that little part about the processEEqueue(); I know from experience what happens when you don't include that little bit of code lol.... my edubot went in circles randomly haha. Thanks for the nifty little bit of code. :D
|
Re: read/write EEPROM on 18F8520
Glad the code is of use to some teams. And sorry I didn't respond sooner. I actually went 24+ hours w/o reading email.
The "23" as a parameter will have caused a problem. That causes a pointer (address) to the string to be passed, not even close to what you want. And the first byte of the address was probably a zero, resulting in writing zero to that EE address. Make sure to use #include "eeprom.h" which would have caught that mistake, since the compiler would have know that an unsigned char should be passed and you passed a pointer to char. If you're going to write just one byte per 26 ms loop, you actually don't need to call processEEQueue, since writeEE itself calls it. Only if you call writeEE multiple times in quick succession (in a single loop) should you have to call processEEQueue. In your example, since you called writeEE in one loop then readEE in subsequent loops, except for the issue with "23" it should have worked. Bill |
Re: read/write EEPROM on 18F8520
Are you guys using EEPROM for CopyCat or other purposes?
|
Re: read/write EEPROM on 18F8520
Quote:
Second, we have an 8 bit code that indicates how we want to run autonomous mode in the upcoming game, and an OI interface for setting it. This mode byte gets stored in EEPROM so we can power down after setting it but still remember run the correct autonomous mode in the game. Last year we had a program that would save driver inputs to EEPROM during a driver period and play it back autonomously, but didn't rewrite that one this year. Bill |
| All times are GMT -5. The time now is 21:47. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi