EPROM Write During Runtime
Shawna
Posts: 508
Hey guys, I am not sure how to ask this or even search for it. The program below is a mock program, it doesn't do anything. When the prop boots up it loads 40 into KP, 50 into KI and 600 into KD. I am going to set up a routine so that I can change these values during runtime with push buttons. How do I save these values so I don't have to change them again when the Prop reboots? I do not want to have to reprogram the prop ever time I want to change these values. Do I need to use a DAT section to do this? If I use a DAT section, how do I save the changes made so that when the prop reboots the values will carry over?
Thanks
Shawn
CON _clkmode = xtal1 + pll16x 'Standard clock mode * crystal frequency = 80 MHz _xinfreq = 5_000_000 Var Long KP Long KI Long KD OBJ PUB Main Initiate_Variables '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Pub Initiate_Variables KP := 40 KI := 50 KD := 600 '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Thanks
Shawn
Comments
I played with the object and got it to work. I have a couple question though.
1) Is there a way to use this object and rewrite the eprom location where KP KI and KD where originally saved? With this object it looks like you have to save it to the top end of the eprom and hope it doesn't overwrite any of your code.
2) I am not real good at reading data sheets, is the max address of the 24LC256 32,000? I came up with 32,000 because every location is 8 bits(1Byte) and there is 256Kb's. 256K / 8 = 32,000.
3) Assuming that question #2 is correct, does this mean if I store 50 Longs at the top of the eprom I could start at location 31,800? 50 Longs * 4 Bytes per Long = 200 Bytes. 32,000 - 200 = 31,800.
Thanks
Shawn
In the propeller spin tool under view info why does the eprom address go to 7FFF (32,767)? 32,767 * 8 = 262,136Kb's
I just looked at the 24LC256 data sheet again and it says its roll over address is also 7FFF. Why does the data sheet say the eprom has 256Kb memory if it really has 262Kb and some change?
Just trying to learn.
Shawn