12.07.2015 Views

Electromechanical Timer Replacement - 320Volt

Electromechanical Timer Replacement - 320Volt

Electromechanical Timer Replacement - 320Volt

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Electromechanical</strong> <strong>Timer</strong> <strong>Replacement</strong>call tx ;and transmit it;rbyte call rx ;read 1 byte from devicemovf datai,w ;copy byte into registermovwf IND0 ; pointed to by FSRincf FSR ;increment the FSRdecfsz bcount ;are all 6 bytes read?goto lowack ;no, send low ack and do anotherbsf eeprom,do ;yes, send high ack bitcall bitOut ;to stop transmissioncall bStop ;and send a stop bitvgoto infLoop ;all done - go to the main program looplowack bcf eeprom,do ;send low ack bitcall bitOut ;to continue transmissiongoto rbyte ;and read another byte;************************************************;* Start of main program loop *;************************************************infLoop;handle the timerHandle<strong>Timer</strong>movf RTCC,w ;get the current RTCC counter valuemovwf temp ; and temporarily save itsubwf oldRTCC,w ;has the RTCCSLT; rolled over?goto decRoll ;if yes - decrement the rollover countergoto tmrEnd ;else goto tmrEnddecRolldecf dbncTmr ;decrement the debounce timermovlw 1 ;subtract 1subwf rollL ; from rollL (low byte)SGE;skip if borrow did not occursubwf rollH ;otherwise, subtract 1 from rollH (high byte)movlw 0 ;is rolloveriorwf rollL,w ; counterSNE ; =iorwf rollH,w ; 0?SEQ ;goto tmrEnd ;if no - goto tmrEndcall InitRollOver ;re-initialize rollover counter;handle .1 second target counter if not in an event counter modemovlw COUNTR ;are we in ansubwf mode,w ; event counterSLT; mode?goto tmrEnd ;if yes - goto tmrEndcall IsTgtZero ;otherwise, is target counter = 0?SEQ;if it is, skipcall DecrTgt ;otherwise, decrement the target countertmrEndmovf temp,w ;update old RTCC valuemovwf oldRTCC ; from temp register;handle inputshandleInbcf flags,EDGON ;reset the input edge flag; handle debouncing of the inputsclrw;is debounce timeriorwf dbncTmr,w ; = 0?SEQ;if yes, skip next instructiongoto doSequencer ;otherwise, go to doSequencer© 1997 Microchip Technology Inc. DS40160A/1_005B-page 21

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!