6. Ìîðòîí Äæ. Ìèêðîêîíòðîëëåðû ÀVR. Ââîäíûé êóðñ /Ïåð. ñ àíãë. – Ì., Äîäýêà –ÕÕ1, 2006 – 272ñ.

7.Òåõíè÷åñêàÿ äîêóìåíòàöèÿ íà ìèêðîêîíòðîëëåðû AT89C2051 ôèðìû «Atmel». ÎÎÎ «Ìèêðî -×èï», Ìîñêâà, 2002.-184 ñ.


Ïðèëîæåíèå À

 

Ëèñòèíã ïðîãðàììû è îáúåêòíûé ôàéë

; ×ÀÑÛ-ÒÅÐÌÎÌÅÒÐ-ÂÎËÜÒÌÅÒÐ ÄËß ÀÂÒÎÌÎÁÈËß.

 ÐÀÇÐÀÁÎÒÀË ÄÅÐÊÀ×

; ÏÐÎÃÐÀÌÌÀ = ABTO.ASM

; ÂÅÐÑÈß: 20-01-07.

; ÀÑÑÅÌÁËÅÐ È ÎÒËÀÄ×ÈÊ: MPLAB IDE, ÂÅÐÑÈß: 5.70.40.

LISTP=16F676

 #INCLUDE P16F676.INC

 __CONFIG 31D0H

;==============================================

; ÈÑÏÎËÜÇÓÅÒÑß ÊÂÀÐÖ ×ÀÑÒÎÒÎÉ 32768 ÃÖ.

; ÊÎÝÔÔÈÖÈÅÍÒ ÄÅËÅÍÈß ÏÐÅÄÄÅËÈÒÅËß ÐÀÂÅÍ 32, ×ÒÎ ÂÌÅÑÒÅ

; Ñ TMR0 (256) È ÖÈÊËÎÌ, ÐÀÂÍÛÌ 4 ÒÀÊÒÀÌ

; ÄÀÅÒ ÍÀ ÂÛÕÎÄÅ 1 ÑÅÊÓÍÄÓ (4õ32õ256=32768).

;==============================================

; RA1 - ÐÅÆÈÌ - ÓÑÒÀÍÎÂÊÀ, RA2 - ÐÀÇÐßÄ - ÏÓÑÊ,

; RA3 - ÂÛÕÎÄ ÈÇËÓ×ÀÒÅËß,

; RC5 - LOAD, RC3 - DIN,

; RC4 - DCLK

;===========================================

CBLOCK H'20'

;===========================================

; ÎÏÐÅÄÅËÅÍÈÅ ÐÅÃÈÑÒÐÎÂ ÂÐÅÌÅÍÈ.

;===========================================

HOU;×ÀÑÛ ÄÂÎÈ×ÍÛÅ.

CL;ÅÄÈÍÈÖÛ ÑÅÊÓÍÄ ×ÀÑÎÂ.

CH;ÄÅÑßÒÊÈ ÑÅÊÓÍÄ.

ML;ÅÄÈÍÈÖÛ ÌÈÍÓÒ.

MH;ÄÅÑßÒÊÈ ÌÈÍÓÒ.

HL;ÅÄÈÍÈÖÛ ×ÀÑÎÂ.

HH;ÄÅÑßÒÊÈ ×ÀÑÎÂ.

TCL;ÄËß ÒÀÉÌÅÐÀ.

TCH;

TML;

TMH;

THL;

THH;

;===============================================

; ÐÅÃÈÑÒÐÛ ÄËß ÎÐÃÀÍÈÇÀÖÈÈ ÈÍÄÈÊÀÖÈÈ.

;===============================================

ZPT;ÐÅÃÈÑÒÐ ÇÀÏßÒÎÉ.

TZPT;ÇÀÏßÒÀß ÄËß ÂÛÂÎÄÀ ÍÀ ÈÍÄÈÊÀÖÈÞ.

COUZ;Ñ×ÅÒ×ÈÊ ÂÛÂÎÄÀ ÇÀÏßÒÛÕ.

COU;Ñ×ÅÒ×ÈÊ ÂÛÂÎÄÀ ÁÈÒ.

KYPC;ÂÛÁÎÐ ÐÀÇÐßÄÀ ÓÑÒÀÍÎÂÊÈ.

KYPCI;ÈÍÄÈÊÀÖÈÈ.

PEID;ÐÅÆÈÌÀ ÈÍÄÈÊÀÖÈÈ.

TEMP;ÂÐÅÌÅÍÍÛÉ.

EDI ;ÄÅÑßÒÛÅ ÍÀÏÐßÆÅÍÈß.

DEI ;ÅÄÈÍÈÖÛ ÂÎËÜÒ.

COI ;ÄÅÑßÒÊÈ ÂÎËÜÒ.

;================================================

; ÂÐÅÌÅÍÍÛÅ.

;================================================

WTEMP;ÁÀÉÒ ÑÎÕÐÀÍÅÍÈß ÐÅÃÈÑÒÐÀ W ÏÐÈ ÏÐÅÐÛÂÀÍÈÈ.

STEMP;ÁÀÉÒ ÑÎÕÐÀÍÅÍÈß ÐÅÃÈÑÒÐÀ STATUS ÏÐÈ ÏÐÅÐÛÂÀÍÈÈ.

FTEMP;ÂÐÅÌÅÍÍÛÉ ÄËß FSR.

TEKH;

EDA;

DEA;

YCTL;

YCTLI;

;===========================================

; ÎÏÐÅÄÅËÅÍÈÅ ÁÈÒΠÑÎÑÒÎßÍÈß ÔËÀÃÎÂ.

;===========================================

FLAG

;

;0-> ÂÊËÞ×ÅÍÈÅ ÑÈÃÍÀËÀ.

;1-> ÒÅÊÓÙÅÅ ÂÐÅÌß.

;2-> ÂÊËÞ×ÅÍ ÐÅÆÈÌ ÒÀÉÌÅÐÀ.

;3-> ÈÍÄÈÊÀÖÈß ÍÀÏÐßÆÅÍÈß.

;4-> ÍÅÒ ÊÓÐÑÎÐÀ.

;5-> ÏÓÑÊ-ÑÒÎÏ.

;6-> ÏÐÎ×ÅÐÊ Â ×ÀÑÀÕ.

;7-> ÓÑÒÀÍÎÂÊÈ.

;=============================================

FLAG1

;

;1-> 1 ÑÅÊ ÖÈÊËÀ.

;2-> ÏÅÐÅÄÀÍÀ ÇÀÏßÒÀß.

;4-> ÇÓÌÌÅÐ ÂÊËÞ×ÅÍ.

;5-> ÑÒÎÐÎÆÎÊ ÍÀÏÎÌÈÍÈÍÈß ÀÂÀÐÈÈ ×ÅÐÅÇ 1 ×ÀÑ.

;===========================================

ENDC

;===========================================

; ÎÏÐÅÄÅËÅÍÈÅ ÐÅÃÈÑÒÐÎÂ ÈÍÄÈÊÀÖÈÈ.

;===========================================

R1EQU50H;ÌËÀÄØÈÉ ÐÀÇÐßÄ.

R2EQU51H;

R3EQU52H;

R4EQU53H;

R5EQU54H;

R6EQU55H;

R7EQU56H;

R8EQU57H;ÑÒÀÐØÈÉ ÐÀÇÐßÄ.

