Can anyone help with assembler code to program Flash from within the application. I have used routines from AN3942 and HCS08 reference manual. I have entered sub routines "FlashErase1", "FlashProg1", "DoOnStack", and "SpSub". But I am not sure how to pass the memory address and the data when calling these routines.
Thanks
Bill
已解决! 转到解答。
I don't know about the particular application note but usually address is passed in the HX register and data in the A register.
(You can also have a look at my ASM8 version inside the ZIP archive file code/lib/flash.sub, or here: http://aspisys.com/code/hc08/flash.html to get an idea.)
I don't know about the particular application note but usually address is passed in the HX register and data in the A register.
(You can also have a look at my ASM8 version inside the ZIP archive file code/lib/flash.sub, or here: http://aspisys.com/code/hc08/flash.html to get an idea.)
Tony,
Thanks for the reply. Your 'flash.sub' will take me some time to digest. It looks similar to the App note but more comprehensive.
I tried running mine in CodeWarrior simulator, but it never exits the subroutine running on the stack. I guess this is because the simulator cannot actually simulate the flash memory erase or write. There seams to be some time critical operations (flash clock has limited range) and this probably limits the use of Back Ground Debug operation as well. Any comment?
Bill