Confused !
I loaded a version of the code that contained hard coded values for the light on times. EG 14:00 is 840 minutes after midnight. I commented out the hard coded values and enterd the data statements etc so this is what I had
Code:
Blue_on_Time var word 'stores the blue on time as a digit in minutes, eg 14:00hrs = 840
I then added the data statement
Code:
data @0
data 00 'Blue fade IN duration hours
data 30 'Blue fade IN duration minutes
data 00 'Blues fade OUT duration hours
data 30 'Blue fade OUT duration minutes
data 00 'Whites fade IN duration hours
data 30 'Whites Fade IN duration MINS
data 00 'Whites Fade OUT duration HOURS
data 30 'Whites Fade OUT duration MINS
data 255 'Blue MAX Intensity %
data 255 'Whites MAX Intensity %
data 840
I then added the read statement
Code:
read 10,Blue_on_time
I then added the line so I could see what values for Blue on time I was getting
Code:
lcdout $FE,$D4+11,dec Blue_on_Time
When that was complied and loaded, the program gave a value of 74 when first run, and obviously the condition was not matched and the blue LEDs remained off. If I then go into the menu option to set the on time to 14:00 the LCD correctly displays 840 as the LCD (simplified part of the code here)
Code:
Lighton:
Lcdout $FE,2
LCDOUT $FE,$80,"Set On Time For "
IF H_butt = 0 THEN GOSUB delHours
IF M_butt = 0 THEN GOSUB delMinutes
lightsetHR[fn]=Hours
lightsetMN[fn]=Minutes
if viv >=2 then viv =2
if viv= 1 then LCDOUT $FE,$C0,"Blue Leds "
if viv= 2 then LCDOUT $FE,$C0,"white Leds "
lcdout $FE,$94,#lightsetHR[fn] DIG 1,#lightsetHR[fn] DIG 0,":",#lightsetMN[fn] DIG 1,#lightsetMN[fn] DIG 0
Blue_on_Time = (lightsetHR[0]*60)+lightsetMN[0]
White_on_Time = (lightsetHR[1]*60)+lightsetMN[1]
write 10,Blue_on_Time
If then add the high / low byte to the option in the read and write statements I get the Illegal character error again.
The other thing that is now not happening is that if I remove the highbyte / lowbyte from the read / write commands program the chip and then manually set the on time the LCD displays 840 as the value, but when the counter value is reached (ie the clock turns to 14:00) there is no change in state of the LEDs. So its not matching the correct value for the word variable. Could this be due I'm comparing the decimal value for the variable, when in real terms it's still in hex decimal or something ?
My other option would be to use the lightsetHR[0] and lightsetMN[0] as the data values saved and then try and let the program do the conversion Blue_on_Time = (lightsetHR[0]*60)+lightsetMN[0].
Update: I've tried the above and I still can't get the case to change from off to on
Code:
data @0
data 00 'Blue fade IN duration hours
data 30 'Blue fade IN duration minutes
data 00 'Blues fade OUT duration hours
data 30 'Blue fade OUT duration minutes
data 00 'Whites fade IN duration hours
data 30 'Whites Fade IN duration MINS
data 00 'Whites Fade OUT duration HOURS
data 30 'Whites Fade OUT duration MINS
data 255 'Blue MAX Intensity %
data 255 'Whites MAX Intensity %
data 14
data 00
And then have this in the read routine
Code:
Read 10,lightsetHR[0]
Read 11,lightsetMN[0]
This compiled Ok and when loaded the LCD correctly displayed 840 as the value of Blue_on_time, but when the clock turned over from 13:59 to 14:00 the case still remains the same and the LED failed to light.
If I comment out the read write and data lines, and code the value blue_on_time=840 it works !!!! - obviously I would like to be able to change the on and off times of the two channels (white and blue) rather than had coded.
Bookmarks