I'm convinced that I am missing something, but why can't you just save them as follows:
For X = 0 to 3
Write X,Array1[X]
Next X
For X = 4 to 7
Write X,Array2[X-4]
NextX
...
I'm convinced that I am missing something, but why can't you just save them as follows:
For X = 0 to 3
Write X,Array1[X]
Next X
For X = 4 to 7
Write X,Array2[X-4]
NextX
...
Charles Linquist
Hi Charles,
Sorry, please bear with me as this is the first time I've experimented with saving data other than when programming mode.
I want to save the following to the PIC once the user has set them so that in the event of a power failure they are remembered and the user doesn't have to re-enter the data.
However as the program writes data to the memory at the time of programming and as part of the RTC settings (data@ 0,0 and data@150 respectively) I'm not sure what value to place before the colon after the word statement for each of the above. I don't want to corrupt the data stored at those data locations.Code:save: Lcdout $FE,2 LCDOUT $FE,$80,"Saving Settings" for fn= 0 to 3 write ,lightsetHR[fn] write ,lightsetMN[fn] write ,lightoffHR[fn] write ,lightoffMN[fn] write ,droptemp[fn] write ,normtemp[fn] write ,StartHour[fn] write ,StartMin[fn] write ,StopHour[fn] write ,StopMin[fn] next fn pause 150 goto mainmenu
For example - 0x50 address in that table appears blank (FF) - so could I use
Or whatever decimal 0x50 would be ???Code:write 0x50 ,lightsetHR[fn]
Hope that's clear ?
Oh and I'm using DT's interrupts... would I need to use DEFINE WRITE_INT 1 withing that sub-routine ?
Last edited by malc-c; - 1st August 2010 at 19:40. Reason: had an additional thought !
Yes, you can use 0x50 if you want to. There is nothing written there. Since 0x50h = 80 you can use something like this
I haven't tested this code so I don't know if the (10*fn + 8x) works in the WRITE command. If it doesn't then try something like thisCode:for fn= 0 to 3 write (10*fn + 80),lightsetHR[fn] write (10*fn + 81),lightsetMN[fn] write (10*fn + 82),lightoffHR[fn] write (10*fn + 83),lightoffMN[fn] write (10*fn + 84),droptemp[fn] write (10*fn + 85),normtemp[fn] write (10*fn + 86),StartHour[fn] write (10*fn + 87),StartMin[fn] write (10*fn + 88),StopHour[fn] write (10*fn + 89),StopMin[fn] next fn
Code:for fn= 0 to 3 Mem_address = (10*fn) + 80 write Mem_Address,lightsetHR[fn] Mem_address = (10*fn) + 81 write Mem_address,lightsetMN[fn] Mem_address = (10*fn) + 82 write Mem_address,lightoffHR[fn] Mem_address = (10*fn) + 83 write Mem_address,lightoffMN[fn] Mem_address = (10*fn) + 84 write Mem_address,droptemp[fn] Mem_address = (10*fn) + 85 write Mem_address,normtemp[fn] Mem_address = (10*fn) + 86 write Mem_address,StartHour[fn] Mem_address = (10*fn) + 87 write Mem_address,StartMin[fn] Mem_address = (10*fn) + 88 write Mem_address,StopHour[fn] Mem_address = (10*fn) + 89 write Mem_address,StopMin[fn] next fn
You need to disable the interrupts for the WRITE command to work. I read somewhere in this forum that the WRITE_INT is only for WRITECODE, but you might want to try it.
Robert
"No one is completely worthless. They can always serve as a bad example."
Anonymous
Robert,
Thanks for the assistance. I'll give it a try and no doubt will be back with some feedback
I have an easyPIC5 development board and that is part of the software that squirts the HEX to the PIC - http://www.mikroe.com/eng/products/v...opment-system/
Not sure if the PicFLASH2 software will work with other programmers, but it will work with one of their other products http://www.mikroe.com/eng/products/view/392/picflash2/
The software is a free download
Bookmarks