snuff28
- 8th July 2012, 05:45
I have now finished my project and it has about 3000 lines of code, probably not written the best way so I am trying to condense some code to pack more features in. Listed below is something I believe could be condensed to save some space.
Lights var PortB.1
LightStatus VAR BYTE
SYMBOL WStatus = LightStatus.0
IF RTCHour = SetlightOnHour THEN
IF RTCMin = SetlightOnMin THEN
HIGH Lights
WStatus = Lights
WRITE 95, WStatus
ENDIF
ENDIF
IF RTCHour = SetlightOffHour THEN
IF RTCMin = SetlightOffMin THEN
LOW Lights
WStatus = Lights
WRITE 95, WStatus
ENDIF
ENDIF
I want to turn a light on and off at a certain time, then write the value of that port.X to the eeprom to save it incase of power failure but only want to write to the eeprom whenever the port changes state.
Hope someone can point me in the right direction.
Thanks!
Lights var PortB.1
LightStatus VAR BYTE
SYMBOL WStatus = LightStatus.0
IF RTCHour = SetlightOnHour THEN
IF RTCMin = SetlightOnMin THEN
HIGH Lights
WStatus = Lights
WRITE 95, WStatus
ENDIF
ENDIF
IF RTCHour = SetlightOffHour THEN
IF RTCMin = SetlightOffMin THEN
LOW Lights
WStatus = Lights
WRITE 95, WStatus
ENDIF
ENDIF
I want to turn a light on and off at a certain time, then write the value of that port.X to the eeprom to save it incase of power failure but only want to write to the eeprom whenever the port changes state.
Hope someone can point me in the right direction.
Thanks!