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>;********************************;* 24C04 EEPROM read routines *;* Modified versions of 24CXX *;* routines from Microchip *;* AN567 *;********************************;**************************************************************; Start Bit Subroutine *; this routine generates a start bit *; (Low going data line while clock is high) *;**************************************************************bStartbsf GPIO,SDA ;make sure data is highmovlw SDAOUTtris GPIO ;set data and clock lines for outputbcf GPIO,SCL ;make sure clock is lownopbsf GPIO,SCL ;set clock highcall eeDelay ;wait for a few cyclesbcf GPIO,SDA ;data line goes low during; high clock for start bitcall eeDelay ;wait for a few cyclesbcf GPIO,SCL ;start clock traincall eeDelay ;wait for a few cyclesretlw 0 ;return from subroutine;************************************************************; Stop Bit Subroutine *; This routine generates a stop bit *; (High going data line while clock is high) *;************************************************************bStopmovlw SDAOUT ;tris GPIO ;set data/clock lines as outputsbcf GPIO,SDA ;make sure data line is highcall eeDelay ;wait for a few cyclesbsf GPIO,SCL ;set clock highcall eeDelay ;wait for a few cyclesbsf GPIO,SDA ;data goes high while clock high;for stop bitcall eeDelay ;wait for a few cyclesbcf GPIO,SCL ;set clock low againcall eeDelay ;wait for a few cyclesretlw 0 ;return from subroutine;*************************************************************; BITOUT routine takes one bit of data in 'do' and *; transmits it to the serial EE device *;*************************************************************bitOutmovlw SDAOUT ;set data, clock as outputstris GPIO ;btfss eeprom,do ;check for stat of data bit to xmitgoto bitlow ;bsf GPIO,SDA ;set data line highgoto clkout ;go toggle the clockbitlow bcf GPIO,SDA ;output a low bitclkout bsf GPIO,SCL ;set clock line highnop;wait a few cyclesnopbcf GPIO,SCL ;return clock line lowretlw 0 ;return from subroutine© 1997 Microchip Technology Inc. DS40160A/1_005B-page 11

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

Saved successfully!

Ooh no, something went wrong!