TEKLEQU58H;

;===========================================

; ÎÏÐÅÄÅËÅÍÈÅ ÁÈÒ ÏÎÐÒÎÂ ÂÂÎÄÀ/ÂÛÂÎÄÀ.

;===========================================

YCEQU1;ÐÅÆÈÌ/ÓÑÒÀÍÎÂÊÀ.

KYEQU2;ÏÓÑÊ/ÊÓÐÑÎÐ.

LOADEQU5;ÇÀÃÐÓÇÊÀ.

DINEQU3;ÄÀÍÍÛÅ.

DCLKEQU4;ÑÈÍÕÐÎÈÌÏÓËÜÑÛ.

;===========================================

; 1. ÏÓÑÊ.

;===========================================

ORG0

GOTOINIT

ORG4

GOTOPRER

;===========================================

; 2. ÈÍÈÖÈÀËÈÇÀÖÈß.

;===========================================

INIT

BSFSTATUS,5;ÏÅÐÅÕÎÄÈÌ Â ÁÀÍÊ 1.

MOVLW0FFH;

MOVWFADCON1^80H ;ÒÀÊÒ ÀÖÏ ÎÒ ÂÍÓÒÐÅÍÍÅÃÎ ÃÅÍÅÐÀÒÎÐÀ 500 êÃö.

MOVLWB'00000100';Ê=32.

MOVWFOPTION_REG^80H ;ÐÅÇÈÑÒÎÐÛ ÂÊËÞ×ÅÍÛ.

MOVLWB'10100000' ;ÐÀÇÐÅØÅÍÈÅ ÏÐÅÐÛÂÀÍÈÉ ÎÒ TMR0.

MOVWFINTCON ;

CLRFPIE1^80H ;ÇÀÏÐÅÙÅÍÛ ÂÑÅ ÏÅÐÈÔÅÐÈÉÍÛÅ ÏÐÅÐÛÂÀÍÈß.

MOVLWB'00001111' ;ÂÑÅ ÂÛÕÎÄÛ. 0 - ÂÕÎÄ ÀÖÏ.

MOVWFTRISA^80H ;

CLRFTRISC^80H ;ÂÑÅ ÂÛÕÎÄÛ.

CLRFVRCON^80H ;ÈÎÍ ÎÒÊËÞ×ÅÍ.

CLRFPCON^80H ;ÏÐÅÐÛÂÀÍÈß ÏÎ ÏÈÒÀÍÈÞ ÇÀÏÐÅÙÅÍÛ.

MOVLWB'00000110' ;

MOVWFWPUA^80H ;ÏÎÄÒßÃÈÂÀÞÙÈÅ ÐÅÇÈÑÒÎÐÛ ÂÊËÞ×ÅÍÛ.

 CLRFIOCA^80H ;ÏÐÅÐÛÂÀÍÈß ÇÀÏÐÅÙÅÍÛ.

MOVLW.1

MOVWFANSEL^80H ;ÂÛÁÐÀÍ ÀÍÀËÎÃÎÂÛÉ ÂÕÎÄ RA0/AN0.

BCFSTATUS,5 ;ÏÅÐÅÕÎÄÈÌ Â ÁÀÍÊ 0.

CLRFPORTC ;ÂÛÕÎÄ È ÑÂÅÒÎÄÈÎÄ ÂÛÊËÞ×ÅÍÛ.

CLRFT1CON ;ÒÀÉÌÅÐ 1 ÎÒÊËÞ×ÅÍ.

MOVLW.7

MOVWFCMCON ;ÊÎÌÏÀÐÀÒÎÐ ÂÛÊËÞ×ÅÍ.

CLRFFLAG ;ÂÑÅ ÎÁÍÓËßÅÌ È ÓÑÒÀÍÀÂËÈÂÀÅÌ.

CLRFFLAG1

CLRFEDI

CLRFDEI

CLRFCOI

CLRFCL

CLRFCH

CLRFML

CLRFMH

CLRFHL

CLRFHH

CLRFTCL

CLRFTCH

CLRFTML

CLRFTMH

CLRFTHL

CLRFTHH

CLRFPEID

CLRFZPT

CLRFCOUZ

CLRFCOU

CLRFHOU

MOVLW96H

MOVWFYCTL;ÓÑÒÀÍÎÂÊÀ ÌÀÊÑÈÌÓÌÀ = 15,0 B.

MOVLW78H

MOVWFYCTLI;ÓÑÒÀÍÎÂÊÀ ÌÈÍÈÌÓÌÀ = 12,0 B.

CLRFKYPC

BSFFLAG,4

 GOTOPAC

;==========================================

; 3. ÒÀÁËÈÖÀ ÑÅÃÌÅÍÒÎÂ.

;==========================================

SEG

;D E G F A B C K

ADDWFPCL,1;

RETLWB'11011110';0

RETLWB'00000110';1

RETLWB'11101100';2

RETLWB'10101110';3

RETLWB'00110110';4

RETLWB'10111010';5

RETLWB'11111010';6

RETLWB'00001110';7

RETLWB'11111110';8

RETLWB'10111110';9

RETLWB'00000000';10-> ÏÓÑÒÎ.

RETLWB'00100000';11-> ÏÐÎ×ÅÐÊ.

RETLWB'10000000';12-> ÏÐÎ×ÅÐÊ.

;=================================================

; 4. ÒÀÁËÈÖÀ ÏÅÐÅÊÎÄÈÐÎÂÊÈ ÊÓÐÑÎÐÀ.

;=================================================

KYPCY

MOVFWKYPC;

ADDWFPCL,1;

RETURN;ÍÅÒ ÊÓÐÑÎÐÀ.

RETLWB'00000100';3

RETLWB'00001000';4

RETLWB'00010000';5

RETLWB'00100000';6

RETLWB'01000000';7

;===================================================

; 5. ÂÛÁÎÐ ÐÅÆÈÌÀ ÈÍÄÈÊÀÖÈÈ.

;===================================================

VUBOR

MOVFWPEID;ÈÇÌÅÍßÅÌ ÐÅÆÈÌ ÈÍÄÈÊÀÖÈÈ.

ADDWFPCL,1;

GOTOINDH;ÈÍÄÈÊÀÖÈß ×ÀÑÎÂ.

GOTOINDT;ÒÀÉÌÅÐÀ.

GOTOINDU;ÍÀÏÐßÆÅÍÈß.

;======================================================

; 6. ÂÛÁÎÐ ÐÀÇÐßÄÀ ÓÑÒÀÍÎÂÊÈ.

;======================================================

YCT

BTFSCPORTA,YC;ÅÑËÈ ÊÍÎÏÊÀ "ÐÅÆÈÌ" ÍÀÆÀÒÀ,

RETURN

MOVFWKYPC;ÒÎ ÏÎ ÊÓÐÑÎÐÓ

ADDWFPCL,1;ÂÛÁÈÐÀÅÌ ÐÀÇÐßÄ ÓÑÒÀÍÎÂÊÈ.

RETURN;ÍÅÒ ÊÓÐÑÎÐÀ.

GOTOYC0;ÌÈÍÓÒÛ.

GOTOYC1;ÄÅÑßÒÊÈ ÌÈÍÓÒ.

GOTOYCE;ÎÁÍÓËÅÍÈÅ.

GOTOYC2;×ÀÑÛ.

GOTOYC3;ÄÅÑßÒÊÈ ×ÀÑÎÂ.

