Clearing ram, but maybe not?
EmptyBit
Posts: 72
Is this·an odd bug I have found in programming the SX48?
I am creating a bit array table(3 bytes x·7 bytes). Each time the loop completes a run to fill the array, I clear it before restarting the fill process. I am using the OR statement to accomplish filling the bits into·this array from data derived elswhere in the code.
The code·goes through the clearing of ram area and all zeros show in the debug screen at the start of· the loop. This is using Guenthers SX48 book example.
The first cycle through the code works fine. As long as the array does not change, the bits are stable. Then comes the problem where the bits do change on subsequent data changes that alter the array. Although I have clear all banks in this area prior to the change and refill, the OR'd value left behind includes the previous value OR'd with the new value within any register of the array that did change. I·do understand·OR'ing is a compound instruction using W as the temp, but a lot of other functions use W before it is used for the OR functions.
The clearing of the ram area·including·the array are both indirectly addressed. No variable storage is in bank 0($10-$1f). Filling the array is also indirectly addressed.
The only previous section to this routine is setting the·Rb,Rc,Rd,Re for their respective modes.·All variables are re-initialized within the routine·which they are used.
So, where is the previous OR'd value coming from, if all ram area, including global and variables·are cleared, but as it should be(for one cycle)·when reset?
Spooky Ram Shadows?
Any ideas for resolving this sure would be a BIG HUGE help.
What·can I do about this?
DC
I am creating a bit array table(3 bytes x·7 bytes). Each time the loop completes a run to fill the array, I clear it before restarting the fill process. I am using the OR statement to accomplish filling the bits into·this array from data derived elswhere in the code.
The code·goes through the clearing of ram area and all zeros show in the debug screen at the start of· the loop. This is using Guenthers SX48 book example.
The first cycle through the code works fine. As long as the array does not change, the bits are stable. Then comes the problem where the bits do change on subsequent data changes that alter the array. Although I have clear all banks in this area prior to the change and refill, the OR'd value left behind includes the previous value OR'd with the new value within any register of the array that did change. I·do understand·OR'ing is a compound instruction using W as the temp, but a lot of other functions use W before it is used for the OR functions.
The clearing of the ram area·including·the array are both indirectly addressed. No variable storage is in bank 0($10-$1f). Filling the array is also indirectly addressed.
The only previous section to this routine is setting the·Rb,Rc,Rd,Re for their respective modes.·All variables are re-initialized within the routine·which they are used.
So, where is the previous OR'd value coming from, if all ram area, including global and variables·are cleared, but as it should be(for one cycle)·when reset?
Spooky Ram Shadows?
Any ideas for resolving this sure would be a BIG HUGE help.
What·can I do about this?
DC
Comments
You will need to post your code. As you describe it, it should work.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
COMING SOON "SD DATA LOGGER" www.sddatalogger.com
"I reject your reality, and substitute my own." Mythbusters
·
These little·SX hoops that are essential will getcha when tired!
Give me COFFEE, so I can keep my eyes open!
It all works as it should!
Bean, Thanks for being there, just in case I need to embarrass myself again with silly self inflicted bugs!
Please feel free to delete this thread so as not to eat up dead space un-neccessarily.
DC