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>;********************************************************************start:clrfGPIOclrfflagbsf STATUS,RP0 ;switch to Bank 1movlw B'11000101'movwf OPTION_REG ;tmr0 scaled 64:1movlw B'00000100' ;GPIO 0 & 1 A/D; 3, 4, & 5 digitalmovwf ADCON1movlw B'11101111' ;GPIO 5 output; all others inputmovwf TRISIOclrfPIE1callLAST_LOCATEmovwf OSCCALbcf STATUS,RP0 ;switch back to Bank 0movlw B'01000001' ;select channel 0 and turn on A/Dmovwf ADCON0btfsc GPIO,3callInitial_setmovlw -D'125' ;count up 125 to rollovermovwf TMR0movlw B'10101000' ;enable timer interruptmovwf INTCON;*********************************************************************; Main program loop;*********************************************************************top:gototop;*********************************************************************; Normally energized initialization routine;*********************************************************************Initial_set:bsfbsfbsfbsfreturnGPIO,3flag,ACTUALflag,COMMANDADCON0,3;*********************************************************************; A/D Conversion Subroutine; This subroutine assumes the A/D channel has already been; selected and stabilized and that the output destination is; specified in FSR. It waits for the A/D to be complete before; returning, not using the A/D interrupt.;*********************************************************************Adloop:adwait:bsfbtfssgotobcfreturnADCON0,2PIR1,6adwaitPIR1,6;*********************************************************************; <strong>Timer</strong> interrupt routine;*********************************************************************© 1997 Microchip Technology Inc. DS40160A/1_003-page 3

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

Saved successfully!

Ooh no, something went wrong!