;=====================================================

; 7. ÒÀÁËÈÖÛ ÏÅÐÅÂÎÄÀ ÄÅÑßÒÊΠ ÄÂÎÈ×ÍÎÅ ×ÈÑËÎ.

;=====================================================

DEBIN

ADDWFPCL,1;

RETLW.0

RETLW.10

RETLW.20

RETLW.30

RETLW.40

RETLW.50

RETLW.60

RETLW.70

RETLW.80

RETLW.90

;======================================================

; 8. ÏÐÎÂÅÐÊÀ ÍÀÆÀÒÛÕ ÊÍÎÏÎÊ ÓÑÒÀÍÎÂÊÈ.

;======================================================

KHOP

BTFSSFLAG,1;ÅÑËÈ ÍÅÒ ÐÅÆÈÌÀ ×ÀÑÎÂ,

GOTO$+5;ÒÎ ÊÓÐÑÎÐ ÍÅ ÌÅÍßÅÒÑß.

BTFSSPORTA,KY;ÏÐÈ ÍÀÆÀÒÎÉ ÊÍÎÏÊÅ

CALLKYPCOP;ÈÄÅÌ ÍÀ ÓÑÒÀÍÎÂÊÓ ÊÓÐÑÎÐÀ.

BTFSCFLAG,7;ÅÑËÈ ÈÄÅÒ ÓÑÒÀÍÎÂÊÀ,

GOTOVUBOR;ÒÎ ÐÅÆÈÌ ÍÅ ÌÅÍßÅÒÑß.

BTFSCPORTA,YC;ÅÑËÈ ÊÍÎÏÊÀ "ÐÅÆÈÌ" ÍÀÆÀÒÀ,

GOTOVUBOR;ÈËÈ ÈÄÅÌ ÍÀ ÂÛÁÎÐ ÐÅÆÈÌÀ ÈÍÄÈÊÀÖÈÈ.

INCFPEID,1;ÈÇÌÅÍÅÍÈÅ ÐÅÆÈÌÀ ÈÍÄÈÊÀÖÈÈ.

MOVLW.3;3 ÐÅÆÈÌÎÂ ÈÍÄÈÊÀÖÈÈ.

SUBWFPEID,0;ÅÑËÈ ÁÎËÜØÅ,

BTFSSSTATUS,2;ÒÎ ÏÎÉÄÅÌ ÍÀ ÑÁÐÎÑ.

GOTOVUBOR;ÍÀ ÇÀÏÈÑÜ Â ÐÅÃÈÑÒÐÛ ÈÍÄÈÊÀÖÈÈ.

CLRFPEID;ÑÁÐÎÑ ÐÅÆÈÌÀ.

GOTOVUBOR;ÍÀ ÂÛÁÎÐ ÐÅÆÈÌÀ ÈÍÄÈÊÀÖÈÈ.

RETURN

;=================================================

; 9. ÓÑÒÀÍÎÂÊÀ ÊÓÐÑÎÐÀ (ÂÛÁÎÐ ÐÀÇÐßÄÀ ÓÑÒÀÍÎÂÊÈ).

;=================================================

KYPCOP

BSFFLAG,7;ÓÑÒÀÍÎÂÊÀ.

BCFFLAG,4;ÑÁÐÎÑ ÔËÀÃÀ ÍÅÒ ÊÓÐÑÎÐÀ.

INCFKYPC,1;ÏÐÈÁÀÂÈÌ ÅÄÈÍÈÖÓ Â ÊÓÐÑÎÐ.

MOVLW.6;ÍÅ ÁÎËÅÅ 5.

SUBWFKYPC,0;

SKPC;ÅÑËÈ ÁÎËÜØÅ ÈËÈ ÐÀÂÍÎ 6,

RETURN;

CLRFKYPC;ÎÁÍÓËÈÌ.

BSFFLAG,4;ÍÅÒ ÊÓÐÑÎÐÀ Â ÏÎËÅ.

BCFFLAG,7;ÍÅÒ ÓÑÒÀÍÎÂÊÈ.

RETURN;

;=========================================

; 10. ÂÂÎÄ ÊÓÐÑÎÐÀ  ÌË. ÐÀÇÐßÄ ÐÅÃÈÑÒÐÎÂ.

;=========================================

KYPVO

BTFSCFLAG,4;ÅÑËÈ ÍÅÒ ÊÓÐÑÎÐÀ,

RETURN;ÒÎ ÂÅÐÍÅÌÑß.

CALLKYPCY;ÓÑÒÀÍÎÂÈÌ ÐÅÆÈÌÛ.

MOVWFKYPCI;Â ÊÓÐÑÎÐ ÈÍÄÈÊÀÖÈÈ.

RRFKYPCI,1;ÇÀÏÎËÍÈÌ ÁÈÒ "Ñ".

ADDCFR1,1;ÏÅÐÅÍÅÑÅÌ Â ÐÅÃÈÑÒÐ ÈÍÄÈÊÀÖÈÈ.

RRFKYPCI,1;ÇÀÏÎËÍÈÌ ÁÈÒ "Ñ".

ADDCFR2,1;ÏÅÐÅÍÅÑÅÌ Â ÐÅÃÈÑÒÐ ÈÍÄÈÊÀÖÈÈ.

RRFKYPCI,1;ÎÑÒÀËÜÍÛÅ ÐÅÃÈÑÒÐÛ

ADDCFR3,1;ÇÀÏÎËÍßÅÌ ÀÍÀËÎÃÈ×ÍÎ.

RRFKYPCI,1;

ADDCFR4,1;

RRFKYPCI,1;

ADDCFR5,1;

RRFKYPCI,1;

ADDCFR6,1;

RRFKYPCI,1;

ADDCFR7,1;

RRFKYPCI,1;

ADDCFR8,1;

RETURN;

;=============================================

; 11. ÂÛÂÎÄ ÍÀ ÈÍÄÈÊÀÖÈÞ.

;=============================================

IND

CALLKYPVO;ÂÂÅÄÅÌ ÊÓÐÑÎÐÛ Â ÐÅÃÈÑÒÐÛ ÈÍÄÈÊÀÖÈÈ.

MOVFWZPT;ÇÍÀ×ÅÍÈß ÇÀÏßÒÛÕ ÏÅÐÅÏÈØÅÌ

MOVWFTZPT;ÂÎ ÂÐÅÌÅÍÍÛÉ ÐÅÃÈÑÒÐ.

BSFFLAG1,2;ÇÀÏßÒÀß ÏÅÐÅÄÀÍÀ.

BCFPORTC,DIN;ÄÀÍÍÛÅ ÐÀÂÍÛ ÍÓËÞ.

BCFPORTC,LOAD;ÍÀ×ÀËÎ ÏÅÐÅÄÀ×È (LOAD=0).

RRFTZPT,1;ÂÛÒÎËÊÍÅÌ Î×ÅÐÅÄÍÓÞ ÇÀÏßÒÓÞ.

CALLVUV0;

BCFFLAG1,2;ÇÀÏßÒÀß ÏÅÐÅÄÀÍÀ.

MOVLWR1;ÇÀÏÈØÅÌ ÀÄÐÅÑ ÏÅÐÂÎÃÎ ÐÅÃÈÑÒÐÀ ÈÍÄÈÊÀÖÈÈ.

MOVWFFSR;

