![]() |
new to EEPROM
hey everyone....i'm going to be the team programmer next year. so far i can do the major robot functions (driving, solenoids, etc) and i'm working on gyro code as well as camera code. i have a few questions about the EEPROM. i have kevin's code, and i understand the concept and all, but what actually gets written to the eeprom when i use the write functions? cas i assign a variable that gest written? can i store a series of values to one of the 16 slots (i think its 16...)? or, could i even store a function? and for the camera code, i know how to assign the RGB values to track in the header file, but i also know that the code can get values from the eeprom...how do i save the values there? i noticed that the eeprom_write function in the code saves an unsigned character....so i can only save one byte of data per slot? i'm confused about all of this...any answers would be helpful :)
Thanks:) ~Tseres |
Re: new to EEPROM
Well, first off, here's a listing I wrote a while ago of hardware in the 18F series processors.
There are 1024 (what a coincidence! :] ) bytes of EEPROM right on board the processor. One unsigned character is one byte of memory... personally, I don't use kevin's driver, I have my own, but, in concept all you are doing is writing and reading bytes to/from a non volatile memory... just remember to hold on to your addresses! most likely what kevin has done is divided the 1024 bytes of memory into 16, 64-byte 'chunks'... to help with organization of your memory. If you need more specific to kevin's code help, for the time being somebody else will have to help! (i'll read up on kevin's eeprom code when i get a chance though, just for the sake of knowing :rolleyes: ) -q |
Re: new to EEPROM
thanks...that really does help clarify things...also...is it possible to see a copy of your eeprom code? is it really complex?.....
ya.... |
Re: new to EEPROM
Ohhh....So wait, how do I store autonomous data on EEPROM?
|
Re: new to EEPROM
if you have say 3 motors and you want to try a simple example, youc an store the value to send to the victors during autonomous. Then make a timer so it reads and assigns all 3 values every 1 sec or what ever time intervale you want.
as an example: Code:
EEPROM Contents:-John |
Re: new to EEPROM
:confused:
|
Re: new to EEPROM
Quote:
It might help if you consider EEPROM to be the equivalent of a data file on disk. You can make changes to it which will not disappear when the RC is powered down. Kevin's camera communication and servo tracking code uses EEPROM to store configuration values. The TechnoKats this year adapted and extended the idea to hold PID calibrations for the drivebase and arm, as well as the desired pan and tilt values for driving to the target light. Instead of changing #defines in the code, recompiling, and downloading every time we want to modify a value, we just use a menu-driven system to change the numbers directly on the robot. |
Re: new to EEPROM
Quote:
|
Re: new to EEPROM
As everyone else has said, you have 1024 bytes of EEPROM. What they haven't said is how to use it...;)
When you have Kevin Watson's EEPROM code installed, you call EEPROM_Write() with the address you want to write to (this needs to be between 0 and 1023, inclusive) and the value you want to write. Later on, call EEPROM_Read() with the address you wrote to, and it will return the value saved in EEPROM. If you call EEPROM_Write(0,1); (which writes 1 to the first byte, byte 0, in EEPROM) then call EEPROM_Read(0); it will return 1. This lasts even if the controller loses power--if you called EEPROM_Write(x,y), and that's the last byte you wrote to that address in EEPROM, EEPROM_Read(x) will always return y. The controller doesn't care where you save data in the EEPROM; it is entirely up to you. I suggest making a quick spreadsheet listing which address is what. The best part about EEPROM is that all of it is at your disposal. The default code does not touch EEPROM at all. You can use every byte, 0 to 1023, for whatever you want. You could even make it a 1KB flash drive, if you want (but I'm not sure if you could find a good enough MP3 encoder to get your music compressed that small...:D ). If you need specific code, I can probably supply it, but you learn best when you figure it out yourself--try it! Happy coding JBot EDIT: If you want a menu-driven system, you will need to build it yourself. Check into some more of Kevin's code--there is an example of a terminal in Kevin's "Bells and Whistles" camera code. You will need his serial driver (no point in writing that yourself...it's a lot of gross low-level garbage) at the very least. Again, I'll help you with the specifics if you really can't figure it out, but I'd like you to take the plunge yourself. |
Re: new to EEPROM
thanks. ya..i figured out how the camera tracking values use the eeprom, now i'll just have to play around with it. maybe a menu driven system? or maybe autonomous stuff....
|
Re: new to EEPROM
:D Yep, thank you all and thank you tesers for asking
|
Re: new to EEPROM
Quote:
I have an FRC and vex version. Brian team 1675 k9wis@yahoo.com |
Re: new to EEPROM
I'd like to see that Autoflex program of yours. I've sent you a message.
Quote:
Of course, it's much better than nothing(nothing being doing nothing or driving by dead reckoning). Well, I received the code. It's really neat for rookie teams, I must agree. Good job. So, now that I understand a bit about EEPROM, I understand that I don't need to use that function I did to save points of distances from the rack, I can use the EEPROM. So lets say if I want to save a few points of distances while I'm on manual mode, I need to assign a button to call for EEPROM_Write(); and advance the address number in order to assign another point? |
Re: new to EEPROM
Quote:
Quote:
But its not a substitute for a well thought out autonomous routine. This year we used the camera to home in on the lights. Quote:
Good Luck and feel free to experiment. Brian |
Re: new to EEPROM
Thank you very much! I'll be trying your code sometimes. :D
|
| All times are GMT -5. The time now is 00:25. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi