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>retlw b'01111111' ;8retlw b'01101111' ;9retlw b'00000000' ;blankretlw b'01000000' ;hours/minutes separatorretlw b'01000000' ;minutes/seconds separatorretlw b'00001000' ;cursor;Time correction table;In correction mode the timer outputs 250 kHz signal on pin LCD_clock;This may be tested and a new correction value be programmed;If bit is zeroed then the next value is fetched (because 1’s may be programmed many times)TimeCorrectionTableaddwfPCL,F;bit 1 = Correction mode;bit 1 = Read this value;bits Time correction value; 0 = Normal timer operation; 0 = Skip this valueretlw b'11000111' ; Set time correction value to 7retlwb'11111111'retlwb'11111111'retlwb'11111111'retlwb'11111111'retlwb'11111111'retlwb'11111111'retlwb'11111111'retlwb'11111111'retlwb'11111111'; ------------ S U B R O U T I N E S ----------;Send timer data from lowest digit to the highest including separators to AY0438ShowTimebcf <strong>Timer</strong>Status,SetTimeFlag ;reset SetTimeFlag bitmovlw0x0amovwf FSR ;get first digit (seconds low)ShowNextDigit:movfINDF,WcallDecodeValuebtfsc <strong>Timer</strong>Status,SleepFlag ;If Sleep mode activatedmovlw 0x10 ;then set display blankcallShowDigitincf FSR,F ;get next digitbtfss FSR,4 ;terminate if the 4th bit is setgoto ShowNextDigit ;(You should not move timer data in RAMreturn;for this function to work properly);Transmit one digit data to AY0438 (see PIC16/17 Microcontroller Data Book 95/96 AY0438 page 4-6);Load input should be tied highShowDigitmovwf Digit ;Save current digit valuemovlw0x08movwf Count ;Set Count to 8 (8 segment LCD)NextBit:bcf GPIO,LCD_Data ;clear Data bitrrfDigit,Fbtfsc STATUS,C ;If bit is clear then skipbsf GPIO,LCD_Data ;Else set Data bitbsf GPIO,LCD_Clock ;Toggle Clock, the data to be read by AY0438bcfGPIO,LCD_Clockdecfsz Count,FgotoNextBitreturn;Get current time from TMR0GetTimeDS40160A/1_002-page 4© 1997 Microchip Technology Inc.

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

Saved successfully!

Ooh no, something went wrong!