MOVFWINDF;ÇÍÀ×ÅÍÈÅ ÏÅÐÂÎÃÎ ÐÅÃÈÑÒÐÀ

MOVWFTEMP;ÏÅÐÅÏÈØÅÌ ÂÎ ÂÐÅÌÅÍÍÛÉ.

BCFPORTC,LOAD;ÍÀ×ÀËÎ ÏÅÐÅÄÀ×È (LOAD=0).

CALLVUVOD;ÍÀ ÂÛÂÎÄ.

POVT

BSFFLAG1,2;ÇÀÏßÒÀß ÏÅÐÅÄÀÍÀ.

RRFTZPT,1;ÂÛÒÎËÊÍÅÌ Î×ÅÐÅÄÍÓÞ ÇÀÏßÒÓÞ.

CALLVUV0;

BCFFLAG1,2;ÇÀÏßÒÀß ÏÅÐÅÄÀÍÀ.

INCFFSR,1;ÓÂÅËÈ×ÈÌ ÀÄÐÅÑ ÐÅÃÈÑÒÐÀ ÈÍÄÈÊÀÖÈÈ.

MOVFWINDF;ÏÅÐÅÏÈØÅÌ ÅÃÎ ÇÍÀ×ÅÍÈÅ

MOVWFTEMP;ÂÎ ÂÐÅÌÅÍÍÛÉ.

CALLVUVOD;ÍÀ ÂÛÂÎÄ.

INCFCOUZ,1;ÏÎÄÑ×ÈÒÀÅÌ ×ÈÑËÎ

MOVLW.7;ÏÅÐÅÄÀÂÀÅÌÛÕ

SUBWFCOUZ,0;ÇÀÏßÒÛÕ.

BTFSCSTATUS,2;

CLRFCOUZ;ÎÁÍÓËÈÌ Ñ×ÅÒ×ÈÊ.

BTFSSSTATUS,2;

GOTOPOVT;ÏÎÂÒÎÐÈÌ ÂÛÂÎÄ.

BSFPORTC,LOAD;ÊÎÍÅÖ ÏÅÐÅÄÀ×È.

RETURN;

CUNX

BSFPORTC,DCLK;ÑÈÍÕÐÎÒÌÏÓËÜÑ = 1.

CALLPAUS;ÏÀÓÇÀ.

BCFPORTC,DCLK;ÑÈÍÕÐÎÈÌÏÓËÜÑ = 0.

RETURN;ÂÎÇÂÐÀÒ.

PAUS

 MOVLW .5;ÌÎÆÍÎ ÏÎÄÁÈÐÀÒÜ ÇÍÀ×ÅÍÈÅ ÏÀÓÇÛ.

ADDLW -1;ÏÀÓÇÀ = ×ÈÑËÎ Õ 4 ÌÊÑ.

BTFSS STATUS,2;

GOTO $-2;ÏÎÂÒÎÐÈÌ.

RETURN;ÂÅÐÍÅÌÑß.

VUVOD

RRFTEMP,1;ÑÄÂÈÍÅÌ ÂÏÐÀÂÎ.

VUV0

BTFSSSTATUS,0;ÏÎ ÍÓËÅÂÎÌÓ ÐÀÇÐßÄÓ

BCFPORTC,DIN;ÓÑÒÀÍÀÂËÈÂÀÅÌ ÄÀÍÍÛÅ

BTFSCSTATUS,0;Â 0 ÈËÈ 1.

BSFPORTC,DIN;

CALLCUNX;ÑÈÍÕÐÎÍÈÇÈÐÓÅÌ ÄÀÍÍÛÅ.

BTFSCFLAG1,2;ÅÑËÈ ÇÀÏßÒÀß ÏÅÐÅÄÀÍÀ,

RETURN;ÒÎ ÂÅÐÍÅÌÑß.

INCFCOU,1;ÏÎÄÑ×ÈÒÀÅÌ ×ÈÑËÎ ÁÈÒ.

MOVLW.8;

SUBWFCOU,0;

BTFSSSTATUS,2;ÅÑËÈ ÍÅ ÂÑÅ ÁÈÒÛ ÏÅÐÅÄÀÍÛ,

GOTOVUVOD;ÏÎÂÒÎÐÈÌ ÂÛÂÎÄ.

CLRFCOU;ÎÁÍÓËÈÌ Ñ×ÅÒ×ÈÊ.

RETURN;

;======================================================

; 12. ÑÎÕÐÀÍÅÍÈÅ È ÂÎÑÑÒÀÍÎÂËÅÍÈÅ ÇÍÀ×ÅÍÈÉ ÐÅÃÈÑÒÐΠÏÐÈ ÏÐÅÐÛÂÀÍÈÈ.

;======================================================

PRER

MOVWFWTEMP;ÑÎÕÐÀÍÅÍÈÅ ÇÍÀ×ÅÍÈÉ ÐÅÃÈÑÒÐΠW,

MOVFWSTATUS;STATUS,

MOVWFSTEMP;

MOVFWFSR;FSR.

MOVWFFTEMP;

BSFFLAG1,1;1 ÑÅÊ ÖÈÊËÀ.

CALLS1;ÏÎÄÑ×ÈÒÀÅÌ ÂÐÅÌß.

BTFSCFLAG,2;

CALLTAIM;

REPER ;ÂÎÑÑÒÀÍÎÂËÅÍÈÅ ÑÎÕÐÀÍÅÍÍÛÕ ÇÍÀ×ÅÍÈÉ.

MOVFWSTEMP;ÂÎÑÑÒÀÍÎÂËÅÍÈÅ ÐÅÃÈÑÒÐÎÂ:

MOVWFSTATUS;STATUS,

MOVFWFTEMP;

MOVWFFSR;FSR,

MOVFWWTEMP;W.

BCFINTCON,2;ÑÁÐÀÑÛÂÀÅÌ ÔËÀÃ ÏÐÅÐÛÂÀÍÈß ÎÒ TMR0.

RETFIE;ÂÎÇÂÐÀÒ ÈÇ ÏÐÅÐÛÂÀÍÈß.

;=============================================

; 13. ÏÎÄÑ×ÅÒ ÂÐÅÌÅÍÈ.

;=============================================

S1

BTFSCFLAG1,5;

GOTO$+8;

BTFSSFLAG1,4;

GOTO$+6;

BTFSCPORTC,0;ÑÌÅÍÀ ÂÊËÞ×ÅÍÈß ÇÓÌÌÅÐÀ.

GOTO$+3;

BSFPORTC,0;ÂÊËÞ×ÈÌ ÑÈÃÍÀË.

GOTO$+2;

BCFPORTC,0;

MOVLW.9;ÅÑËÈ ÓÆÅ 9 ÑÅÊÓÍÄ,

SUBWFCL,0;

BCSH;ÈÄÅÌ ÍÀ ÑÐÀÂÍÅÍÈÅ ÄÅÑßÒÊÎÂ ÑÅÊÓÍÄ.

INCFCL,1;ÈÍÀ×Å ÏÐÈÁÀÂÈÌ ÅÄÈÍÈÖÓ.

RETURN

SH

CLRFCL;ÎÁÍÓËÈÌ ÑÅÊÓÍÄÛ.

MOVFWCH;ÅÑËÈ ÄÅÑßÒÊÈ ÑÅÊÓÍÄ

ADDLW-5H;ÐÀÂÍÛ 5,

