This has got me stumped....
If I comment out everything in red and uncomment everything in green, the code works, in that at 14:00 hrs (Counter1 = 840) the case statement changes from NIGHT to DAWN and the brightness percentage increases and the LEDs start to brighten. If I uncomment everything in red and comment out everything in green, the case changes from NIGHT to DAWN at 14:00 hrs, Counter1 = 840 but the brightness remains at zero and the LEDs remain off.Code:'******************************************************************************* 'clock routine 'ClockLoop: IF intcon.2=0 THEN ClockLoop 'Poll for TMRO overflow 'INTCON.2=0 'Clear TMRO overflow flag 'HzTimer=HzTimer-$1000 'decrement timer count 'IF HzTimer < $1000 THEN 'IF Col=10 THEN 'update time' 'SS=SS+1 'IF SS=60 THEN ' minute 'SS=0 'MM=MM+1 'IF MM=60 THEN ' hour 'MM=0 'HH=HH+1 'IF HH=24 THEN HH=0 'ENDIF 'counter1 = (HH*60)+MM 'ENDIF 'ENDIF 'Col=Col+1 'HzTimer=HzTimer+$7A12 'Add 0.5 seconds to count 'ELSE 'ENDIF 'if Col=11 then 'Col=1 'endif 'LCDOut $FE,$D4,#HH DIG 1,#HH DIG 0,":",#MM DIG 1,#MM DIG 0 I2CREAD SDApin,SCLpin,$D0,$01,[RTCMin,RTCHour] ; read DS1307 chip timeH=(RTCHour>>4) 'convert the BCD format of the hours register and store in variable timeH timeH=(timeH &$03)*10 timeH=timeH+(RTCHour&$0F) timeM=(RTCMin>>4) timeM=(timeM &$07)*10 timeM=timeM+(RTCMin&$0F) 'convert the BCD format of the mins register and store in variable timeM Counter1 = (TimeH *60)+ TimeM LCDOut $FE,$D4,#TimeH DIG 1,#TimeH DIG 0,":",#TimeM DIG 1,#TimeM DIG 0
Like I said, I could understand it if the brightness changed on the LCD but the LEDs remained off as this could point to a port config issue. But for it simply to ignore the values in the case statement and not work at all Its baffling and beyond me !




Bookmarks