Code overwrites program?
lardom
Posts: 1,659
I adapted a method from "Test Propeller Eeprom v0.677". In the last line of the method I replaced the variables with numbers to see if I could follow the formula. The method retrieves values from the transmit window of HyperTerminal.
[HTML]PUB Write | i, temp '' Write individual values to EEPROM
''
'' Prompts user for EEPROM starting address, number of values to be entered and variable
'' size. Then, prompts user for values to store. Each value gets stored in EEPROM
'' locations building from the start address entered by teh user to smaller addresses.
menu.EeParams(@eeAddr, @count, @size)
repeat i from eeAddr - size + 1 to eeAddr - (count * size) + 1 step size
temp := menu.getElement(i)
eeprom.FromRam(@temp.byte[0], @temp.byte[size-1], i)[/HTML]
I wanted to get values from my top object instead of the transmit window of HyperTerminal. My version is below:
[HTML]PUB Wryte(addr, cownt, syze) | i, temp
repeat i from addr - syze + 1 to addr - (cownt * syze) + 1 step syze
temp := Y
Menu.DisplayElement(Y,start) ' I wanted to see if the values were passed
Menu.DisplayElement(Y,count)
Menu.DisplayElement(Y,size)
' eeprom.FromRam(@temp.byte[0], @temp.byte[syze-1], i) ' EXECUTES ONLY ONCE. RESET LEAVES SCREEN BLANK!
Menu.DisplayElement(Y, index + 6) ' This line is here to see if the previous line executed[/HTML]
The object will only display values after a reset if I comment "eeprom.FromRam". The calls to "Menu" are there only to display values. Please help.
[HTML]PUB Write | i, temp '' Write individual values to EEPROM
''
'' Prompts user for EEPROM starting address, number of values to be entered and variable
'' size. Then, prompts user for values to store. Each value gets stored in EEPROM
'' locations building from the start address entered by teh user to smaller addresses.
menu.EeParams(@eeAddr, @count, @size)
repeat i from eeAddr - size + 1 to eeAddr - (count * size) + 1 step size
temp := menu.getElement(i)
eeprom.FromRam(@temp.byte[0], @temp.byte[size-1], i)[/HTML]
I wanted to get values from my top object instead of the transmit window of HyperTerminal. My version is below:
[HTML]PUB Wryte(addr, cownt, syze) | i, temp
repeat i from addr - syze + 1 to addr - (cownt * syze) + 1 step syze
temp := Y
Menu.DisplayElement(Y,start) ' I wanted to see if the values were passed
Menu.DisplayElement(Y,count)
Menu.DisplayElement(Y,size)
' eeprom.FromRam(@temp.byte[0], @temp.byte[syze-1], i) ' EXECUTES ONLY ONCE. RESET LEAVES SCREEN BLANK!
Menu.DisplayElement(Y, index + 6) ' This line is here to see if the previous line executed[/HTML]
The object will only display values after a reset if I comment "eeprom.FromRam". The calls to "Menu" are there only to display values. Please help.
Comments
[HTML]PUB Wryte(addr, cownt, syze) | i, temp
repeat i from addr - syze + 1 to addr - (cownt * syze) + 1 step syze
temp := Y
eeprom.FromRam(@temp.byte[0], @temp.byte[syze-1], i) ' Will not execute 2nd time![/HTML]
size/syze = 1
count/cownt = 1
addr = Y[4], (I think)
value = 7
I'm trying to write "7" to the 4th element of a 5 element byte array then write that to the eeprom. I changed the spellings in the parameter list only so it would compile. "i" and "byte[0]" are puzzling. I could try writing to high memory but that would add to my list of 'unknowns'.
I'm only guessing here, presumably you want to write out the array Y. For a start you should pass the array address @Y{0} and - optionally - fill level (highest index) and element size. Which would then translate to a single call (untested): Can you confirm and/or clarify?
I'm going to try to implement the line of code quoted below and I'll report back.
Quite a few concepts have become clear by studying your explanations and your code. Thanks much!