BZMIL;ÈÄÅÌ ÑÐÀÂÍÈÂÀÒÜ ÌÈÍÓÒÛ.

INCFCH,1;ÈÍÀ×Å ÓÂÅËÈ×ÈÌ ÄÅÑßÒÊÈ ÑÅÊÓÍÄ.

RETURN

MIL

CLRFCH;ÎÁÍÓËÈÌ ÄÅÑßÒÊÈ ÑÅÊÓÍÄ.

MOVFWML;ÅÑËÈ ÅÄÈÍÈÖÛ ÌÈÍÓÒ

ADDLW-9H;ÐÀÂÍÛ 9,

BZMIH;ÈÄÅÌ ÑÐÀÂÍÈÂÀÒÜ ÄÅÑßÒÊÈ.

INCFML,1;ÈÍÀ×Å ÓÂÅËÈ×ÈÌ ÌÈÍÓÒÛ.

RETURN

MIH

BSFFLAG1,4;ÏÐÎØËÎ 10 ÌÈÍÓÒ ÊÓÐÑÎÐ ÂÛÊËÞ×ÀÅÒÑß.

BCFFLAG,7;ÍÅÒ ÓÑÒÀÍÎÂÊÈ.

CLRFKYPC;ÍÅÒ ÊÓÐÑÎÐÀ.

CLRFML;ÎÁÍÓËÈÌ ÅÄÈÍÈÖÛ ÌÈÍÓÒ.

MOVFWMH;ÅÑËÈ ÄÅÑßÒÊÈ ÌÈÍÓÒ

ADDLW-5H;ÐÀÂÍÛ 5,

BZHOL;ÈÄÅÌ ÑÐÀÂÍÈÂÀÒÜ ×ÀÑÛ.

INCFMH,1;ÈËÈ ÓÂÅËÈ×ÈÌ ÄÅÑßÒÊÈ ÌÈÍÓÒ.

RETURN

HOL

BCFFLAG1,5;ÍÀÏÎÌÈÍÀÍÈÅ ÎÁ ÀÂÀÐÈÈ ÍÀÏÐßÆÅÍÈß.

CLRFMH;ÎÁÍÓËÈÌ ÄÅÑßÒÊÈ ÌÈÍÓÒ.

MOVFWHH;ÅÑËÈ ÄÅÑßÒÊÈ ×ÀÑÎÂ

ADDLW-2H;ÐÀÂÍÛ 2,

BZHL4;ÏÐÎÂÅÐÈÌ ÅÄÈÍÈÖÛ ×ÀÑÎÂ.

MOVFWHL;ÅÑËÈ ÅÄÈÍÈÖÛ ×ÀÑΠÐÀÂÍÛ 9,

ADDLW-9H;

BZ$+3;ÓÂÅËÈ×ÈÌ ÄÅÑßÒÊÈ ×ÀÑÎÂ.

INCFHL,1;ÈËÈ ÓÂÅËÈ×ÈÌ ÅÄÈÍÈÖÛ ×ÀÑÎÂ.

RETURN

CLRFHL;

INCFHH,1;

RETURN

HL4

MOVFWHL;ÅÑËÈ ÅÄÈÍÈÖÛ ×ÀÑÎÂ

ADDLW-3H;ÐÀÂÍÛ 3,

BZHOH;ÈÄÅÌ ÎÁÍÓËßÒÜ.

INCFHL,1;ÈËÈ ÏÐÈÁÀÂÈÌ ÅÄÈÍÈÖÓ.

RETURN

HOH

CLRFHL;

CLRF HH;ÎÁÍÓËÈÌ ÄÅÑßÒÊÈ ×ÀÑÎÂ.

RETURN;

;=============================================

; 14. ÒÀÉÌÅÐ.

;=============================================

TAIM

BSFFLAG,5;ÑËÅÄÓÞÙÀß ÎÑÒÀÍÎÂÊÀ ÒÀÉÌÅÐÀ.

MOVLW.9;ÅÑËÈ ÓÆÅ 9 ÑÅÊÓÍÄ,

SUBWFTCL,0;

BC$+3;ÈÄÅÌ ÍÀ ÑÐÀÂÍÅÍÈÅ ÄÅÑßÒÊÎÂ ÑÅÊÓÍÄ.

INCFTCL,1;ÈÍÀ×Å ÏÐÈÁÀÂÈÌ ÅÄÈÍÈÖÓ.

RETURN

CLRFTCL;ÎÁÍÓËÈÌ ÑÅÊÓÍÄÛ.

MOVFWTCH;ÅÑËÈ ÄÅÑßÒÊÈ ÑÅÊÓÍÄ

ADDLW-5H;ÐÀÂÍÛ 5,

BZ$+3;ÈÄÅÌ ÑÐÀÂÍÈÂÀÒÜ ÌÈÍÓÒÛ.

INCFTCH,1;ÈÍÀ×Å ÓÂÅËÈ×ÈÌ ÄÅÑßÒÊÈ ÑÅÊÓÍÄ.

RETURN

CLRFTCH;ÎÁÍÓËÈÌ ÄÅÑßÒÊÈ ÑÅÊÓÍÄ.

MOVFWTML;ÅÑËÈ ÅÄÈÍÈÖÛ ÌÈÍÓÒ

ADDLW-9H;ÐÀÂÍÛ 9,

BZ$+3;ÈÄÅÌ ÑÐÀÂÍÈÂÀÒÜ ÄÅÑßÒÊÈ.

INCFTML,1;ÈÍÀ×Å ÓÂÅËÈ×ÈÌ ÌÈÍÓÒÛ.

RETURN

CLRFTML;ÎÁÍÓËÈÌ ÅÄÈÍÈÖÛ ÌÈÍÓÒ.

MOVFWTMH;ÅÑËÈ ÄÅÑßÒÊÈ ÌÈÍÓÒ

ADDLW-5H;ÐÀÂÍÛ 5,

BZ$+3;ÓÂÅËÈ×ÈÌ ×ÀÑÛ.

INCFTMH,1;ÈËÈ ÓÂÅËÈ×ÈÌ ÄÅÑßÒÊÈ ÌÈÍÓÒ.

RETURN

CLRFTMH;ÎÁÍÓËÈÌ ÄÅÑßÒÊÈ ÌÈÍÓÒ.

MOVFWTHL;ÅÑËÈ ÅÄÈÍÈÖÛ ×ÀÑΠÐÀÂÍÛ 9,

ADDLW-9H;

BZ$+3;ÓÂÅËÈ×ÈÌ ÄÅÑßÒÊÈ ×ÀÑÎÂ.

INCFTHL,1;ÈËÈ ÓÂÅËÈ×ÈÌ ÅÄÈÍÈÖÛ ×ÀÑÎÂ.

RETURN

CLRFTHL;ÎÁÍÓËÈÌ ×ÀÑÛ.

MOVFWTHH;ÅÑËÈ ÄÅÑßÒÊÈ ×ÀÑΠÐÀÂÍÛ 9,

ADDLW-9H;

BZ$+3;ÎÁÍÓËÈÌ.

INCFTHH,1;ÈËÈ ÓÂÅËÈ×ÈÌ ÄÅÑßÒÊÈ ×ÀÑÎÂ.

RETURN

CLRFTHH;

RETURN

T00

BTFSSFLAG,5;

GOTO$+4;

BCFFLAG,2;ÒÀÉÌÅÐ ÂÛÊËÞ×ÅÍ.

