Hello Everyone,
I have a question if anyone can help, on how to use the Data statement for the 18F452. I want to be able to load default values for some of my variables that will be set when the chip is initially programmed but will only execute once when the program is run. I've been using a pushbutton to set (save) the variables in an IF...THEN statement after I finish programming a new code segment and when the program is first run which is easier than manually setting each one of them from an initial value of 255 but it still becomes a hassle after frequent re-programming. According to the manual I should be able to use, as an example:
DATA @11, 72
to store a value of 72 @ location 11 of my eeprom data byte but it doesn't work? Also what would the set-up be for my word variable MinutesSet? I have my word variables set-up as follows:
Hour VAR word
Minute VAR word
EEPROMData14 var word
MinutesSet VAR EEPROMData14 ' alias
Read 14, EEPROMData14.byte0 ' Load MinutesSet variable from EEPROM
Read 15, EEPROMData14.byte1
'do the math for our display here..................
Hour = MinutesSet / 60 : Minute = MinutesSet // 60
LCDOut $fe, 1, "Hi Temp On Time "
LCDOut $fe, $c0, "Hr = ",DEC Hour, " Min = ", DEC Minute
I'd like to use DATA to load a value of 45 minutes to display to my Lcd as a factory default setting for the MinutesSet variable. This set-up above works good to save using the READ & WRITE commands. But the DATA statements below don't work.
'DATA @14,45
'DATA @15,0
Can anyone suggest what I'm doing wrong here?
Thanks
jessey
Bookmarks