BCFFLAG,5;ÑËÅÄÓÞÙÅÅ ÂÊËÞ×ÅÍÈÅ ÒÀÉÌÅÐÀ.

RETURN;

CLRFTCL;ÂÑÅ ÎÁÍÓËßÅÌ.

CLRFTCH;

CLRFTML;

CLRFTMH;

CLRFTHL;

CLRFTHH;

BSFFLAG,2;ÂÊËÞ×ÈÌ ÒÀÉÌÅÐ.

RETURN

;===================================================

; 15. ÀÖÏ - ÏÐÅÎÁÐÀÇÎÂÀÍÈß (ÈÇÌÅÐÅÍÈÅ ÂÕÎÄÍÛÕ ÂÅËÈ×ÈÍ).

;===================================================

ADP

MOVLWB'10000001';ÑÈÍÕÐÎÍÈÇÀÖÈß ÎÒ RC

MOVWFADCON0;ÃÅÍÅÐÀÒÎÐÀ, ÂÕÎÄ 0, ÂÊËÞ×ÅÍÈÅ ÀÖÏ (YBX).

CALLZAD;

BSFADCON0,1;ÂÊËÞ×ÈÌ ÏÐÅÎÁÐÀÇÎÂÀÍÈÅ.

BTFSCADCON0,1;ÎÆÈÄÀÅÌ ÇÀÂÅÐØÅÍÈß

GOTO$-1 ;ÏÐÅÎÁÐÀÇÎÂÀÍÈß.

MOVFWADRESH ;ÏÅÐÅÏÈØÅÌ ÐÅÇÓËÜÒÀÒ ÏÐÅÎÁÐÀÇÎÂÀÍÈß

MOVWFTEKH;Â ÑÒÀÐØÈÉ ÒÅÊÓÙÈÉ ÐÅÃÈÑÒÐ.

BSFSTATUS,5;ÏÅÐÅÕÎÄÈÌ Â ÁÀÍÊ 1.

MOVLW58;

MOVWFFSR;ÏÎ ÊÎÑÂÅÍÍÎÉ ÀÄÐÅÑÀÖÈÈ

MOVFWADRESL;ÇÀÏÈÑÜ ÌË. ÐÅÃÈÑÒÐÀ ÀÖÏ

MOVWFINDF;Â ÐÅÃÈÑÒÐ TEKL.

BCFSTATUS,5;ÏÅÐÅÕÎÄÈÌ Â ÁÀÍÊ 0.

CALLCOMPA;

GOTOBINDEC;ÏÅÐÅÊÎÄÈÐÓÅÌ Â 2_10 ÊÎÄ.

ZAD

MOVLW.5;ÇÀÄÅÐÆÊÀ 20 ÌÊÑ.

ADDLW-1;

BTFSSSTATUS,2;

GOTO$-2;

RETURN

;===========================

; 16. ÑÐÀÂÍÅÍÈÅ Ñ ÓÑÒÀÍÎÂÊÎÉ.

;===========================

COMPA

TSTFTEKL;

BTFSCSTATUS,2;

GOTOVUKL;

MOVFWYCTL;ÓÑÒÀÍÎÂÊÀ ÌÀÊÑÈÌÓÌÀ.

SUBWFTEKL,0;ÈÇÌÅÐÅÍÈÅ,

BTFSCSTATUS,0;ÅÑËÈ ÁÎËÜØÅ ÈËÈ ÐÀÂÍÎ,

GOTOVUKL;ÒÎ ÂÊËÞ×ÀÅÒÑß ÇÓÌÌÅÐ.

MOVFWYCTLI;ÓÑÒÀÍÎÂÊÀ ÌÈÍÈÌÓÌÀ.

SUBWFTEKL,0;ÈÇÌÅÐÅÍÈÅ,

BTFSSSTATUS,0;ÅÑËÈ ÌÅÍÜØÅ,

GOTOVUKL;ÒÎ ÂÊËÞ×ÀÅÒÑß ÇÓÌÌÅÐ.

BTFSCSTATUS,2;ÅÑËÈ ÐÀÂÍÎ,

GOTOVUKL;ÒÎ ÂÊËÞ×ÀÅÒÑß ÇÓÌÌÅÐ.

BCFFLAG1,4;ÇÓÌÌÅÐ ÂÛÊËÞ×ÅÍ.

BCFFLAG1,5;ÇÓÌÌÅÐ ÂÛÊËÞ×ÅÍ.

BCFPORTC,0;ÂÛÊËÞ×ÈÌ ÑÈÃÍÀË.

RETURN

VUKL

BTFSCPORTA,KY;

GOTO$+5;

BSFFLAG1,5;ÏÎÑÒÀÂÈÌ ÑÒÎÐÎÆÎÊ ÍÀ 1 ×ÀÑ.

BCFPORTC,0;ÂÛÊËÞ×ÈÌ ÑÈÃÍÀË.

BTFSCFLAG1,5;ÅÑËÈ 1 ×ÀÑ ÏÐÎØÅË, ÒÎ ÂÊËÞ×ÈÌ ÑÈÃÍÀË.

RETURN

BTFSCFLAG1,4;ÅÑËÈ ÂÛÕÎÄ ÓÆÅ ÂÛÊËÞ×ÅÍ,

RETURN;ÑÐÀÂÍÅÍÈÉ ÍÅÒ.

BSFPORTC,0;ÂÊËÞ×ÈÌ ÑÈÃÍÀË.

BSFFLAG1,4;ÇÓÌÌÅÐ ÂÊËÞ×ÅÍ.

RETURN

;======================================================

; 17. ÏÅÐÅÊÎÄÈÐÎÂÊÀ ÈÇ 16-È ÐÀÇÐßÄÍÎÃÎ 2-ÃÎ Â 5- ÐÀÇÐßÄÍÎÅ 2-10-Å.

; ÀËÃÎÐÈÒÌ ÏÅÐÅÊÎÄÈÐÎÂÊÈ ÎÑÍÎÂÛÂÀÅÒÑß ÍÀ ÏÐÈÁÀÂËÅÍÈÈ 3 Â ÌËÀÄØÈÉ

; È ÑÒÀÐØÈÉ ÏÎËÓÁÀÉÒÛ. ÅÑËÈ ÐÅÇÓËÜÒÀÒ ÑÏÅÐÅÍÎÑÎÌ 1  3 ÐÀÇÐßÄ (10=7+3), ÒÎ ÇÀÏÈÑÛÂÀÅÌ

; ÍÎÂÎÅ ÇÍÀ×ÅÍÈÅ Â ÐÅÃÈÑÒÐ. ÂÛÏÎËÍßÅÌ 16 ÐÀÇ ÑÄÂÈÃÀß ÁÈÒÛ ÐÅÃÈÑÒÐÎÂ.

;======================================================

BINDEC

MOVLW .16 ;ÇÀÏÈØÅÌ ×ÈÑËÎ ÑÄÂÈÃÎÂ

MOVWF COU ; Ñ×ÅÒ×ÈÊ.

BIDE

BCF STATUS,0 ;ÎÁÍÓËÈÌ ÁÈÒ "Ñ".

RLF TEKL,1 ;ÑÄÂÈÍÅÌ ÏÅÐÅÊÎÄÈÐÓÅÌÎÅ

RLF TEKH,1 ;×ÈÑËÎ ÏÅÐÅÌÅÙÀß ÅÃÎ ÑÒÀÐØÈÉ ÁÈÒ

RLF EDA,1 ;Â ÌËÀÄØÈÉ ÁÈÒ ÐÅÃÈÑÒÐÎÂ

RLF DEA,1 ;ÐÅÇÓËÜÒÀÒÀ.

DECFSZ COU,1 ;ÇÀÔÈÊÑÈÐÓÅÌ ÑÄÂÈà  Ñ×ÅÒ×ÈÊÅ.

GOTO RASDEC ;ÏÐÎÂÅÐÈÌ ÏÎËÓÁÀÉÒÛ ÍÀ ÑÅÌÅÐÊÓ.

GOTO MESTO ;ÅÑËÈ Ñ×ÅÒ×ÈÊ ÏÓÑÒ, ÇÀÏÎËÍÈÌ ÐÅÃÈÑÒÐÛ ÈÍÄÈÊÀÖÈÈ.

RASDEC

 MOVLW EDA ;ÇÀÏÈØÅÌ ÀÄÐÅÑ ÐÅÃÈÑÒÐÀ

 MOVWF FSR ;Â ÐÅÃÈÑÒÐ ÊÎÑÂÅÍÍÎÉ ÀÄÐÅÑÀÖÈÈ.

 CALL BCD ;ÏÐÎÂÅÐÈÌ ÇÍÀ×ÅÍÈÅ ÐÅÃÈÑÒÐÀ ÍÀ 7.

 MOVLW DEA ;ÀÍÀËÎÃÈ×ÍÛÅ ÎÏÅÐÀÖÈÈ ÏÐÎÄÅËÀÅÌ

 MOVWF FSR ;Ñ ÄÐÓÃÈÌÈ ÐÅÃÈÑÒÐÀÌÈ.

 CALL BCD ;

 GOTO BIDE ;ÏÎÉÄÅÌ ÏÎÂÒÎÐßÒÜ ÑÄÂÈÃ.

BCD

 MOVLW 3 ;0000 0011

 ADDWF 0,0 ;ÏÐÈÁÀÂÈÌ 3 Ê ÐÅÃÈÑÒÐÓ È ÐÅÇÓËÜÒÀÒ

 MOVWF TEMP ;ÇÀÏÈØÅÌ ÂÎ ÂÐÅÌÅÍÍÛÉ ÐÅÃÈÑÒÐ.

 BTFSC TEMP,3 ;ÏÐÎÂÅÐÈÌ 3 ÁÈÒ È ÅÑËÈ ÎÍ ÐÀÂÅÍ ÍÓËÞ,

 MOVWF 0 ;ÏÐÎÏÓÑÊÀÅÌ ÇÀÏÈÑÜ ÐÅÇÓËÜÒÀÒÀ Â ÐÅÃÈÑÒÐ.

 MOVLW 30 ;48=0011 0000

 ADDWF 0,0 ;ÏÐÈÁÀÂÈÌ 3 Ê ÑÒÀÐØÅÌÓ ÏÎËÓÁÀÉÒÓ ÐÅÃÈÑÒÐÀ È ÐÅÇÓËÜÒÀÒ

 MOVWF TEMP ;ÇÀÏÈØÅÌ ÂÎ ÂÐÅÌÅÍÍÛÉ ÐÅÃÈÑÒÐ.

 BTFSC TEMP,7 ;ÅÑËÈ ÁÈÒ ÅÄÈÍÈ×ÍÛÉ,

 MOVWF 0 ;ÒÎ ÇÀÏÈØÅÌ ÍÎÂÎÅ ÇÍÀ×ÅÍÈÅ Â ÐÅÃÈÑÒÐ.

 RETURN ;ÂÅÐÍÅÌÑß ÄËß ÇÀÃÐÓÇÊÈ ÍÎÂÎÃÎ ÇÍÀ×ÅÍÈß ÐÅÃÈÑÒÐÀ.

;======================================================

; 18. ÈÇÂËÅÊÀÅÌ ÏÎËÓÁÀÉÒÛ ÈÇ ÐÅÃÈÑÒÐΠÑ×ÅÒÀ  ÐÅÃÈÑÒÐÛ ÈÍÄÈÊÀÖÈÈ.

;======================================================

MESTO

MOVLWB'00001111';ÈÇÂËÅÊÀÅÌ ÏÎËÓÁÀÉÒÛ

ANDWFDEA,0;Â ÐÅÃÈÑÒÐÛ ÈÍÄÈÊÀÖÈÈ.

MOVWFCOI;

MOVLWB'11110000';

ANDWFEDA,0 ;

MOVWFDEI ;

SWAPFDEI,1 ;

MOVLWB'00001111';

ANDWFEDA,0;

MOVWFEDI;

CLRFEDA;

CLRFDEA;

RETURN;

;==================================================

; 19. ÑÌÅÍÀ ÈÍÄÈÊÀÖÈÈ ÏÐÈ ÑÌÅÍÅ ÐÅÆÈÌÀ.

;==================================================

INDH

BTFSCFLAG,7;ÅÑËÈ ÊÓÐÑÎÐ ÅÑÒÜ,

CALLYCT;ÒÎ ÈÄÅÌ ÍÀ ÓÑÒÀÍÎÂÊÓ.

MOVLW.10;ÏÓÑÒÎ.

CALLSEG;ÇÀÏÎËÍÈÌ ÐÅÃÈÑÒÐÛ ÈÍÄÈÊÀÖÈÈ.

MOVWFR1;

MOVWFR2;

MOVWFR8;

BTFSSFLAG,6;

GOTO$+6;

MOVLW.11;ÏÐÎ×ÅÐÊ ÑÐÅÄÍÈÉ.

CALLSEG;

MOVWFR5;

BCFFLAG,6;

GOTO$+5;

MOVLW.12;ÏÐÎ×ÅÐÊ ÍÈÆÍÈÉ.

CALLSEG;

MOVWFR5;

BSFFLAG,6;

MOVFWML;

CALLSEG;

MOVWFR3;

MOVFWMH;

CALLSEG;

MOVWFR4;

MOVFWHL;

CALLSEG;

MOVWFR6;

MOVFWHH;

CALLSEG;

MOVWFR7;

BSFFLAG,1;ÂÊËÞ×ÈÌ ÐÅÆÈÌ ×ÀÑÎÂ.

CLRFZPT;

RETURN;

INDT

BTFSSPORTA,KY;ÅÑËÈ ÊÍÎÏÊÀ ÍÀÆÀÒÀ,

CALLT00;ÒÎ ÈÄÅÌ ÎÁÍÓËßÒÜ ÒÀÉÌÅÐ.

MOVFWTCL;ÇÀÏÎËÍÈÌ ÐÅÃÈÑÒÐÛ ÈÍÄÈÊÀÖÈÈ

CALLSEG;ÌÈÍÓÒ È ÑÅÊÓÍÄ ÏÐÀÂÛÕ ×ÀÑÎÂ.

MOVWFR1;

MOVFWTCH;

CALLSEG;

MOVWFR2;

MOVFWTML;

CALLSEG;

MOVWFR4;

MOVFWTMH;

CALLSEG;

MOVWFR5;

MOVLW.11;ÏÐÎ×ÅÐÊ.

CALLSEG;

MOVWFR3;

MOVWFR6;

MOVFWTHL;

CALLSEG;

MOVWFR7;

MOVFWTHH;

CALLSEG;

MOVWFR8;

BCFFLAG,1;ÐÅÆÈÌ ×ÀÑÛ ÂÛÊËÞ×ÅÍ.

BCFFLAG,7;ÍÅÒ ÓÑÒÀÍÎÂÊÈ.

RETURN;

INDU

MOVLW.10;ÏÓÑÒÎ.

CALLSEG;ÇÀÏÎËÍÈÌ ÐÅÃÈÑÒÐÛ ÈÍÄÈÊÀÖÈÈ.

MOVWFR1;

MOVWFR2;

MOVWFR3;

MOVWFR7;

MOVWFR8;

 MOVFW COI;

CALLSEG;

MOVWFR6;

MOVFW DEI;

CALLSEG;

MOVWFR5;

 MOVFW EDI;

CALLSEG;

MOVWFR4;

BSFZPT,4;

RETURN;

;===================================================

; 20. ÐÀÑÏÐÅÄÅËÈÒÅËÜ.

;===================================================

PAC

BTFSSFLAG1,1;ÆÄÅÌ 1 ÑÅÊÓÍÄÓ.

GOTO$-1;

CALLADP;

CALLKHOP;ÍÀ ÏÐÎÂÅÐÊÓ ÊÍÎÏÎÊ.

CALLIND;ÍÀ ÈÍÄÈÊÀÖÈÞ.

BCFFLAG1,1;

GOTOPAC;ÏÎÂÒÎÐÈÌ.

;=====================================================

; 21. ÓÑÒÀÍÎÂÊÀ ÂÐÅÌÅÍÈ.

;=====================================================

YC0

INCFML,1;ÓÂÅËÈ×ÈÌ ÅÄÈÍÈÖÛ ÌÈÍÓÒ.

MOVLW.10;ÍÅ ÁÎËÅÅ 9.

SUBWFML,0;

SKPNC;ÅÑËÈ ÁÎËÜØÅ ÈËÈ ÐÀÂÍÎ 10,

CLRFML;ÒÎ ÎÁÍÓËÈÌ.

RETURN

YC1

INCFMH,1;ÓÂÅËÈ×ÈÌ ÄÅÑßÒÊÈ ÌÈÍÓÒ.

MOVLW.6;ÍÅ ÁÎËÅÅ 5.

SUBWFMH,0;

SKPNC;ÅÑËÈ ÁÎËÜØÅ ÈËÈ ÐÀÂÍÎ 6,

CLRFMH;ÒÎ ÎÁÍÓËÈÌ.

RETURN

YC2

INCFHL,1;ÓÂÅËÈ×ÈÌ ÅÄÈÍÈÖÛ ×ÀÑÎÂ.

MOVLW.10;ÍÅ ÁÎËÅÅ 9.

SUBWFHL,0;

SKPNC;

CLRFHL;ÅÑËÈ ÁÎËÜØÅ, ÒÎ ÎÁÍÓËÈÌ.

MOVFWHH;ÏÅÐÅÊÎÄÈÐÓÅÌ Â ÄÂÎÈ×ÍÛÉ

CALLDEBIN;ÊÎÄ ÄÅÑßÒÊÈ.

ADDWFHL,0;ÏÐÈÁÀÂÈÌ ÅÄÈÍÈÖÛ

MOVWFHOU;ÄÂÎÈ×ÍÎÅ ÇÍÀ×ÅÍÈÅ ÍÅ ÄÎËÆÍÎ

ADDLW-18H;ÏÐÅÂÛØÀÒÜ - 24.

SKPC;ÅÑËÈ ÁÎËÜØÅ ÈËÈ ÐÀÂÍÎ 24,

RETURN

CLRFHOU;ÒÎ ÎÁÍÓËÈÌ ×ÀÑÛ ÄÂÎÈ×ÍÛÅ

CLRFHL;È ÐÀÇÐßÄÛ ÑÒÀÐØÈÉ

CLRFHH;È ÌËÀÄØÈÉ.

RETURN

YC3

INCFHH,1;ÓÂÅËÈ×ÈÌ ÄÅÑßÒÊÈ ×ÀÑÎÂ.

MOVLW.3;ÍÅ ÁÎËÅÅ 2.

SUBWFHH,0;

SKPNC;

CLRFHH;ÅÑËÈ ÁÎËÜØÅ, ÒÎ ÎÁÍÓËÈÌ.

MOVFWHH;ÏÅÐÅÊÎÄÈÐÓÅÌ Â ÄÂÎÈ×ÍÛÉ

CALLDEBIN;ÊÎÄ ÄÅÑßÒÊÈ.

ADDWFHL,0;ÏÐÈÁÀÂÈÌ ÅÄÈÍÈÖÛ

MOVWFHOU;È ÏÎËÓ×ÈÌ ÄÂÎÈ×ÍÎÅ ×ÈÑËÎ.

 ADDLW-18H;

SKPC;ÅÑËÈ ÁÎËÜØÅ ÈËÈ ÐÀÂÍÎ 24,

RETURN

CLRFHOU;ÒÎ ÎÁÍÓËÈÌ ×ÀÑÛ ÄÂÎÈ×ÍÛÅ

CLRFHL;È ÐÀÇÐßÄÛ ÑÒÀÐØÈÉ

CLRFHH;È ÌËÀÄØÈÉ.

RETURN;ÂÅÐÍÅÌÑß.

YCE

CLRFCL;ÎÁÍÓËÅÍÈÅ.

CLRFCH;

CLRFML;

RETURN;

;=====================================================

 END

;=====================================================


Èíôîðìàöèÿ î ðàáîòå «Àâòîìîáèëüíûå ÷àñû-òåðìîìåòð-âîëüòìåòð íà áàçå ìèêðîêîíòðîëëåðà»
Ðàçäåë: Êîììóíèêàöèè è ñâÿçü
Êîëè÷åñòâî çíàêîâ ñ ïðîáåëàìè: 45118
Êîëè÷åñòâî òàáëèö: 5
Êîëè÷åñòâî èçîáðàæåíèé: 10

Ïîõîæèå ðàáîòû

Ñêà÷àòü
46391
5
10

... Ìîðòîí Äæ. Ìèêðîêîíòðîëëåðû ÀVR. Ââîäíûé êóðñ /Ïåð. ñ àíãë. – Ì., Äîäýêà –ÕÕ1, 2006 – 272ñ. 7. Òåõíè÷åñêàÿ äîêóìåíòàöèÿ íà ìèêðîêîíòðîëëåðû AT89C2051 ôèðìû «Atmel». ÎÎÎ «Ìèêðî -×èï», Ìîñêâà, 2002.-184 ñ. ÏÐÈËÎÆÅÍÈÅ À Ëèñòèíã ïðîãðàììû è îáúåêòíûé ôàéë ; ×ÀÑÛ-ÒÅÐÌÎÌÅÒÐ-ÂÎËÜÒÌÅÒÐ ÄËß ÀÂÒÎÌÎÁÈËß. ÐÀÇÐÀÁÎÒÀË ÄÅÐÊÀ× ; ÏÐÎÃÐÀÌÌÀ = ABTO.ASM ; ÂÅÐÑÈß: 20-01-07. ; ÀÑÑÅÌÁËÅÐ È ÎÒËÀÄ×ÈÊ: MPLAB ...

0 êîììåíòàðèåâ


Íàâåðõ