Ðàçðàáîòêà ìèêðîïðîöåññîðíîé ñèñòåìû öèôðîâîãî òåðìîìåòðà íà áàçå ìèêðîêîíòðîëëåðà
8. Ðàáîòà ñ óñòðîéñòâîì
Ïîñëå ïîäà÷è
íàïðÿæåíèÿ ïèòàíèÿ íà èíäèêàòîðå ïîÿâèòñÿ èçîáðàæåíèå, àíàëîãè÷íîå
ïðåäñòàâëåííîìó íà ðèñ. 6, íî ñ ÷èñëîì è ìåñÿöåì, ðàâíûì 01 è íóëåâûìè
çíà÷åíèÿìè âðåìåíè. Äâå êðàéíèå ñëåâà öèôðû â âåðõíåì ðÿäó ïîêàçûâàþò òåêóùóþ
äàòó, à â íèæíåì ðÿäó — òåêóùèé ìåñÿö. Äàëåå â âåðõíåì ðÿäó îòîáðàæåíî òåêóùåå
âðåìÿ â ÷àñàõ è ìèíóòàõ ñ äâîåòî÷èåì, êîòîðîå ìèãàåò ñ ïåðèîäîì â äâå ñåêóíäû.
Ðèñ.6. Èíäèêàöèÿ ïîñëå ïîäà÷è íàïðÿæåíèÿ ïèòàíèÿ
Êðàéíèå
ñïðàâà çíà÷åíèÿ â âåðõíåì ðÿäó ïîêàçûâàþò òåêóùóþ òåìïåðàòóðó ñ ïåðâîãî
òåðìîäàò÷èêà, à â íèæíåì ðÿäó — ñî âòîðîãî òåðìîäàò÷èêà. Ïîñëå ñòðåëêè óêàçàí
íîìåð òåðìîäàò÷èêà.
Ïîñëå íàæàòèÿ
êíîïêè "Ðåæèì" è óäåðæàíèÿ åå íå ìåíåå òðåõ ñåêóíä èíäèêàòîð ïåðåéäåò
â ðåæèì óñòàíîâêè âðåìåíè è äàòû ðèñ.7.
Ðèñ. 7. Ðåæèì óñòàíîâêè âðåìåíè è äàòû
Ïîä ðàçðÿäîì äåñÿòêîâ ÷àñîâ áóäåò ìèãàòü êóðñîð ñ ïåðèîäîì â äâå
ñåêóíäû. Ïîñëå íàæàòèÿ êíîïêè "Ðàçðÿä" êóðñîð áóäåò ïåðåìåùàòüñÿ
ñëåâà íàïðàâî. Êíîïêîé "Óñòàíîâêà" óñòàíàâëèâàþò íåîáõîäèìûå òåêóùèå
çíà÷åíèÿ âðåìåíè è äàòû. Ôîðìàò çàïèñè äàòû: "÷èñëî-ìåñÿö". Ïðè
óñòàíîâêå óäåðæèâàòü íàæàòûìè êíîïêè "Ðàçðÿä" è "Óñòàíîâêà"
ñëåäóåò íå ìåíåå îäíîé ñåêóíäû.
Ïðè íàæàòèè êíîïêè "Ñáðîñ" çíà÷åíèÿ ìèíóò è ñåêóíä
óñòàíàâëèâàþòñÿ â íîëü, ÷òî íåîáõîäèìî ïðè óñòàíîâêå âðåìåíè ïî ñèãíàëàì
òî÷íîãî âðåìåíè. Âñå êíîïêè ñðàáàòûâàþò ïîñëå èõ îòïóñêàíèÿ.
Ïðè ñëåäóþùåì
íàæàòèè êíîïêè "Ðåæèì" íà èíäèêàòîðå óñòàíîâèòñÿ ðåæèì ïðîñìîòðà
(ðèñ. 8).
Ðèñ. 8. Ðåæèì ïðîñìîòðà
Ïåðâûìè îòîáðàæåíû âðåìÿ è òåìïåðàòóðà äëÿ òåêóùåé äàòû. Ïîä
ðàçðÿäîì åäèíèö ÷èñëà áóäåò ìèãàòü êóðñîð. Ñòðåëêà óêàçûâàåò íà íîìåð
òåðìîäàò÷èêà, ïî êîòîðîìó ïîêàçàíû ýêñòðåìàëüíûå çíà÷åíèÿ.  âåðõíåì ðÿäó
îòîáðàæåíû âðåìÿ è çàôèêñèðîâàííàÿ ìàêñèìàëüíàÿ òåìïåðàòóðà, à â íèæíåì — âðåìÿ
è ìèíèìàëüíàÿ òåìïåðàòóðà. Êíîïêîé "Ïðîñìîòð 1-2" âûáèðàþò ïîêàçàíèÿ
èíäèêàòîðà äëÿ ïåðâîãî èëè âòîðîãî òåðìîäàò÷èêà. Åñëè êíîïêó "Ïðîñìîòð
1-2" óäåðæèâàòü íàæàòîé, òî èíäèêàöèÿ áóäåò íåïðåðûâíî èçìåíÿòüñÿ ÷åðåç
äâå ñåêóíäû.
Ïîñëå êàæäîãî íàæàòèÿ êíîïêè "Ïðîñìîòð" îòîáðàæàåìîå
÷èñëî óìåíüøàåòñÿ íà åäèíèöó, à íà èíäèêàòîðå ïîÿâÿòñÿ çíà÷åíèÿ âðåìåíè è
òåìïåðàòóð, çàïèñàííûõ â ïàìÿòè EEPROM.
Íàæàòèåì
êíîïêè "Ðåæèì" ïåðåõîäÿò â òåêóùèé ðåæèì èíäèêàöèè. Ïðè ïåðåõîäå èç
ðåæèìà ïðîñìîòðà ê òåêóùåìó ðåæèìó êíîïêó "Ðåæèì" íåîáõîäèìî
óäåðæèâàòü ÷åòûðå ñåêóíäû. Îòñ÷åò âðåìåíè ïðè óäåðæàíèè êíîïêè óäîáíî âåñòè ïî
ìèãàíèþ êóðñîðà.
Âàæíî çàïîìíèòü, ÷òî â ðåæèìå ïðîñìîòðà è óñòàíîâêè èçìåðåíèå
òåìïåðàòóðû íå ïðîèçâîäèòñÿ, ïîýòîìó ðàáî÷èì ðåæèìîì íóæíî ñ÷èòàòü òåêóùèé
ðåæèì èíäèêàöèè.
ÇÀÊËÞ×ÅÍÈÅ
 äàííîì
êóðñîâîì ïðîåêòå ðàçðàáîòàíî óñòðîéñòâî - ýëåêòðîííûé òåðìîìåòð. Ðàçðàáîòàíà
ñõåìà ýëåêòðè÷åñêàÿ ïðèíöèïèàëüíàÿ ýòîãî óñòðîéñòâà è ïðîãðàììà äëÿ
ìèêðîêîíòðîëëåðà.  ðåçóëüòàòå àññåìáëèðîâàíèÿ ïîëó÷åíà ïðîøèâêà ïðîãðàììû äëÿ
ïàìÿòè ìèêðîêîíòðîëëåðà. Ïðèìåíåíèå ìèêðîêîíòðîëëåðà ïîçâîëèëî óïðîñòèòü ïðèíöèïèàëüíóþ
ñõåìó è ðàñøèðèòü ôóíêöèîíàëüíûå âîçìîæíîñòè ìèêðîêîíòðîëëåðà, òàê êàê äëÿ èçìåíåíèÿ
ôóíêöèé óñòðîéñòâà äîñòàòî÷íî âíåñòè èçìåíåíèÿ â ïðîãðàììó ìèêðîêîíòðîëëåðà.
ÑÏÈÑÎÊ
ËÈÒÅÐÀÒÓÐÛ
1. Áåëîâ À.Â. Ìèêðîêîíòðîëëåðû ÀVR â ðàäèîëþáèòåëüñêîé
ïðàêòèêå – ÑÏ-á, Íàóêà è òåõíèêà, 2007 – 352ñ.
2. Ïðîåêòèðîâàíèå
öèôðîâûõ óñòðîéñòâ íà îäíîêðèñòàëüíûõ ìèêðîêîíòðîëëåðàõ / Â.Â. Ñòàøèí [ è äð.].
– Ì.: Ýíåðãîàòîìèçäàò, 1990. – 224 ñ.
3. Åâñòèôååâ À.Â.
Ìèêðîêîíòðîëëåðû Microchip: ïðàêòè÷åñêîå ðóêîâîäñòâî/À.Â.Åâñòèôååâ. – Ì.:
Ãîðÿ÷àÿ ëèíèÿ – Òåëåêîì, 2002. – 296 ñ.
4. Êðàâ÷åíêî À.Â. 10 ïðàêòè÷åñêèõ óñòðîéñòâ íà AVR-ìèêðîêîíòðîëëåðàõ. Êíèãà
1 – Ì., Äîäýêà –ÕÕ1, ÌÊ-Ïðåññ, 2008 – 224ñ.
5.Òðàìïåðò Â. Èçìåðåíèå, óïðàâëåíèå è
ðåãóëèðîâàíèå ñ ïîìîùüþ ÀVR-ìèêðîêîíòðîëëåðîâ: Ïåð. ñ íåì – Ê., ÌÊ-Ïðåññ,
2006 – 208ñ.
6. Ìîðòîí Äæ. Ìèêðîêîíòðîëëåðû ÀVR. Ââîäíûé êóðñ /Ïåð. ñ
àíãë. – Ì., Äîäýêà –ÕÕ1, 2006 – 272ñ.
ÏÐÈËÎÆÅÍÈÅ
À
Ëèñòèíã ïðîãðàììû
è îáúåêòíûé ôàéë
;
; 2
ÒÅÐÌÎÌÅÒÐÀ Ñ ÏÀÌßÒÜÞ ÌÀÊÑÈÌÓÌÀ È ÌÈÍÈÌÓÌÀ.
; ÒÎ×ÍÎÑÒÜ
ÈÇÌÅÐÅÍÈß ÒÅÌÏÅÐÀÒÓÐÛ - 0,1 ÃÐÀÄÓÑ.
; ÄÀÒ×ÈÊÈ
ÒÅÌÏÅÐÀÒÓÐÛ - DS18B20,
; ÏÀÌßÒÜ ÍÀ 8
ÄÍÅÉ.
; ÈÍÄÈÊÀÖÈß -
16õ2 ÆÊÈ.
; ÐÀÇÐÀÁÎÒÀË
ÑÀÕÍÞÊ ÀËÅÊÑÀÍÄÐ ÞÐÜÅÂÈ×
; ÄËß
ÑÂÎÁÎÄÍÎÃÎ ÈÑÏÎËÜÇÎÂÀÍÈß
;
ã.ÑÅÂÅÐÎÄÎÍÅÖÊ ËÓÃÀÍÑÊÎÉ
; ÏÐÎÃÐÀÌÌÀ =
MAMIN.ASM
; ÂÅÐÑÈß:
24-01-06.
; ÀÑÑÅÌÁËÅÐ È
ÎÒËÀÄ×ÈÊ: MPLAB IDE, ÂÅÐÑÈß: 5.70.40.
;
LIST
P=16F628
#INCLUDE
P16F628.INC
__CONFIG 3F01H
;======================================================
;
ÈÑÏÎËÜÇÓÅÒÑß ÊÂÀÐÖ ×ÀÑÒÎÒÎÉ 4,096 MÃÖ.
; ÊÎÝÔÔÈÖÈÅÍÒ
ÄÅËÅÍÈß ÏÐÅÄÄÅËÈÒÅËß ÐÀÂÅÍ 16, ×ÒÎ ÂÌÅÑÒÅ
; Ñ TMR0
(256) È ÖÈÊËÎÌ, ÐÀÂÍÛÌ 4 ÒÀÊÒÀÌ, ÄÅËÈÒÅËÅÌ ÍÀ 125, 2
; ÄÀÅÒ ÍÀ
ÂÛÕÎÄÅ 1 ÑÅÊÓÍÄÓ (4õ16õ256x250=4096000).
;======================================================
; RB4-RB7 -
ÄÀÍÍÛÅ LCD,
; RB2 - RS,
RB3 - E,
; RB1 -
ÊÍÎÏÊÀ "ÐÀÇÐßÄ".
; RB0 -
ÊÍÎÏÊÀ "ÐÅÆÈÌ".
; RA0 -
ÂÕÎÄ/ÂÛÕÎÄ ÍÀ DS18B20 - 2.
; RA4 -
ÂÕÎÄ/ÂÛÕÎÄ ÍÀ DS18B20 - 1.
; RA5 - ÏÐÎÑÌÎÒÐ
1-2. RB5 - ÏÐÎÑÌÎÒÐ -1. RB6 - ÓÑÒÀÍÎÂÊÀ +.
;==============================================
; ÐÅÃÈÑÒÐÛ
ÎÁÙÅÃÎ ÍÀÇÍÀ×ÅÍÈß.
;==============================================
CBLOCK H'20'
CEK;ÑÅÊÓÍÄÛ
ÄÂÎÈ×ÍÛÅ.
MIN;ÌÈÍÓÒÛ
ÄÂÎÈ×ÍÛÅ.
HOU;×ÀÑÛ
ÄÂÎÈ×ÍÛÅ.
MINL;ÅÄÈÍÈÖÛ
ÌÈÍÓÒ.
MINH;ÄÅÑßÒÊÈ
ÌÈÍÓÒ.
HOUL;ÅÄÈÍÈÖÛ
×ÀÑÎÂ.
HOUH;ÄÅÑßÒÊÈ
×ÀÑÎÂ.
TEMP;ÂÐÅÌÅÍÍÛÉ.
COUN;Ñ×ÅÒ×ÈÊ
ÁÈÒÎÂ, Ñ×ÅÒ×ÈÊ ÏÅÐÅÑ×ÅÒÀ.
LSB;ÐÅÃÈÑÒÐ
ÄÀÍÍÛÕ DS.
LSBH;ÑÒÀÐØÈÉ
ÐÅÃÈÑÒÐ Ñ×ÈÒÛÂÀÍÈß.
MCK;ÌÈËËÈÑÅÊÓÍÄ.
WTEMP;ÂÐÅÌÅÍÍÛÉ.
STEMP;ÂÐÅÌÅÍÍÛÉ.
FTEMP;ÂÐÅÌÅÍÍÛÉ.
REID;ÐÅÆÈÌ
ÈÍÄÈÊÀÖÈÈ.
KYPC;ÊÓÐÑÎÐÀ.
SOT2;ÇÍÀÊ 2.
SOT2X;ÇÍÀÊ 2
MAX.
SOT2N;ÇÍÀÊ 2
MIN.
EDI2;ÅÄÈÍÈÖÛ
2.
DES2;ÄÅÑßÒÊÈ
2.
DST2;ÄÅÑßÒÛÅ
2.
SOT1;ÇÍÀÊ 1.
SOT1X;ÇÍÀÊ 1
MAX.
SOT1N;ÇÍÀÊ 1
MIN.
EDI1;ÅÄÈÍÈÖÛ
1.
DES1;ÄÅÑßÒÊÈ
1.
DST1;ÄÅÑßÒÛÅ
1.
DHU;ÄÍÈ
ÄÂÎÈ×ÍÛÅ.
DHUE;ÅÄÈÍÈÖÛ
ÄÍÅÉ.
DHUD;ÄÅÑßÒÊÈ
ÄÍÅÉ.
MEC;ÌÅÑßÖ
ÄÂÎÈ×ÍÛÉ.
MECE;ÅÄÈÍÈÖÛ
ÌÅÑßÖÀ.
MECD;ÄÅÑßÒÊÈ
ÌÅÑßÖÀ.
FLAG;
FLAG1;
FLAG2;
MECDI;ÄÅÑßÒÊÈ
ÌÅÑßÖÀ ÈÍÄÈÊÀÖÈÈ.
MECEI;ÅÄÈÍÈÖÛ
ÌÅÑßÖÀ ÈÍÄÈÊÀÖÈÈ.
DHUDI;ÄÅÑßÒÊÈ
ÄÍÅÉ ÈÍÄÈÊÀÖÈÈ.
DHUEI;ÅÄÈÍÈÖÛ
ÄÍÅÉ ÈÍÄÈÊÀÖÈÈ.
DHUZ;ÄÂÎÈ×ÍÛÅ
ÄÍÈ ÇÀÏÈÑÈ/Ñ×ÈÒÛÂÀÍÈß.
MECZ;ÄÂÎÈ×ÍÛÉ
ÌÅÑßÖ ÇÀÏÈÑÈ/Ñ×ÈÒÛÂÀÍÈß.
MIN1X;ÅÄÈÍÈÖÛ
ÌÈÍÓÒ 1.
MIN1N;ÄÅÑßÒÊÈ
ÌÈÍÓÒ 1.
HOU1X;ÅÄÈÍÈÖÛ
×ÀÑΠ1.
HOU1N;ÄÅÑßÒÊÈ
×ÀÑΠ1.
MIN2X;ÅÄÈÍÈÖÛ
ÌÈÍÓÒ 2.
MIN2N;ÄÅÑßÒÊÈ
ÌÈÍÓÒ 2.
HOU2X;ÅÄÈÍÈÖÛ
×ÀÑΠ2.
HOU2N;ÄÅÑßÒÊÈ
×ÀÑΠ2.
COUZ;Ñ×ÅÒ×ÈÊ
ÇÀÏÈÑÈ.
COUE;Ñ×ÅÒ×ÈÊ
Ñ×ÈÒÛÂÀÍÈß.
COYC;Ñ×ÅÒ×ÈÊ
ÓÑÒÀÍÎÂÊÈ ÄÍÅÉ ÏÐÎÑÌÎÒÐÀ.
LSB1X;ÑÎÕÐÀÍÅÍÍÎÅ
ÌÀÊÑÈÌÀËÜÍÎÅ 1 ÄÀÒ×ÈÊÀ.
LSB1N;ÑÎÕÐÀÍÅÍÍÎÅ
ÌÈÍÈÌÀËÜÍÎÅ 1 ÄÀÒ×ÈÊÀ.
LSB2X;ÑÎÕÐÀÍÅÍÍÎÅ
ÌÀÊÑÈÌÀËÜÍÎÅ 2 ÄÀÒ×ÈÊÀ.
LSB2N;ÑÎÕÐÀÍÅÍÍÎÅ
ÌÈÍÈÌÀËÜÍÎÅ 2 ÄÀÒ×ÈÊÀ.
DST1X;ÑÎÕÐÀÍÅÍÍÎÅ
ÌÀÊÑÈÌÀËÜÍÎÅ ÄÅÑßÒÛÕ 1 ÄÀÒ×ÈÊÀ.
DST1N;ÑÎÕÐÀÍÅÍÍÎÅ
ÌÈÍÈÌÀËÜÍÎÅ ÄÅÑßÒÛÕ 1 ÄÀÒ×ÈÊÀ.
DST2X;ÑÎÕÐÀÍÅÍÍÎÅ
ÌÀÊÑÈÌÀËÜÍÎÅ ÄÅÑßÒÛÕ 2 ÄÀÒ×ÈÊÀ.
DST2N;ÑÎÕÐÀÍÅÍÍÎÅ
ÌÈÍÈÌÀËÜÍÎÅ ÄÅÑßÒÛÕ 2 ÄÀÒ×ÈÊÀ.
ENDC
R1EQU60H;ÐÅÃÈÑÒÐÛ
ÈÍÄÈÊÀÖÈÈ.
R2EQU61H;
R3EQU62H;
R4EQU63H;
R5EQU64H;
R6EQU65H;
R7EQU66H;
R8EQU67H;
R9EQU68H;
R10EQU69H;
R11EQU6AH;
R12EQU6BH;
R13EQU6CH;
R14EQU6DH;
R15EQU6EH;
R16EQU6FH;
HOUZ1XEQU70H;ÐÅÃÈÑÒÐÛ ÄËß ÇÀÏÈÑÈ/Ñ×ÈÒÛÂÀÍÈß, ×ÀÑÛ ÄÂÎÈ×ÍÛÅ 1 MAX.
MINZ1XEQU71H;ÌÈÍÓÒÛ
ÄÂÎÈ×ÍÛÅ 1 MAX.
LSBZ1XEQU72H;ÑÎÕÐÀÍÅÍÍÎÅ
ÌÀÊÑÈÌÀËÜÍÎÅ 1 ÄÀÒ×ÈÊÀ.
DSTZ1XEQU73H;ÑÎÕÐÀÍÅÍÍÎÅ
ÌÀÊÑÈÌÀËÜÍÎÅ ÄÅÑßÒÛÕ 1 ÄÀÒ×ÈÊÀ.
HOUZ1NEQU74H;×ÀÑÛ
ÄÂÎÈ×ÍÛÅ 1 MIN.
MINZ1NEQU75H;ÌÈÍÓÒÛ
ÄÂÎÈ×ÍÛÅ 1 MIN.
LSBZ1NEQU76H;ÑÎÕÐÀÍÅÍÍÎÅ
ÌÈÍÈÌÀËÜÍÎÅ 1 ÄÀÒ×ÈÊÀ.
DSTZ1NEQU77H;ÑÎÕÐÀÍÅÍÍÎÅ
ÌÈÍÈÌÀËÜÍÎÅ ÄÅÑßÒÛÕ 1 ÄÀÒ×ÈÊÀ.
HOUZ2XEQU78H;ÐÅÃÈÑÒÐÛ
ÇÀÏÈÑÈ/Ñ×ÈÒÛÂÀÍÈß, ×ÀÑÛ ÄÂÎÈ×ÍÛÅ 2 MAX.
MINZ2XEQU79H;ÌÈÍÓÒÛ
ÄÂÎÈ×ÍÛÅ 2 MAX.
LSBZ2XEQU7AH;ÑÎÕÐÀÍÅÍÍÎÅ
ÌÀÊÑÈÌÀËÜÍÎÅ 2 ÄÀÒ×ÈÊÀ.
DSTZ2XEQU7BH;ÑÎÕÐÀÍÅÍÍÎÅ
ÌÀÊÑÈÌÀËÜÍÎÅ ÄÅÑßÒÛÕ 2 ÄÀÒ×ÈÊÀ.
HOUZ2NEQU7CH;×ÀÑÛ
ÄÂÎÈ×ÍÛÅ 2 MIN.
MINZ2NEQU7DH;ÌÈÍÓÒÛ
ÄÂÎÈ×ÍÛÅ 2 MIN.
LSBZ2NEQU7EH;ÑÎÕÐÀÍÅÍÍÎÅ
ÌÈÍÈÌÀËÜÍÎÅ 2 ÄÀÒ×ÈÊÀ.
DSTZ2NEQU7FH;ÑÎÕÐÀÍÅÍÍÎÅ
ÌÈÍÈÌÀËÜÍÎÅ ÄÅÑßÒÛÕ 2 ÄÀÒ×ÈÊÀ.
;==============================================
; ÎÏÐÅÄÅËÅÍÈÅ
ÁÈÒΠÑÎÑÒÎßÍÈß ÐÅÃÈÑÒÐΠÔËÀÃÎÂ.
;==============================================
;FLAG
;0-> ÇÍÀÊ
1 ÌÀÊÑ.
;1-> ÇÍÀÊ
1 ÌÈÍ.
;2->
ÊÍÎÏÊÈ "ÓÑÒÀÍÎÂÊÀ -".
;3->
ÊÍÎÏÊÈ "ÓÑÒÀÍÎÂÊÀ +".
;4->
ÊÍÎÏÊÈ "ÐÅÆÈÌ".
;5->
ÊÍÎÏÊÈ "ÐÀÇÐßÄ".
;6->
×ÅÐÅÄÎÂÀÍÈß ÊÓÐÑÎÐÀ È ÈÍÄÈÊÀÖÈÈ.
;7->
ÄÅËÈÒÅËÜ ÍÀ 2 (1 CEK).
;FLAG1
;0->
ÓÑÒÀÍÎÂÊÈ.
;1->
ÏÐÎÑÌÎÒÐÀ ÒÅÌÏÅÐÀÒÓÐÛ: 1>2, 0>1.
;2->
ÇÀÏÐÅÒ ÈÍÄÈÊÀÖÈÈ.
;3->
ÇÍÀÊÀ. 1-ÌÈÍÓÑ.
;4->
ÍÀ×ÀËÜÍÀß ÏÀÓÇÀ 1.
;5-> ÍÎËÜ,
ÊÍÎÏÊÈ "ÏÐÎÑÌÎÒÐ 1-2".
;6->
ÍÀ×ÀËÜÍÀß ÏÀÓÇÀ 2.
;FLAG2;ÔËÀÃ
ÈÍÄÈÊÀÖÈÈ.
;0->
ÒÅÊÓÙÈÅ ÄÀÒÀ, ÂÐÅÌß, ÒÅÌÏÅÐÀÒÓÐÀ.
;1->
ÓÑÒÀÍÎÂÊÀ ×ÀÑÎÂ, ÄÀÒÛ.
;2-> ÐÅÆÈÌ
ÏÐÎÑÌÎÒÐÀ ÒÅÌÏÅÐÀÒÓÐÛ.
;3-> ÇÍÀÊ
2 ÌÀÊÑ.
;4-> ÇÍÀÊ
2 ÌÈÍ.
;5-> ÔËÀÃ
ÂÛÏÎËÍÅÍÍÎÉ ÓÑÒÀÍÎÂÊÈ ÌÈÍÓÑ.
;6->
ÓÑÒÀÍÎÂÊÈ Ñ×ÅÒ×ÈÊÀ ÄÍÅÉ ÏÐÎÑÌÎÒÐÀ.
;=======================================
DS2EQU0;ÂÛÕÎÄ
DS2.
DS1EQU4;ÂÛÕÎÄ
DS1.
RSEQU2;ÊÎÌÀÍÄÀ/ÄÀÍÍÛÅ.
EEQU3;ÑÈÍÕÐÎÍÈÇÀÖÈß.
YCPLEQU6;ÓÑÒÀÍÎÂÊÀ
ÏËÞÑ.
YCMIEQU5;ÓÑÒÀÍÎÂÊÀ
ÌÈÍÓÑ.
PAZEQU1;ÐÀÇÐßÄ.
PEJEQU0;ÐÅÆÈÌ.
HOLEQU5;ÑÁÐÎÑ.
;=======================================
; 1. ÏÓÑÊ.
;======================
ORG 0
GOTOINIT
ORG 4
GOTOPRER
;=========================================
; 2. ÏÅÐÅÂÎÄ
ÄÎËÅÉ ÃÐÀÄÓÑÀ Ñ ÎÊÐÓÃËÅÍÈÅÌ.
;=========================================
DESATI
ADDWFPCL,1;
RETLW.0;0
RETLW.1;1
RETLW.1;2
RETLW.2;3
RETLW.3;4
RETLW.3;5
RETLW.4;6
RETLW.4;7
RETLW.5;8
RETLW.6;9
RETLW.6;10
RETLW.7;11
RETLW.7;12
RETLW.8;13
RETLW.9;14
RETLW.9;15
;============================
; 3. ÇÀÃÐÓÇÊÀ
×ÈÑÅË Â ÌÅÑßÖÅ.
;============================
DAYMON
ADDWF
PCL,F ;
NOP
;0
RETLW
.32 ;1-ßÍÂÀÐÜ
RETLW
.29 ;2-ÔÅÂÐÀËÜ
RETLW
.32 ;3-ÌÀÐÒ
RETLW
.31 ;4-ÀÏÐÅËÜ
RETLW
.32 ;5-ÌÀÉ
RETLW
.31 ;6-ÈÞÍÜ
RETLW
.32 ;7-ÈÞËÜ
RETLW
.32 ;8-ÀÂÃÓÑÒ
RETLW
.31 ;9-ÑÅÍÒßÁÐÜ
RETLW
.32 ;10-ÎÊÒßÁÐÜ
RETLW
.31 ;11-ÍÎßÁÐÜ
RETLW
.32 ;12-ÄÅÊÀÁÐÜ
;=======================================
; 4. ÂÛÁÎÐ
ÐÅÆÈÌÀ ÈÍÄÈÊÀÖÈÈ.
;=======================================
VUBOR
BTFSSPORTB,PEJ;ÅÑËÈ
ÊÍÎÏÊÀ ÍÀÆÀÒÀ,
RETURN;ÒÎ
ÂÛÁÎÐÀ ÍÅÒ.
BCFFLAG,4;ÑÁÐÎÑ
ÔËÀÃÀ ÐÅÆÈÌÀ.
MOVFWREID;ÏÎ
ÍÎÌÅÐÓ
ADDWFPCL,1;ÂÛÁÈÐÀÅÌ
ÈÍÄÈÊÀÖÈÞ.
GOTOINDT;ÒÅÊÓÙÀß.
GOTOINDYC;ÓÑÒÀÍÎÂÊÀ
ÄÀÒÛ, ×ÀÑÎÂ.
GOTOINPRO;ÏÐÎÑÌÎÒÐ.
INDT
CALLREGIN;ÂÎÑÑÒÀÍÎÂÈÌ
ÐÅÃÈÑÒÐÛ.
BTFSCFLAG2,0;ÅÑËÈ
ÓÑÒÀÍÎÂÊÈ ÑÄÅËÀÍÛ ÐÀÍÅÅ,
RETURN;ÒÎ
ÂÅÐÍÅÌÑß.
BCFFLAG2,1;ÑÁÐÎÑÈÌ:
ÓÑÒÀÍÎÂÊÓ ×ÀÑÎÂ,
BCFFLAG2,2;ÏÐÎÑÌÎÒÐ,
BCFFLAG1,0;ÎÁÙÓÞ
ÓÑÒÀÍÎÂÊÓ,
BCFFLAG2,6;Ñ×ÅÒ×ÈÊÀ
ÄÍÅÉ,
BCFFLAG2,5;ÂÛÏÎËÍÅÍÍÎÉ
ÓÑÒÀÍÎÂÊÈ.
CALLZHAKCOX;ÂÎÑÑÒÀÍÎÂÈÌ
ÇÍÀ×ÅÍÈß ÈÍÄÈÊÀÖÈÈ.
BSFFLAG2,0;ÓÑÒÀÍÎÂÈÌ
ÒÅÊÓÙÓÞ ÈÍÄÈÊÀÖÈÞ.
RETURN
INDYC
CALLREGIN;ÂÎÑÑÒÀÍÎÂÈÌ
ÇÍÀ×ÅÍÈß ÄÀÒÛ.
BTFSCFLAG2,1;ÅÑËÈ
ÓÑÒÀÍÎÂÊÈ ÑÄÅËÀÍÛ ÐÀÍÅÅ,
RETURN;ÒÎ
ÂÅÐÍÅÌÑß.
BSFFLAG1,0;ÓÑÒÀÍÎÂÊÀ.
BCFFLAG2,0;ÑÁÐÎÑÈÌ:
ÒÅÊÓÙÓÞ ÈÍÄÈÊÀÖÈÞ,
BCFFLAG2,2;ÏÐÎÑÌÎÒÐ.
CLRFKYPC;ÎÁÍÓËÈÌ
ÊÓÐÑÎÐ.
BSFFLAG2,1;ÓÑÒÀÍÎÂÊÀ
ÄÀÒÛ, ×ÀÑÎÂ.
RETURN
INPRO
BTFSCFLAG2,2;ÅÑËÈ
ÓÑÒÀÍÎÂÊÈ ÑÄÅËÀÍÛ ÐÀÍÅÅ,
GOTO$+6;ÒÎ
ÏÐÎÂÅÐÈÌ ÊÍÎÏÊÓ.
MOVLW.8;ÓÑÒÀÍÎÂÈÌ
ÊÓÐÑÎÐ.
MOVWFKYPC;
BCFFLAG2,0;ÑÁÐÎÑÈÌ:
ÒÅÊÓÙÓÞ ÈÍÄÈÊÀÖÈÞ,
BCFFLAG2,1;ÓÑÒÀÍÎÂÊÓ
ÄÀÒÛ, ×ÀÑÎÂ.
BSFFLAG2,2;ÓÑÒÀÍÎÂÈÌ
ÐÅÆÈÌ ÏÐÎÑÌÎÒÐÀ.
BTFSCFLAG1,5;ÅÑËÈ
ÊÍÎÏÊÀ ÏÐÎÑÌÎÒÐÀ 1-2 ÁÛËÀ ÍÀÆÀÒÀ ÐÀÍÅÅ,
GOTO$+5;ÒÎ
ÈÄÅÌ ÍÀ ÓÑÒÀÍÎÂÊÓ ÔËÀÃÀ.
BTFSSPORTA,HOL;ÅÑËÈ
ÊÍÎÏÊÀ ÍÀÆÀÒÀ,
BSFFLAG1,5;ÓÑÒÀÍÎÂÈÌ
ÔËÀÃ ÊÍÎÏÊÈ.
BTFSSPORTA,HOL;ÏÎÊÀ
ÊÍÎÏÊÀ ÍÀÆÀÒÀ,
RETURN;ÓÑÒÀÍÎÂÊÈ
ÍÅÒ.
BTFSSFLAG1,5;ÅÑËÈ
ÊÍÎÏÊÀ ÏÐÎÑÌÎÒÐÀ 1-2 ÁÛËÀ ÍÀÆÀÒÀ ÐÀÍÅÅ,
RETURN;
BCFFLAG1,5;ÑÁÐÎÑÈÌ
ÔËÀÃ ÊÍÎÏÊÈ.
BTFSCFLAG1,1;
GOTO$+3;
BSFFLAG1,1;ÈÇÌÅÍÈÌ
ÑÎÑÒÎßÍÈÅ ÔËÀÃÀ ÏÐÎÑÌÎÒÐÀ
RETURN
BCFFLAG1,1;ÍÀ
ÏÐÎÒÈÂÎÏÎËÎÆÍÎÅ.
RETURN
;=======================================
; 5. ÂÛÁÎÐ
ÐÀÇÐßÄÀ ÓÑÒÀÍÎÂÊÈ.
;=======================================
YCTAL
BTFSSPORTB,YCPL;ÅÑËÈ
ÊÍÎÏÊÀ ÏËÞÑ ÍÀÆÀÒÀ,
RETURN;ÒÎ
ÂÛÁÎÐÀ ÍÅÒ.
BCFFLAG,3;ÑÁÐÎÑ
ÔËÀÃÀ ÐÅÆÈÌÀ.
BTFSCFLAG2,2;ÏÐÈ
ÏÐÎÑÌÎÒÐÅ
RETURN;ÊÍÎÏÊÀ
ÏËÞÑ ÍÅ ÐÀÁÎÒÀÅÒ.
BCFFLAG,2;ÑÁÐÎÑ
ÔËÀÃÀ ÐÅÆÈÌÀ.
BCFFLAG1,2;ÈÍÄÈÊÀÖÈß
ÐÀÇÐÅØÅÍÀ.
MOVFWKYPC;ÏÎ
ÊÓÐÑÎÐÓ
ADDWFPCL,1;ÍÀÕÎÄÈÌ
ÐÀÇÐßÄ ÓÑÒÀÍÎÂÊÈ.
GOTOYC0;ÄÅÑßÒÊÈ
×ÀÑÎÂ.
GOTOYC1;ÅÄÈÍÈÖÛ
×ÀÑÎÂ.
GOTOYC2;ÄÅÑßÒÊÈ
ÌÈÍÓÒ.
GOTOYC3;ÅÄÈÍÈÖÛ
ÌÈÍÓÒ.
GOTOYC4;ÄÅÑßÒÊÈ
ÄÍÅÉ.
GOTOYC5;ÅÄÈÍÈÖÛ
ÄÍÅÉ.
GOTOYC6;ÄÅÑßÒÊÈ
ÌÅÑßÖÀ.
GOTOYC7;ÅÄÈÍÈÖÛ
ÌÅÑßÖÀ.
YCTAM
BTFSCFLAG2,1;ÅÑËÈ
ÓÑÒÀÍÎÂÊÀ ÄÀÒÛ, ×ÀÑÎÂ,
RETURN;ÒÎ
ÂÛÁÎÐÀ ÍÅÒ.
BTFSSPORTB,YCMI;ÅÑËÈ
ÊÍÎÏÊÀ ÌÈÍÓÑ ÍÀÆÀÒÀ,
RETURN;ÒÎ
ÂÛÁÎÐÀ ÍÅÒ.
BCFFLAG,2;
BCFFLAG1,2;ÈÍÄÈÊÀÖÈß
ÐÀÇÐÅØÅÍÀ.
GOTOYC8M;ÅÄÈÍÈÖÛ
ÄÍÅÉ ÏÐÎÑÌÎÒÐÀ.
;=========================================
; 6.
ÈÍÄÈÊÀÖÈß ÊÓÐÑÎÐÀ.
;=========================================
JEKYC
MOVLW.14;ÐÀÇÐÅØÀÅÌ
ÌÈÃÀÍÈÅ ÊÓÐÑÎÐÀ.
CALL JEKOM;ÇÀÏÈØÅÌ
ÊÎÌÀÍÄÓ.
CALLJEKYK;ÍÀ
ÂÛÁÎÐ ÌÈÃÀÞÙÅÃÎ ÐÀÇÐßÄÀ.
CALL JEKOM;ÇÀÏÈØÅÌ
ÊÎÌÀÍÄÓ.
BSFFLAG,6;ÂÛÏÎËÍÅÍÀ
ÈÍÄÈÊÀÖÈß ÊÓÐÑÎÐÀ.
RETURN
JEKYK
MOVFWKYPC;ÐÅÃÈÑÒÐ
ÊÓÐÑÎÐÀ -  ÐÀÁÎ×ÈÉ.
ADDWFPCL,1;
RETLW0x85;ÄÅÑßÒÊÈ
×ÀÑÎÂ.
RETLW0x86;ÅÄÈÍÈÖÛ
×ÀÑÎÂ.
RETLW0x88;ÄÅÑßÒÊÈ
ÌÈÍÓÒ.
RETLW0x89;ÅÄÈÍÈÖÛ
ÌÈÍÓÒ.
RETLW0xC5;ÄÅÑßÒÊÈ
ÄÍÅÉ.
RETLW0xC6;ÅÄÈÍÈÖÛ
ÄÍÅÉ.
RETLW0xC8;ÄÅÑßÒÊÈ
ÌÅÑßÖÀ.
RETLW0xC9;ÅÄÈÍÈÖÛ
ÌÅÑßÖÀ.
RETLW0x81;ÅÄÈÍÈÖÛ
ÄÍÅÉ.
;======================================================
; 7. ÒÀÁËÈÖÛ
ÏÅÐÅÂÎÄÀ ÄÅÑßÒÊΠ ÄÂÎÈ×ÍÎÅ ×ÈÑËÎ.
;======================================================
DEBIN
ADDWFPCL,1;
RETLW.0
RETLW.10
RETLW.20
RETLW.30
RETLW.40
RETLW.50
;===============================================
; 8.
ÂÎÑÑÒÀÍÎÂËÅÍÈÅ ÇÍÀÊÀ ÏÎÑËÅ ÏÐÎÑÌÎÒÐÀ.
;===============================================
ZHAKCOX
MOVLW.251;ÏÎ
ÓÌÎË×ÀÍÈÞ ÇÍÀÊ ÏËÞÑ.
MOVWFSOT1X;
BTFSSFLAG,0;ÅÑËÈ
ÈÍÀ×Å,
GOTO$+3;ÒÎ
ÓÑÒÀÍÎÂÈÌ
MOVLW.253;ÌÈÍÓÑ.
MOVWFSOT1X;
MOVLW.251;ÏÎ
ÓÌÎË×ÀÍÈÞ ÇÍÀÊ ÏËÞÑ.
MOVWFSOT1N;
BTFSSFLAG,1;ÅÑËÈ
ÈÍÀ×Å,
GOTO$+3;ÒÎ
ÓÑÒÀÍÎÂÈÌ
MOVLW.253;ÌÈÍÓÑ.
MOVWFSOT1N;
MOVLW.251;ÏÎ
ÓÌÎË×ÀÍÈÞ ÇÍÀÊ ÏËÞÑ.
MOVWFSOT2X;
BTFSSFLAG2,3;ÅÑËÈ
ÈÍÀ×Å,
GOTO$+3;ÒÎ
ÓÑÒÀÍÎÂÈÌ
MOVLW.253;ÌÈÍÓÑ.
MOVWFSOT2X;
MOVLW.251;ÏÎ
ÓÌÎË×ÀÍÈÞ ÇÍÀÊ ÏËÞÑ.
MOVWFSOT2N;
BTFSSFLAG2,4;ÅÑËÈ
ÈÍÀ×Å,
GOTO$+3;ÒÎ
ÓÑÒÀÍÎÂÈÌ
MOVLW.253;ÌÈÍÓÑ.
MOVWFSOT2N;
RETURN
;=================================================
; 9.
ÓÑÒÀÍÎÂÊÀ ÊÓÐÑÎÐÀ (ÂÛÁÎÐ ÐÀÇÐßÄÀ ÓÑÒÀÍÎÂÊÈ).
;=================================================
KYPCY
BTFSCFLAG2,2;ÅÑËÈ
ÈÄÅÒ ÏÐÎÑÌÎÒÐ,
RETURN;ÓÑÒÀÍÎÂÊÀ
ÍÅ ÌÅÍßÅÒÑß.
BTFSSFLAG2,1;ÓÑÒÀÍÎÂÊÀ
ÂÎÇÌÎÆÍÀ,
RETURN;ÅÑËÈ
ÈÍÄÈÊÀÖÈß ÓÑÒÀÍÎÂÊÈ ×ÀÑÎÂ.
BTFSSPORTB,PAZ;ÏÐÈ
ÍÀÆÀÒÎÉ ÊÍÎÏÊÅ
RETURN;ÓÑÒÀÍÎÂÊÀ
ÍÅ ÌÅÍßÅÒÑß.
BCFFLAG,5;ÑÁÐÎÑÈÌ
ÔËÀÃ.
INCFKYPC,1;ÏÐÈÁÀÂÈÌ
ÅÄÈÍÈÖÓ Â ÊÓÐÑÎÐ.
MOVLW.8;ÍÅ
ÁÎËÅÅ 7.
SUBWFKYPC,0;
SKPNC;
CLRFKYPC;ÈÍÀ×Å
ÎÁÍÓËÈÌ ÊÓÐÑÎÐ.
RETURN;
;=========================================
; 10.
ÈÍÈÖÈÀËÈÇÀÖÈß DS2.
;=========================================
INIDS2
CALLHYL2;ÏÎÑÛË
ÈÌÏÓËÜÑÀ ÎÁÍÓËÅÍÈß.
MOVLW0xCC;ÏÐÎÏÓÑÊ
ÍÎÌÅÐÀ.
CALLPOSIL2;ÏÎØËÅÌ.
MOVLW0x4E;ÐÀÇÐÅØÀÅÌ
ÇÀÏÈÑÜ ÓÑÒÀÍÎÂÊÈ 0,1 ÃÐÀÄÓÑÀ.
CALLPOSIL2;ÏÎØËÅÌ.
MOVLW0x7D;ÂÅÐÕÍÈÉ
ÏÐÅÄÅË +125. ÌÎÆÍÎ ÏÎÑÒÀÂÈÒÜ ËÞÁÎÅ ÇÍÀ×ÅÍÈÅ.
CALLPOSIL2;ÏÎØËÅÌ.
MOVLW0x77;ÍÈÆÍÈÉ
ÏÐÅÄÅË -55. ËÞÁÎÉ.
CALLPOSIL2;ÏÎØËÅÌ.
MOVLW0x7F;ÊÎÍÔÈÃÓÐÀÖÈß
11 = 0,1 ÃÐÀÄÓÑ.
CALLPOSIL2;ÏÎØËÅÌ.
CALLHYL2;ÏÎÑÛË
ÈÌÏÓËÜÑÀ ÎÁÍÓËÅÍÈß.
MOVLW0xCC;ÏÐÎÏÓÑÊ
ÏÎÑÛËÀ ÍÎÌÅÐÀ DS.
CALLPOSIL2;ÏÎØËÅÌ.
MOVLW0x44;ÐÀÇÐÅØÀÅÌ
ÏÐÅÎÁÐÀÇÎÂÀÍÈÅ.
CALLPOSIL2;ÏÎØËÅÌ.
MOVLW.3;ÏÀÓÇÀ 0,75 ÑÅÊ.
MOVWFCOUN;ÌÀÊÑÈÌÀËÜÍÎ 750 ÌÑ.
SPLU
MOVLW .255
MOVWF TEMP
PLUS
MOVLW
.255
ADDLW
-1
BTFSS
STATUS,2
GOTO
$-2
DECFSZ
TEMP,1
GOTO
PLUS
DECFSZCOUN,1
GOTOSPLU
GOTOPRIEM2;ÍÀ ÏÐÈÅÌ ÒÅÌÏÅÐÀÒÓÐÛ.
HYL2
CALLWUX2;ÂÛÕÎÄ ÍÓËß.
MOVLW.125;ÍÓËÅÂÎÉ ÈÌÏÓËÜÑ
ADDLW-1;=
500 ÌÊÑ.
BTFSSSTATUS,2;
GOTO$-2;
CALLWXO2;ÂÛÕÎÄ ÅÄÈÍÈÖÛ.
MOVLW.125;ÈÌÏÓËÜÑ =
ADDLW-1;500
ÌÊÑ.
BTFSSSTATUS,2;
GOTO$-2;
RETURN
;=======================================
; 11.
ÈÇÌÅÍÅÍÈÅ ÂÕÎÄÀ ÍÀ ÏÐÈÅÌ/ÏÅÐÅÄÀ×Ó.
;=======================================
WUX2
BCFPORTA,DS2;
BSFSTATUS,5;ÏÅÐÅÕÎÄÈÌ
 ÁÀÍÊ 1.
BCFTRISA^80H,DS2;ÍÀ
ÂÛÕÎÄ.
BCFSTATUS,5;ÏÅÐÅÕÎÄÈÌ
 ÁÀÍÊ 0.
RETURN
WXO2
BSFSTATUS,5;ÏÅÐÅÕÎÄÈÌ
 ÁÀÍÊ 1.
BSFTRISA^80H,DS2;ÍÀ
ÂÕÎÄ.
BCFSTATUS,5;ÏÅÐÅÕÎÄÈÌ
 ÁÀÍÊ 0.
RETURN
;====================================
; 12. ÏÐÈÅÌ
16 ÁÈÒ ÎÒ DS2.
;====================================
PRIEM2
CALLHYL2;ÏÎÑÛË
ÈÌÏÓËÜÑÀ ÎÁÍÓËÅÍÈß.
MOVLW0xCC;ÏÐÎÏÓÑÊ
ÍÎÌÅÐÀ.
CALLPOSIL2;ÏÎÑÛË.
MOVLW0xBE;×ÒÅÍÈÅ
ÒÅÌÏÅÐÀÒÓÐÛ ÈÇ ÁËÎÊÍÎÒÀ.
CALLPOSIL2;ÏÎÑÛË.
BCFINTCON,7;ÇÀÏÐÅÒ
ÏÐÅÐÛÂÀÍÈÉ.
CALL
PRIE2;ÍÀ ÏÐÈÅÌ.
MOVFWLSBH;ÏÅÐÅÏÈØÅÌ
ÏÐÈÍßÒÛÉ ÁÀÉÒ
MOVWFLSB;Â ÌËÀÄØÈÉ
ÐÅÃÈÑÒÐ.
BCFINTCON,7;ÇÀÏÐÅÒ
ÏÐÅÐÛÂÀÍÈÉ.
CALLPRIE2;È
ÏÐÈÌÅÌ ÑÒÀÐØÈÉ ÁÀÉÒ.
GOTOCXET2;ÍÀ
ÏÅÐÅÑ×ÅÒ.
PRIE2
MOVLW.8
MOVWFCOUN;ÇÀÏÈØÅÌ
×ÈÑËÎ ÁÈÒ.
CLRFLSBH;ÎÁÍÓËÈÌ
ÐÅÃÈÑÒÐ ÏÐÈÅÌÀ.
PRI2
CALLWUX2;ÂÛÄÀÅÌ
ÊÎÐÎÒÊÈÉ ÍÎËÜ È ÆÄÅÌ ÎÒÊËÈÊÀ.
CALLWXO2;ÍÀ
ÏÐÈÅÌ.
MOVLW.2;ÇÀÄÅÐÆÊÀ
CALLX4;8 ÌÊÑ.
MOVFWPORTA;ÏÅÐÅÏÈØÅÌ
MOVWFTEMP;ÇÍÀ×ÅÍÈÅ
ÏÎÐÒÀ.
BTFSSTEMP,DS2;
BCFSTATUS,0;ÓÑÒÀÍÎÂÈÌ
ÁÈÒ ÏÐÈÅÌÀ Â ÍÎËÜ.
BTFSCTEMP,DS2;
BSFSTATUS,0;ÈËÈ ÅÄÈÍÈÖÓ.
RRFLSBH,1;ÇÀÏÈØÅÌ
 ÐÅÃÈÑÒÐ.
MOVLW.12;ÎÁÙÀß
ÏÀÓÇÀ 60 ÌÊÑ.
CALLX4;
DECFSZCOUN,1;ÓÌÅÍÜØÈÌ
Ñ×ÅÒ×ÈÊ.
GOTOPRI2;ÏÎÂÒÎÐÈÌ
ÏÐÈÅÌ.
BSFINTCON,7;ÐÀÇÐÅØÀÅÌ
ÏÐÅÐÛÂÀÍÈß.
RETURN;ÂÅÐÍÅÌÑß.
;==========================================
; 13. ÏÎÑÛË
ÊÎÌÀÍÄÛ Â DS2.
;==========================================
POSIL2
BCFINTCON,7;ÇÀÏÐÅÒ
ÏÐÅÐÛÂÀÍÈÉ.
MOVWFTEMP;ÏÅÐÅÏÈØÅÌ
ÂÎ ÂÐÅÌÅÍÍÛÉ.
MOVLW.8;ÇÀÏÈØÅÌ
×ÈÑËÎ ÁÈÒ.
MOVWFCOUN;
POSI2
RRFTEMP,1;ÂÛÒÎËÊÍÅÌ
ÌËÀÄØÈÉ ÁÈÒ.
BTFSSSTATUS,0;ÅÑËÈ
ÎÍ ÍÓËÅÂÎÉ,
GOTOW0_2;ÏÎØËÅÌ
ÈÌÏÓËÜÑ ÍÓËß.
GOTOW1_2;ÈËÈ
ÅÄÈÍÈÖÛ.
POS2
DECFSZCOUN,1;ÓÌÅÍÜØÀÅÌ
Ñ×ÅÒ×ÈÊ.
GOTOPOSI2;ÍÀ
ÑËÅÄÓÞÙÈÉ ÁÈÒ.
BSFINTCON,7;ÐÀÇÐÅØÀÅÌ
ÏÐÅÐÛÂÀÍÈß.
RETURN;ÂÎÇÂÐÀÒ.
W0_2
CALLWUX2;ÓÑÒÀÍÎÂÈÌ
ÂÛÕÎÄ Â ÍÎËÜ.
MOVLW.15;ÓÄÅÐÆÈÂÀÅÌ
60 ÌÊÑ.
CALL X4;
CALLWXO2;ÍÀ
ÂÕÎÄ = 1 ÍÀ ÂÛÕÎÄÅ.
GOTOPOS2;ÏÎÂÒÎÐÈÌ.
W1_2
CALLWUX2;ÊÎÐÎÒÊÈÉ
ÍÓËÅÂÎÉ ÈÌÏÓËÜÑ.
CALLWXO2;ÍÀ
ÂÕÎÄ = 1 ÍÀ ÂÛÕÎÄÅ.
MOVLW.15;ÓÄÅÐÆÈÂÀÅÌ
60 ÌÊÑ.
CALLX4;
GOTOPOS2;ÏÎÂÒÎÐÈÌ.
;==================================
; 14.
ÂÛÄÅËÅÍÈÅ 2.
;==================================
CXET2
BTFSCFLAG1,6;ÇÀÄÅÐÆÊÀ
ÏÐÈ ÂÊËÞ×ÅÍÈÈ ÂÛÏÎËÍÅÍÀ.
GOTO$+3;
BSFFLAG1,6;ÇÀÄÅÐÆÊÀ
ÏÐÈ ÂÊËÞ×ÅÍÈÈ.
RETURN;
BCFFLAG1,3;ÏÎ
ÓÌÎË×ÀÍÈÞ ÇÍÀÊ ÏËÞÑ.
BTFSCLSBH,3;ÅÑËÈ
ÈÍÀ×Å,
BSFFLAG1,3;ÒÎ
ÓÑÒÀÍÎÂÈÌ ÌÈÍÓÑ.
BTFSSFLAG1,3;ÅÑËÈ
ÇÍÀÊ ÏËÞÑ,
GOTO$+7;ÒÎ ÍÅ
ÈÍÂÅÐÒÈÐÓÅÌ.
COMFLSB,1;ÏÐÎÈÍÂÅÐÒÈÐÓÅÌ
ÌËÀÄØÈÉ
COMFLSBH,1;È
ÑÒÀÐØÈÉ ÐÅÃÈÑÒÐÛ ÏÐÈÅÌÀ.
BCFSTATUS,0;
INCFLSB,1;ÏÐÈÁÀÂÈÌ
ÅÄÈÍÈÖÓ.
BTFSCSTATUS,0;ÅÑËÈ
ÅÑÒÜ ÏÅÐÅÍÎÑ,
INCFLSBH,1;ÒÎ
ÓÂÅËÈ×ÈÌ ÑÒÀÐØÈÉ ÐÅÃÈÑÒÐ.
MOVFWLSB;ÂÛÄÅËÈÌ
ÄÅÑßÒÛÅ.
ANDLWB'00001111';ÇÀÌÀÑÊÈÐÓÅÌ.
CALLDESATI;ÏÅÐÅÊÎÄÈÐÓÅÌ
Ñ ÎÊÐÓÃËÅÍÈÅÌ.
MOVWFDST2;ÇÀÏÈØÅÌ
 ÐÅÃÈÑÒÐ ÄÅÑßÒÛÕ.
MOVLW.4;ÑÄÂÈÃÎÌ
ÂÏÐÀÂÎ ÍÀ 4 ÐÀÇÐßÄÀ
MOVWFCOUN;
BCFSTATUS,0;ÂÛÄÅËÈÌ
ÖÅËÓÞ ×ÀÑÒÜ.
RRFLSBH,1;
RRFLSB,1;
DECFSZCOUN,1;
GOTO$-4;
MOVLW.251;ÏÎ
ÓÌÎË×ÀÍÈÞ ÇÍÀÊ ÏËÞÑ.
MOVWFSOT2;
BTFSSFLAG1,3;ÅÑËÈ
ÈÍÀ×Å,
GOTO$+3;ÒÎ
ÓÑÒÀÍÎÂÈÌ
MOVLW.253;ÌÈÍÓÑ.
MOVWFSOT2;
;======================================================
; 15. ÂÛÁÎÐ
ÑÐÀÂÍÅÍÈß ÏÎ ÑÎÕÐÀÍÅÍÍÎÌÓ È ÈÇÌÅÐÅÍÍÎÌÓ ÇÍÀÊÀÌ 2.
;======================================================
MAXZ2
MOVFWSOT2;ÅÑËÈ
ÑÎÕÐÀÍÅÍÍÛÉ
SUBWFSOT2X,0;È
ÈÇÌÅÐÅÍÍÛÉ ÇÍÀÊÈ ÐÀÂÍÛ,
SKPZ;ÒÎ
ÎÏÐÅÄÅËÈÌ ÇÍÀÊ.
GOTO$+5;
BTFSSFLAG1,3;ÅÑËÈ
ÇÍÀÊ ÏÎËÎÆÈÒÅËÜÍÛÉ,
GOTOCOPL2X;ÒÎ
ÑÐÀÂÍÈÌ ÍÀ ÏÐÅÂÛØÅÍÈÅ.
BTFSCFLAG1,3;ÅÑËÈ
ÇÍÀÊ ÎÒÐÈÖÀÒÅËÜÍÛÉ,
GOTOCOMI2X;ÒÎ
ÑÐÀÂÍÈÌ ÍÀ ÓÌÅÍÜØÅÍÈÅ.
SKPNC;ÅÑËÈ
ÈÇÌÅÐÅÍÍÛÉ ÇÍÀÊ ÌÅÍÜØÅ (+) ÑÎÕÐÀÍÅÍÍÎÃÎ,
GOTOCOXP2X;ÒÎ
ÑÎÕÐÀÍÈÌ ÈÇÌÅÐÅÍÍÎÅ ÇÍÀ×ÅÍÈÅ.
MINZ2
MOVFWSOT2;ÅÑËÈ
ÑÎÕÐÀÍÅÍÍÛÉ
SUBWFSOT2N,0;È
ÈÇÌÅÐÅÍÍÛÉ ÇÍÀÊÈ ÐÀÂÍÛ,
SKPZ;ÒÎ
ÎÏÐÅÄÅËÈÌ ÇÍÀÊ.
GOTO$+5;
BTFSCFLAG1,3;ÅÑËÈ
ÇÍÀÊ ÎÒÐÈÖÀÒÅËÜÍÛÉ,
GOTOCOPL2N;ÒÎ
ÑÐÀÂÍÈÌ ÍÀ ÏÐÅÂÛØÅÍÈÅ.
BTFSSFLAG1,3;ÅÑËÈ
ÇÍÀÊ ÏÎËÎÆÈÒÅËÜÍÛÉ,
GOTOCOMI2N;ÒÎ
ÑÐÀÂÍÈÌ ÍÀ ÓÌÅÍÜØÅÍÈÅ.
SKPC;ÅÑËÈ
ÈÇÌÅÐÅÍÍÛÉ ÇÍÀÊ ÁÎËÜØÅ (-) ÑÎÕÐÀÍÅÍÍÎÃÎ,
GOTOCOXP2N;ÒÎ
ÑÎÕÐÀÍÈÌ ÈÇÌÅÐÅÍÍÎÅ ÇÍÀ×ÅÍÈÅ.
GOTOBDIN2;ÍÀ
ÇÀÏÈÑÜ ÇÍÀ×ÅÍÈÉ Â ÐÅÃÈÑÒÐÛ ÈÍÄÈÊÀÖÈÈ.
;===================================
; 16.
ÑÐÀÂÍÅÍÈÅ ÍÀ MAX 2.
;===================================
COPL2X
MOVFWLSB2X;ÅÑËÈ
ÑÎÕÐÀÍÅÍÍÎÅ ÇÍÀ×ÅÍÈÅ
SUBWFLSB,0;ÁÎËÜØÅ
ÈÇÌÅÐÅÍÍÎÃÎ,
BTFSSSTATUS,0;ÒÎ
ÑÎÕÐÀÍÅÍÈß ÍÅÒ.
GOTOMINZ2;ÏÐÎÂÅÐÈÌ
ÍÀ ÌÈÍÈÌÓÌ.
BTFSSSTATUS,2;ÅÑËÈ
ÐÀÂÅÍÑÒÂÎ ÖÅËÛÕ,
GOTO$+5;
MOVFWDST2X;ÒÎ
ÏÐÎÂÅÐÈÌ ÄÅÑßÒÛÅ.
SUBWFDST2,0;ÅÑËÈ
ÈÇÌÅÐÅÍÍÎÅ ÁÎËÜØÅ
BTFSSSTATUS,0;ÈËÈ
ÐÀÂÍÎ ÑÎÕÐÀÍÅÍÍÎÌÓ, ÒÎ ÑÎÕÐÀÍÈÌ.
GOTOMINZ2;ÅÑËÈ
ÌÅÍÜØÅ, ÒÎ ÏÐÎÂÅÐÈÌ ÍÀ ÌÈÍÈÌÓÌ.
COXP2X
BTFSSFLAG1,3;-0
ÍÅÒ.
GOTO$+4;
TSTFLSB;
BZMINZ2;
MOVFWSOT2;ÑÎÕÐÀÍÈÌ ÇÍÀÊ.
MOVWFSOT2X;
MOVFWLSB;ÑÎÕÐÀÍÈÌ
ÍÎÂÎÅ ÇÍÀ×ÅÍÈÅ
MOVWFLSB2X;ÖÅËÛÕ
MOVFWDST2;È
ÄÅÑßÒÛÕ.
MOVWFDST2X;
MOVFWMIN;ÑÎÕÐÀÍÈÌ
MOVWFMIN2X;ÌÈÍÓÒÛ
MOVFWHOU;
MOVWFHOU2X;È ×ÀÑÛ.
BTFSCFLAG1,3;ÏÅÐÅÏÈØÅÌ
ÇÍÀÊ
BSFFLAG2,3;ÂÎ
ÔËÀÃ ÕÐÀÍÅÍÈß.
BTFSSFLAG1,3;
BCFFLAG2,3;
GOTOMINZ2;ÍÀ
ÏÐÎÂÅÐÊÓ ÏÎ ÌÈÍÈÌÓÌÓ.
COMI2X
MOVFWLSB2X;ÅÑËÈ
ÑÎÕÐÀÍÅÍÍÎÅ ÇÍÀ×ÅÍÈÅ
SUBWFLSB,0;ÐÀÂÍÎ
ÈÇÌÅÐÅÍÍÎÌÓ,
BTFSCSTATUS,2;
GOTO$+3;ÒÎ
ÏÐÎÂÅÐÈÌ ÄÅÑßÒÛÅ.
BTFSSSTATUS,0;ÅÑËÈ
ÁÎËÜØÅ,
GOTOCOXP2X;ÒÎ
ÑÎÕÐÀÍÈÌ.
MOVFWDST2X;ÏÐÎÂÅÐÈÌ
ÄÅÑßÒÛÅ.
SUBWFDST2,0;ÅÑËÈ
ÑÎÕÐÀÍÅÍÍÎÅ ÌÅÍÜØÅ
BTFSCSTATUS,0;ÈËÈ
ÐÀÂÍÎ ÈÇÌÅÐÅÍÍÎÌÓ,
GOTOMINZ2;ÒÎ
ÏÐÎÂÅÐÈÌ ÍÀ ÌÈÍÈÌÓÌ.
GOTOCOXP2X;ÈËÈ
ÑÎÕÐÀÍÈÌ.
;===================================
; 17.
ÑÐÀÂÍÅÍÈÅ ÍÀ MIN 2.
;===================================
COPL2N
MOVFWLSB2N;ÅÑËÈ
ÑÎÕÐÀÍÅÍÍÎÅ ÇÍÀ×ÅÍÈÅ
SUBWFLSB,0;ÁÎËÜØÅ
ÈÇÌÅÐÅÍÍÎÃÎ,
BTFSSSTATUS,0;ÒÎ
ÑÎÕÐÀÍÅÍÈß ÍÅÒ.
GOTOBDIN2;ÏÅÐÅÏÈØÅÌ.
BTFSSSTATUS,2;ÅÑËÈ
ÐÀÂÅÍÑÒÂÎ ÖÅËÛÕ,
GOTO$+5;
MOVFWDST2N;ÒÎ
ÏÐÎÂÅÐÈÌ ÄÅÑßÒÛÅ.
SUBWFDST2,0;
BTFSSSTATUS,0;ÅÑËÈ
ÁÎËÜØÅ ÈËÈ ÐÀÂÍÎ, ÒÎ ÑÎÕÐÀÍÈÌ.
GOTOBDIN2;ÏÅÐÅÏÈØÅÌ.
COXP2N
BTFSSFLAG1,3;-0
ÍÅÒ.
GOTO$+4;
TSTFLSB;
BZBDIN2;
MOVFWSOT2;ÑÎÕÐÀÍÈÌ ÇÍÀÊ.
MOVWFSOT2N;
MOVFWLSB;ÑÎÕÐÀÍÈÌ
ÍÎÂÎÅ ÇÍÀ×ÅÍÈÅ
MOVWFLSB2N;ÖÅËÛÕ
MOVFWDST2;È
ÄÅÑßÒÛÕ.
MOVWFDST2N;
MOVFWMIN;ÑÎÕÐÀÍÈÌ
MOVWFMIN2N;ÌÈÍÓÒÛ
MOVFWHOU;
MOVWFHOU2N;È ×ÀÑÛ.
BTFSCFLAG1,3;ÏÅÐÅÏÈØÅÌ
ÇÍÀÊ
BSFFLAG2,4;ÂÎ
ÔËÀÃ ÕÐÀÍÅÍÈß.
BTFSSFLAG1,3;
BCFFLAG2,4;
GOTOBDIN2;ÏÅÐÅÏÈØÅÌ.
COMI2N
MOVFWLSB2N;ÅÑËÈ
ÑÎÕÐÀÍÅÍÍÎÅ ÇÍÀ×ÅÍÈÅ
SUBWFLSB,0;ÌÅÍÜØÅ
ÈÇÌÅÐÅÍÍÎÃÎ,
BTFSCSTATUS,2;
GOTO$+3;
BTFSSSTATUS,0;ÒÎ
ÑÎÕÐÀÍÅÍÈß ÍÅÒ.
GOTOCOXP2N;ÈÍÀ×Å
ÑÎÕÐÀÍÈÌ.
MOVFWDST2N;ÏÐÎÂÅÐÈÌ
ÄÅÑßÒÛÅ.
SUBWFDST2,0;ÅÑËÈ
ÌÅÍÜØÅ
BTFSCSTATUS,0;ÈËÈ
ÐÀÂÍÎ,
GOTOBDIN2;
GOTOCOXP2N;ÒÎ
ÑÎÕÐÀÍÈÌ.
;==================================
; 18.
ÇÀÄÅÐÆÊÀ ÌÊÑ, ÓÌÍÎÆÅÍÍÀß ÍÀ 4.
;==================================
X4
ADDLW-1;
BTFSSSTATUS,2;
GOTO$-2;
RETURN;
;=========================================
;
19. ÈÍÈÖÈÀËÈÇÀÖÈß DS1.
;=========================================
INIDS1
CALLHYL1;ÏÎÑÛË ÈÌÏÓËÜÑÀ ÎÁÍÓËÅÍÈß.
MOVLW0xCC;ÏÐÎÏÓÑÊ ÍÎÌÅÐÀ.
CALLPOSIL1;ÏÎØËÅÌ.
MOVLW0x4E;ÐÀÇÐÅØÀÅÌ
ÇÀÏÈÑÜ ÓÑÒÀÍÎÂÊÈ 0,1 ÃÐÀÄÓÑÀ.
CALLPOSIL1;ÏÎØËÅÌ.
MOVLW0x7D;ÂÅÐÕÍÈÉ
ÏÐÅÄÅË +125. ÌÎÆÍÎ ÏÎÑÒÀÂÈÒÜ ËÞÁÎÅ ÇÍÀ×ÅÍÈÅ.
CALLPOSIL1;ÏÎØËÅÌ.
MOVLW0x77;ÍÈÆÍÈÉ
ÏÐÅÄÅË -55. ËÞÁÎÉ.
CALLPOSIL1;ÏÎØËÅÌ.
MOVLW0x7F;ÊÎÍÔÈÃÓÐÀÖÈß
11 = 0,1 ÃÐÀÄÓÑ.
CALLPOSIL1;ÏÎØËÅÌ.
CALLHYL1;ÏÎÑÛË
ÈÌÏÓËÜÑÀ ÎÁÍÓËÅÍÈß.
MOVLW0xCC;ÏÐÎÏÓÑÊ
ÏÎÑÛËÀ ÍÎÌÅÐÀ DS.
CALLPOSIL1;ÏÎØËÅÌ.
MOVLW0x44;ÐÀÇÐÅØÀÅÌ
ÏÐÅÎÁÐÀÇÎÂÀÍÈÅ.
CALLPOSIL1;ÏÎØËÅÌ.
MOVLW.3;ÏÀÓÇÀ 0,75 ÑÅÊ.
MOVWFCOUN;ÌÀÊÑÈÌÀËÜÍÎ 750 ÌÑ.
SPLU1
MOVLW .255
MOVWF TEMP
PLUS1
MOVLW
.255
ADDLW
-1
BTFSS
STATUS,2
GOTO
$-2
DECFSZ
TEMP,1
GOTO
PLUS1
DECFSZCOUN,1
GOTOSPLU1
GOTOPRIEM1;ÍÀ ÏÐÈÅÌ ÒÅÌÏÅÐÀÒÓÐÛ.
HYL1
CALLWUX1;ÂÛÕÎÄ ÍÓËß.
MOVLW.125;ÍÓËÅÂÎÉ ÈÌÏÓËÜÑ
ADDLW-1;=
500 ÌÊÑ.
BTFSSSTATUS,2;
GOTO$-2;
CALLWXO1;ÂÛÕÎÄ ÅÄÈÍÈÖÛ.
MOVLW.125;ÈÌÏÓËÜÑ =
ADDLW-1;500
ÌÊÑ.
BTFSSSTATUS,2;
GOTO$-2;
RETURN
;=======================================
; 20.
ÈÇÌÅÍÅÍÈÅ ÂÕÎÄÀ ÍÀ ÏÐÈÅÌ/ÏÅÐÅÄÀ×Ó.
;=======================================
WUX1
BCFPORTA,DS1;
BSFSTATUS,5;ÏÅÐÅÕÎÄÈÌ
 ÁÀÍÊ 1.
BCFTRISA^80H,DS1;ÍÀ
ÂÛÕÎÄ.
BCFSTATUS,5;ÏÅÐÅÕÎÄÈÌ
 ÁÀÍÊ 0.
RETURN
WXO1
BSFSTATUS,5;ÏÅÐÅÕÎÄÈÌ
 ÁÀÍÊ 1.
BSFTRISA^80H,DS1;ÍÀ
ÂÕÎÄ.
BCFSTATUS,5;ÏÅÐÅÕÎÄÈÌ
 ÁÀÍÊ 0.
RETURN
;====================================
; 21. ÏÐÈÅÌ
16 ÁÈÒ ÎÒ DS1.
;====================================
PRIEM1
CALLHYL1;ÏÎÑÛË
ÈÌÏÓËÜÑÀ ÎÁÍÓËÅÍÈß.
MOVLW0xCC;ÏÐÎÏÓÑÊ
ÍÎÌÅÐÀ.
CALLPOSIL1;ÏÎÑÛË.
MOVLW0xBE;×ÒÅÍÈÅ
ÒÅÌÏÅÐÀÒÓÐÛ ÈÇ ÁËÎÊÍÎÒÀ.
CALLPOSIL1;ÏÎÑÛË.
BCFINTCON,7;ÇÀÏÐÅÒ
ÏÐÅÐÛÂÀÍÈÉ.
CALL
PRIE1;ÍÀ ÏÐÈÅÌ.
MOVFWLSBH;ÏÅÐÅÏÈØÅÌ
ÏÐÈÍßÒÛÉ ÁÀÉÒ
MOVWFLSB;Â
ÌËÀÄØÈÉ ÐÅÃÈÑÒÐ.
BCFINTCON,7;ÇÀÏÐÅÒ
ÏÐÅÐÛÂÀÍÈÉ.
CALLPRIE1;È
ÏÐÈÌÅÌ ÑÒÀÐØÈÉ ÁÀÉÒ.
GOTOCXET1;ÍÀ
ÏÅÐÅÑ×ÅÒ.
PRIE1
MOVLW.8
MOVWFCOUN;ÇÀÏÈØÅÌ
×ÈÑËÎ ÁÈÒ.
CLRFLSBH;ÎÁÍÓËÈÌ
ÐÅÃÈÑÒÐ ÏÐÈÅÌÀ.
PRI1
CALLWUX1;ÂÛÄÀÅÌ
ÊÎÐÎÒÊÈÉ ÍÎËÜ È ÆÄÅÌ ÎÒÊËÈÊÀ.
CALLWXO1;ÍÀ
ÏÐÈÅÌ.
MOVLW.2;ÇÀÄÅÐÆÊÀ
CALLX4;8 ÌÊÑ.
MOVFWPORTA;ÏÅÐÅÏÈØÅÌ
MOVWFTEMP;ÇÍÀ×ÅÍÈÅ
ÏÎÐÒÀ.
BTFSSTEMP,DS1;
BCFSTATUS,0;ÓÑÒÀÍÎÂÈÌ
ÁÈÒ ÏÐÈÅÌÀ Â ÍÎËÜ.
BTFSCTEMP,DS1;
BSFSTATUS,0;ÈËÈ ÅÄÈÍÈÖÓ.
RRFLSBH,1;ÇÀÏÈØÅÌ
 ÐÅÃÈÑÒÐ.
MOVLW.12;ÎÁÙÀß
ÏÀÓÇÀ 60 ÌÊÑ.
CALLX4;
DECFSZCOUN,1;ÓÌÅÍÜØÈÌ
Ñ×ÅÒ×ÈÊ.
GOTOPRI1;ÏÎÂÒÎÐÈÌ
ÏÐÈÅÌ.
BSFINTCON,7;ÐÀÇÐÅØÀÅÌ
ÏÐÅÐÛÂÀÍÈß.
RETURN;ÂÅÐÍÅÌÑß.
;==========================================
; 22. ÏÎÑÛË
ÊÎÌÀÍÄÛ Â DS1.
;==========================================
POSIL1
BCFINTCON,7;ÇÀÏÐÅÒ
ÏÐÅÐÛÂÀÍÈÉ.
MOVWFTEMP;ÏÅÐÅÏÈØÅÌ
ÂÎ ÂÐÅÌÅÍÍÛÉ.
MOVLW.8;ÇÀÏÈØÅÌ
×ÈÑËÎ ÁÈÒ.
MOVWFCOUN;
POSI1
RRFTEMP,1;ÂÛÒÎËÊÍÅÌ
ÌËÀÄØÈÉ ÁÈÒ.
BTFSSSTATUS,0;ÅÑËÈ
ÎÍ ÍÓËÅÂÎÉ,
GOTOW0_1;ÏÎØËÅÌ
ÈÌÏÓËÜÑ ÍÓËß.
GOTOW1_1;ÈËÈ
ÅÄÈÍÈÖÛ.
POS1
DECFSZCOUN,1;ÓÌÅÍÜØÀÅÌ
Ñ×ÅÒ×ÈÊ.
GOTOPOSI1;ÍÀ
ÑËÅÄÓÞÙÈÉ ÁÈÒ.
BSFINTCON,7;ÐÀÇÐÅØÀÅÌ
ÏÐÅÐÛÂÀÍÈß.
RETURN;ÂÎÇÂÐÀÒ.
W0_1
CALLWUX1;ÓÑÒÀÍÎÂÈÌ
ÂÛÕÎÄ Â ÍÎËÜ.
MOVLW.15;ÓÄÅÐÆÈÂÀÅÌ
60 ÌÊÑ.
CALL X4;
CALLWXO1;ÍÀ
ÂÕÎÄ = 1 ÍÀ ÂÛÕÎÄÅ.
GOTOPOS1;ÏÎÂÒÎÐÈÌ.
W1_1
CALLWUX1;ÊÎÐÎÒÊÈÉ
ÍÓËÅÂÎÉ ÈÌÏÓËÜÑ.
CALLWXO1;ÍÀ
ÂÕÎÄ = 1 ÍÀ ÂÛÕÎÄÅ.
MOVLW.15;ÓÄÅÐÆÈÂÀÅÌ
60 ÌÊÑ.
CALLX4;
GOTOPOS1;ÏÎÂÒÎÐÈÌ.
;==================================
; 23.
ÂÛÄÅËÅÍÈÅ 1.
;==================================
CXET1
BTFSCFLAG1,4;ÍÀ×ÀËÜÍÀß
ÏÀÓÇÀ.
GOTO$+3;
BSFFLAG1,4;
RETURN;
BCFFLAG1,3;ÏÎ
ÓÌÎË×ÀÍÈÞ ÇÍÀÊ ÏËÞÑ.
BTFSCLSBH,3;ÅÑËÈ
ÈÍÀ×Å,
BSFFLAG1,3;ÒÎ
ÓÑÒÀÍÎÂÈÌ ÌÈÍÓÑ.
BTFSSFLAG1,3;ÅÑËÈ
ÇÍÀÊ ÏËÞÑ,
GOTO$+7;ÒÎ ÍÅ
ÈÍÂÅÐÒÈÐÓÅÌ.
COMFLSB,1;ÏÐÎÈÍÂÅÐÒÈÐÓÅÌ
ÌËÀÄØÈÉ
COMFLSBH,1;È
ÑÒÀÐØÈÉ ÐÅÃÈÑÒÐÛ ÏÐÈÅÌÀ.
BCFSTATUS,0;
INCFLSB,1;ÏÐÈÁÀÂÈÌ
ÅÄÈÍÈÖÓ.
BTFSCSTATUS,0;ÅÑËÈ
ÅÑÒÜ ÏÅÐÅÍÎÑ,
INCFLSBH,1;ÒÎ
ÓÂÅËÈ×ÈÌ ÑÒÀÐØÈÉ ÐÅÃÈÑÒÐ.
MOVFWLSB;ÂÛÄÅËÈÌ
ÄÅÑßÒÛÅ.
ANDLWB'00001111';ÇÀÌÀÑÊÈÐÓÅÌ.
CALLDESATI;ÏÅÐÅÊÎÄÈÐÓÅÌ
Ñ ÎÊÐÓÃËÅÍÈÅÌ.
MOVWFDST1;ÇÀÏÈØÅÌ
 ÐÅÃÈÑÒÐ ÄÅÑßÒÛÕ.
MOVLW.4;ÑÄÂÈÃÎÌ
ÂÏÐÀÂÎ ÍÀ 4 ÐÀÇÐßÄÀ
MOVWFCOUN;
BCFSTATUS,0;ÂÛÄÅËÈÌ
ÖÅËÓÞ ×ÀÑÒÜ.
RRFLSBH,1;
RRFLSB,1;
DECFSZCOUN,1;
GOTO$-4;
MOVLW.251;ÏÎ
ÓÌÎË×ÀÍÈÞ ÇÍÀÊ ÏËÞÑ.
MOVWFSOT1;
BTFSSFLAG1,3;ÅÑËÈ
ÈÍÀ×Å,
GOTO$+3;ÒÎ
ÓÑÒÀÍÎÂÈÌ
MOVLW.253;ÌÈÍÓÑ.
MOVWFSOT1;
;======================================================
; 24. ÂÛÁÎÐ
ÑÐÀÂÍÅÍÈß ÏÎ ÑÎÕÐÀÍÅÍÍÎÌÓ È ÈÇÌÅÐÅÍÍÎÌÓ ÇÍÀÊÀÌ 1.
;======================================================
MAXZ
MOVFWSOT1;ÅÑËÈ
ÇÍÀÊÈ ÐÀÂÍÛ,
SUBWFSOT1X,0;
SKPZ;ÒÎ
ÎÏÐÅÄÅËÈÌ ÇÍÀÊ.
GOTO$+5;
BTFSSFLAG1,3;ÅÑËÈ
ÇÍÀÊ ÏËÞÑ,
GOTOCOPL1X;ÒÎ
ÏÐÎÂÅÐßÅÌ ÍÀ ÏÐÅÂÛØÅÍÈÅ.
BTFSCFLAG1,3;ÅÑËÈ
ÇÍÀÊ ÌÈÍÓÑ,
GOTOCOMI1X;ÒÎ
ÏÐÎÂÅÐßÅÌ ÍÀ ÓÌÅÍÜØÅÍÈÅ.
SKPNC;ÅÑËÈ
ÈÇÌÅÐÅÍÍÛÉ ÇÍÀÊ ÌÅÍÜØÅ (+) ÑÎÕÐÀÍÅÍÍÎÃÎ,
GOTOCOXPX;ÒÎ
ÑÎÕÐÀÍÈÌ ÈÇÌÅÐÅÍÍÎÅ ÇÍÀ×ÅÍÈÅ.
MINZ
MOVFWSOT1;ÅÑËÈ
ÇÍÀÊÈ ÐÀÂÍÛ,
SUBWFSOT1N,0;
SKPZ;ÒÎ
ÎÏÐÅÄÅËÈÌ ÇÍÀÊ.
GOTO$+5;
BTFSCFLAG1,3;ÅÑËÈ
ÇÍÀÊ ÌÈÍÓÑ,
GOTOCOPL1N;ÒÎ
ÑÐÀÂÍÈÂÀÅÌ ÍÀ ÏÐÅÂÛØÅÍÈÅ.
BTFSSFLAG1,3;ÅÑËÈ
ÇÍÀÊ ÏËÞÑ,
GOTOCOMI1N;ÒÎ
ÑÐÀÂÍÈÂÀÅÌ ÍÀ ÓÌÅÍÜØÅÍÈÅ.
SKPC;ÅÑËÈ
ÈÇÌÅÐÅÍÍÛÉ ÇÍÀÊ ÁÎËÜØÅ (-) ÑÎÕÐÀÍÅÍÍÎÃÎ,
GOTOCOXPN;ÒÎ
ÑÎÕÐÀÍÈÌ ÈÇÌÅÐÅÍÍÎÅ ÇÍÀ×ÅÍÈÅ.
GOTOBDIN1;ÍÀ
ÏÅÐÅÊÎÄÈÐÎÂÊÓ.
;===================================
; 25.
ÑÐÀÂÍÅÍÈÅ ÍÀ MAX 1.
;===================================
COPL1X
MOVFWLSB1X;ÅÑËÈ
ÑÎÕÐÀÍÅÍÍÎÅ ÇÍÀ×ÅÍÈÅ
SUBWFLSB,0;ÁÎËÜØÅ
ÈÇÌÅÐÅÍÍÎÃÎ,
BTFSSSTATUS,0;ÒÎ
ÑÎÕÐÀÍÅÍÈß ÍÅÒ.
GOTOMINZ;.
BTFSSSTATUS,2;ÅÑËÈ
ÐÀÂÅÍÑÒÂÎ ÖÅËÛÕ,
GOTO$+5;
MOVFWDST1X;ÒÎ
ÏÐÎÂÅÐÈÌ ÄÅÑßÒÛÅ.
SUBWFDST1,0;ÅÑËÈ
ÁÎËÜØÅ
BTFSSSTATUS,0;ÈËÈ
ÐÀÂÍÎ, ÒÎ ÑÎÕÐÀÍÈÌ.
GOTOMINZ;ÈÍÀ×Å
ÏÐÎÂÅÐÈÌ ÍÀ ÌÈÍÈÌÓÌ.
COXPX
BTFSSFLAG1,3;-0
ÍÅÒ.
GOTO$+4;
TSTFLSB;
BZMINZ;
MOVFWSOT1;ÑÎÕÐÀÍÈÌ
ÌÀÊÑÈÌÀËÜÍÎÅ ÇÍÀ×ÅÍÈÅ.
MOVWFSOT1X;ÇÍÀÊ.
MOVFWLSB;ÑÎÕÐÀÍÈÌ
ÍÎÂÎÅ ÇÍÀ×ÅÍÈÅ
MOVWFLSB1X;ÖÅËÛÕ
MOVFWDST1;È
ÄÅÑßÒÛÕ.
MOVWFDST1X;
MOVFWMIN;
MOVWFMIN1X;ÌÈÍÓÒÛ.
MOVFWHOU;
MOVWFHOU1X;×ÀÑÛ.
BTFSCFLAG1,3;ÏÅÐÅÏÈØÅÌ
ÔËÀÃ ÇÍÀÊÀ
BSFFLAG,0;Â
ÔËÀÃ ÕÐÀÍÅÍÈß.
BTFSSFLAG1,3;
BCFFLAG,0;
GOTOMINZ;ÍÀ
ÏÐÎÂÅÐÊÓ ÏÎ ÌÈÍÈÌÓÌÓ.
COMI1X
MOVFWLSB1X;ÅÑËÈ
ÑÎÕÐÀÍÅÍÍÎÅ ÇÍÀ×ÅÍÈÅ
SUBWFLSB,0;ÌÅÍÜØÅ
ÈÇÌÅÐÅÍÍÎÃÎ,
BTFSCSTATUS,2;ÒÎ
ÑÎÕÐÀÍÅÍÈß ÍÅÒ.
GOTO$+3;
BTFSSSTATUS,0;ÅÑËÈ
ÐÀÂÅÍÑÒÂÎ ÖÅËÛÕ,
GOTOCOXPX;
MOVFWDST1X;ÒÎ
ÏÐÎÂÅÐÈÌ ÄÅÑßÒÛÅ.
SUBWFDST1,0;ÅÑËÈ
ÌÅÍÜØÅ
BTFSCSTATUS,0;ÈËÈ
ÐÀÂÍÎ,
GOTOMINZ;ÑÐÀÂÍÈÌ
ÏÎ ÌÈÍÈÌÓÌÓ.
GOTOCOXPX;ÈÍÀ×Å
ÑÎÕÐÀÍÈÌ.
;===================================
; 26.
ÑÐÀÂÍÅÍÈÅ ÍÀ MIN 1.
;===================================
COPL1N
MOVFWLSB1N;ÅÑËÈ
ÑÎÕÐÀÍÅÍÍÎÅ ÇÍÀ×ÅÍÈÅ
SUBWFLSB,0;ÌÅÍÜØÅ
ÈÇÌÅÐÅÍÍÎÃÎ,
BTFSSSTATUS,0;ÒÎ
ÑÎÕÐÀÍÅÍÈß ÍÅÒ.
GOTOBDIN1;ÏÅÐÅÏÈØÅÌ.
BTFSSSTATUS,2;ÅÑËÈ
ÐÀÂÅÍÑÒÂÎ ÖÅËÛÕ,
GOTO$+5;
MOVFWDST1N;ÒÎ
ÏÐÎÂÅÐÈÌ ÄÅÑßÒÛÅ.
SUBWFDST1,0;ÅÑËÈ
ÈÇÌÅÐÅÍÍÎÅ ÌÅÍÜØÅ
BTFSSSTATUS,0;ÈËÈ
ÐÀÂÍÎ ÑÎÕÐÀÍÅÍÍÎÌÓ, ÒÎ ÑÎÕÐÀÍÈÌ.
GOTOBDIN1;ÍÀ
ÏÅÐÅÊÎÄÈÐÎÂÊÓ.
COXPN
BTFSSFLAG1,3;-0
ÍÅÒ.
GOTO$+4;
TSTFLSB;
BZBDIN1;
MOVFWSOT1;ÑÎÕÐÀÍÅÍÈÅ
ÌÈÍÈÌÀËÜÍÎÃÎ.
MOVWFSOT1N;ÇÍÀÊ.
MOVFWLSB;ÑÎÕÐÀÍÈÌ
ÍÎÂÎÅ ÇÍÀ×ÅÍÈÅ
MOVWFLSB1N;ÖÅËÛÕ
MOVFWDST1;È
ÄÅÑßÒÛÕ.
MOVWFDST1N;
MOVFWMIN;
MOVWFMIN1N;ÌÈÍÓÒÛ.
MOVFWHOU;
MOVWFHOU1N;×ÀÑÛ.
BTFSCFLAG1,3;ÏÅÐÅÏÈØÅÌ
ÔËÀÃ ÇÍÀÊÀ
BSFFLAG,1;Â
ÔËÀÃ ÕÐÀÍÅÍÈß.
BTFSSFLAG1,3;
BCFFLAG,1;
GOTOBDIN1;ÍÀ
ÏÅÐÅÊÎÄÈÐÎÂÊÓ.
COMI1N
MOVFWLSB1N;ÅÑËÈ
ÑÎÕÐÀÍÅÍÍÎÅ ÇÍÀ×ÅÍÈÅ
SUBWFLSB,0;ÌÅÍÜØÅ
ÈÇÌÅÐÅÍÍÎÃÎ,
BTFSCSTATUS,2;
GOTO$+3;ÒÎ
ÑÎÕÐÀÍÅÍÈß ÍÅÒ.
BTFSSSTATUS,0;ÅÑËÈ
ÐÀÂÅÍÑÒÂÎ ÖÅËÛÕ,
GOTOCOXPN;
MOVFWDST1N;ÒÎ
ÏÐÎÂÅÐÈÌ ÄÅÑßÒÛÅ.
SUBWFDST1,0;ÅÑËÈ
ÌÅÍÜØÅ
BTFSCSTATUS,0;ÈËÈ
ÐÀÂÍÎ,
GOTOBDIN1;
GOTOCOXPN;ÒÎ
ÑÎÕÐÀÍÈÌ.
;=======================================
; 27.
ÏÅÐÅÊÎÄÈÐÎÂÊÀ 1 ÈÇ 2-ÃÎ Â 2_10.
;=======================================
BDIN1
CALLPERZAP;ÏÅÐÅÏÈØÅÌ
ÒÅÊÓÙÈÅ ÇÍÀ×ÅÍÈß.
MOVFWLSB;ÏÅÐÅÊÎÄÈÐÓÅÌ
GOTOBZT1;
BDIN2
CALLPERZAP;ÏÅÐÅÏÈØÅÌ
ÒÅÊÓÙÈÅ ÇÍÀ×ÅÍÈß.
MOVFWLSB;ÏÅÐÅÊÎÄÈÐÓÅÌ
GOTOBZT2;
PERZAP
MOVFWHOU1X;ÒÅÊÓÙÈÅ
ÇÍÀ×ÅÍÈß
MOVWFHOUZ1X;Â
ÐÅÃÈÑÒÐÛ ÈÍÄÈÊÀÖÈÈ.
MOVFWMIN1X
MOVWFMINZ1X
MOVFWHOU1N
MOVWFHOUZ1N
MOVFWMIN1N
MOVWFMINZ1N
MOVFWHOU2X
MOVWFHOUZ2X
MOVFWMIN2X
MOVWFMINZ2X
MOVFWHOU2N
MOVWFHOUZ2N
MOVFWMIN2N
MOVWFMINZ2N
MOVFWLSB1X
MOVWFLSBZ1X
MOVFWDST1X
MOVWFDSTZ1X
MOVFWLSB1N
MOVWFLSBZ1N
MOVFWDST1N
MOVWFDSTZ1N
MOVFWLSB2X
MOVWFLSBZ2X
MOVFWDST2X
MOVWFDSTZ2X
MOVFWLSB2N
MOVWFLSBZ2N
MOVFWDST2N
MOVWFDSTZ2N
RETURN
BDINZ1
BTFSCFLAG1,1;ÅÑËÈ ÈÍÄÈÊÀÖÈß 2
ÄÀÒ×ÈÊÀ,
GOTOBDINZ2;ÒÎ
ÈÄÅÌ ÍÀ 2 ÄÀÒ×ÈÊ.
MOVFWLSBZ1X;ÏÎ
ÌÀÊÑÈÌÓÌÓ - 1 ÑÒÐÎÊÀ 1 ÄÀÒ×ÈÊÀ.
CALLBZT1;
MOVFWDSTZ1X;
MOVWFDST1;
MOVFWLSBZ1N;ÏÎ
ÌÈÍÈÌÓÌÓ - 2 ÑÒÐÎÊÀ 1 ÄÀÒ×ÈÊÀ.
CALLBZT2;
MOVFWDSTZ1N;
MOVWFDST2;
MOVFWHOUZ1X;×ÀÑÛ ÌÀÊÑÈÌÓÌÀ 1.
CALLHZ67;
MOVFWMINZ1X;ÌÈÍÓÒÛ ÌÀÊÑÈÌÓÌÀ 1.
CALLMZ910;
MOVFWSOT1X;ÇÍÀÊ.
MOVWFR12;
RETURN;
BDIN12
BTFSCFLAG1,1;ÅÑËÈ
ÈÍÄÈÊÀÖÈß 2 ÑÒÐÎÊÈ,
GOTOBDIN22;ÒÎ
ÈÄÅÌ ÍÀ 2 ÑÒÐÎÊÓ.
MOVFWHOUZ1N;ÏÅÐÅÇÀÏÈÑÜ
1 ÄÀÒ×ÈÊÀ 2 ÑÒÐÎÊÈ.
CALLHZ67;×ÀÑÛ
ÌÈÍÈÌÓÌÀ 1.
MOVFWMINZ1N;ÌÈÍÓÒÛ
ÌÈÍÈÌÓÌÀ 1.
CALLMZ910;
MOVFWSOT1N;ÇÍÀÊ.
MOVWFR12;
RETURN;
BDIN22
MOVFWHOUZ2N;ÏÅÐÅÇÀÏÈÑÜ 2 ÄÀÒ×ÈÊÀ 2
ÑÒÐÎÊÈ.
CALLHZ67;×ÀÑÛ ÌÈÍÈÌÓÌÀ 2.
MOVFWMINZ2N;ÌÈÍÓÒÛ ÌÈÍÈÌÓÌÀ 2.
CALLMZ910;
MOVFWSOT2N;ÇÍÀÊ.
MOVWFR12;
RETURN;
BDINZ2
MOVFWLSBZ2X;ÏÎÄÃÎÒÎÂÊÀ Ê ÈÍÄÈÊÀÖÈÈ 2
ÄÀÒ×ÈÊÀ.
CALLBZT1;ÏÎ
ÌÀÊÑÈÌÓÌÓ - 1 ÑÒÐÎÊÀ.
MOVFWDSTZ2X;
MOVWFDST1;
MOVFWLSBZ2N;
CALLBZT2;ÏÎ
ÌÈÍÈÌÓÌÓ - 2 ÑÒÐÎÊÀ
MOVFWDSTZ2N;
MOVWFDST2;
MOVFWHOUZ2X;×ÀÑÛ
ÌÀÊÑÈÌÓÌÀ 2.
CALLHZ67;
MOVFWMINZ2X;ÌÈÍÓÒÛ
ÌÀÊÑÈÌÓÌÀ 2.
CALLMZ910;
MOVFWSOT2X;ÇÍÀÊ.
MOVWFR12;
RETURN;ÏÐÎÂÅÐÈÌ ÊÍÎÏÊÓ.
BZT1
MOVWFTEMP;ÈÇ
2-ÃÎ Â 2_10-Å.
CALLBIDE;ÒÎËÜÊÎ
ÄÎ 99!
MOVWFDES1;ÒÅÌÏÅÐÀÒÓÐÀ
 ÏÅÐÂÎÉ ÑÒÐÎÊÅ.
MOVFWTEMP;
MOVWFEDI1;
RETURN;
BZT2
MOVWFTEMP;ÈÇ
2-ÃÎ Â 2_10-Å.
CALLBIDE;ÒÎËÜÊÎ
ÄÎ 99!
MOVWFDES2;ÒÅÌÏÅÐÀÒÓÐÀ
ÂÎ ÂÒÎÐÎÉ ÑÒÐÎÊÅ.
MOVFWTEMP;
MOVWFEDI2;
RETURN;
HZ67
MOVWFTEMP;ÈÇ
2-ÃÎ Â 2_10-Å.
CALLBIDE;ÒÎËÜÊÎ
ÄÎ 99!
MOVWFR6;6 È 7
ÐÀÇÐßÄÛ ÈÍÄÈÊÀÒÎÐÀ.
MOVFWTEMP;×ÀÑÛ.
MOVWFR7;
RETURN;
MZ910
MOVWFTEMP;ÈÇ 2-ÃÎ Â 2_10-Å.
CALLBIDE;ÒÎËÜÊÎ
ÄÎ 99!
MOVWFR9;9 È
10 ÐÀÇÐßÄÛ ÈÍÄÈÊÀÒÎÐÀ.
MOVFWTEMP;ÌÈÍÓÒÛ.
MOVWFR10;
RETURN;
;======================
; 28.
ÈÍÈÖÈÀËÈÇÀÖÈß ÌÊ.
;======================
INIT
BCFSTATUS,6;
BSFSTATUS,5;ÏÅÐÅÕÎÄÈÌ
 ÁÀÍÊ 1.
MOVLWB'00000011';ÏÐÅÄÄÅËÈÒÅËÜ
ÏÅÐÅÄ ÒÀÉÌÅÐÎÌ, Ê=16 ...11,
MOVWFOPTION_REG^80H;ÏÎÄÒßÃÈÂÀÞÙÈÅ
ÐÅÇÈÑÒÎÐÛ ÂÊËÞ×ÅÍÛ.
MOVLWB'10100000';ÐÀÇÐÅØÅÍÈÅ
ÏÐÅÐÛÂÀÍÈß ÏÐÈ ÏÅÐÅÏÎËÍÅÍÈÈ ÒÀÉÌÅÐÀ.
MOVWFINTCON;
MOVLWB'00100000';RA5
- ÍÀ ÂÕÎÄ.
MOVWFTRISA^80H
MOVLWB'00000011';RB0,
RB1 - ÍÀ ÂÕÎÄ.
MOVWFTRISB^80H
CLRFVRCON^80H;ÈÎÍ
ÂÛÊËÞ×ÅÍ.
CLRFPIE1^80H;
BCFSTATUS,5;ÏÅÐÅÕÎÄÈÌ
 ÁÀÍÊ 0.
CLRFPORTA;ÂÑÅ
ÎÁÍÓËßÅÌ È ÓÑÒÀÍÀÂËÈÂÀÅÌ
CLRFPORTB
CLRFT1CON;
CLRFT2CON;
MOVLW7
MOVWFCMCON;ÊÎÌÏÀÐÀÒÎÐÛ
ÂÛÊËÞ×ÅÍÛ.
CLRFTMR0
CLRFFLAG
CLRFFLAG1
CLRFFLAG2
BSFFLAG2,0;ÈÍÄÈÊÀÖÈß ÒÅÊÓÙÀß,
CLRFCEK
CLRFMIN
CLRFHOU
CLRFHOUL
CLRFHOUH
CLRFMINL
CLRFMINH
CLRFREID
CLRFKYPC
CLRFCOUN
CLRFCOUZ
CLRFCOUE
CLRFCOYC
CLRFMCK;ÌÈËËÈÑÅÊÓÍÄ.
CLRFEDI2;ÅÄÈÍÈÖÛ
2.
CLRFDES2;ÄÅÑßÒÊÈ
2.
CLRFDST2;ÄÅÑßÒÛÅ
2.
CLRFEDI1;ÅÄÈÍÈÖÛ
1.
CLRFDES1;ÄÅÑßÒÊÈ
1.
CLRFDST1;ÄÅÑßÒÛÅ
1.
CLRFMECDI;ÄÅÑßÒÊÈ
ÌÅÑßÖÀ ÈÍÄÈÊÀÖÈÈ.
CLRFDHUDI;ÄÅÑßÒÊÈ
ÄÍÅÉ ÈÍÄÈÊÀÖÈÈ.
CLRFMECD;ÄÅÑßÒÊÈ
ÌÅÑßÖÀ.
CLRFDHUD;ÄÅÑßÒÊÈ
ÄÍÅÉ.
MOVLW.253;-
MOVWFSOT1;ÇÍÀÊ
1.
MOVWFSOT2;ÇÍÀÊ
2.
MOVWFSOT2X;ÇÍÀÊ
2 MAX.
MOVWFSOT1X;ÇÍÀÊ
1 MAX.
MOVLW.251;+
MOVWFSOT1N;ÇÍÀÊ
1 MIN.
MOVWFSOT2N;ÇÍÀÊ 2 MIN.
MOVLW.1
MOVWFDHU;ÄÍÈ
ÄÂÎÈ×ÍÛÅ.
MOVWFDHUE;ÅÄÈÍÈÖÛ
ÄÍÅÉ.
MOVWFMEC;ÌÅÑßÖ
ÄÂÎÈ×ÍÛÉ.
MOVWFMECE;ÅÄÈÍÈÖÛ
ÌÅÑßÖÀ.
MOVWFMECEI;ÅÄÈÍÈÖÛ
ÌÅÑßÖÀ ÈÍÄÈÊÀÖÈÈ.
MOVWFMECZ;ÄÂÎÈ×ÍÛÉ
ÌÅÑßÖ ÇÀÏÈÑÈ/Ñ×ÈÒÛÂÀÍÈß.
MOVWFDHUEI;ÅÄÈÍÈÖÛ
ÄÍÅÉ ÈÍÄÈÊÀÖÈÈ.
MOVWFDHUZ;ÄÂÎÈ×ÍÛÅ
ÄÍÈ ÇÀÏÈÑÈ/Ñ×ÈÒÛÂÀÍÈß.
CALLPOLNO;ÓÑÒÀÍÎÂÊÀ
ÌÀÊÑÈÌÀËÜÍÛÕ ÇÍÀ×ÅÍÈÉ.
GOTOJEKINI;ÍÀ
ÈÍÈÖÈÀËÈÇÀÖÈÞ ÈÍÄÈÊÀÒÎÐÀ.
;=======================================
; 29.
ÓÑÒÀÍÎÂÊÀ ×ÀÑÎÂ, ÄÀÒÛ.
;=======================================
YC0
INCFHOUH,1;ÓÂÅËÈ×ÈÌ
ÄÅÑßÒÊÈ ×ÀÑÎÂ.
MOVLW.3;ÍÅ
ÁÎËÅÅ 2.
SUBWFHOUH,0;
SKPNC;
CLRFHOUH;ÅÑËÈ
ÁÎËÜØÅ, ÒÎ ÎÁÍÓËÈÌ.
MOVFWHOUH;ÏÅÐÅÊÎÄÈÐÓÅÌ
 ÄÂÎÈ×ÍÛÉ
CALLDEBIN;ÊÎÄ
ÄÅÑßÒÊÈ.
ADDWFHOUL,0;ÏÐÈÁÀÂÈÌ
ÅÄÈÍÈÖÛ
MOVWFHOU;È
ÏÎËÓ×ÈÌ ÄÂÎÈ×ÍÎÅ ×ÈÑËÎ.
RETURN;ÂÅÐÍÅÌÑß.
YC1
INCFHOUL,1;ÓÂÅËÈ×ÈÌ
ÅÄÈÍÈÖÛ ×ÀÑÎÂ.
MOVLW.10;ÍÅ
ÁÎËÅÅ 9.
SUBWFHOUL,0;
SKPNC;
CLRFHOUL;ÅÑËÈ
ÁÎËÜØÅ, ÒÎ ÎÁÍÓËÈÌ.
MOVFWHOUH;ÏÅÐÅÊÎÄÈÐÓÅÌ
 ÄÂÎÈ×ÍÛÉ
CALLDEBIN;ÊÎÄ
ÄÅÑßÒÊÈ.
ADDWFHOUL,0;ÏÐÈÁÀÂÈÌ
ÅÄÈÍÈÖÛ
MOVWFHOU;ÄÂÎÈ×ÍÎÅ
ÇÍÀ×ÅÍÈÅ ÍÅ ÄÎËÆÍÎ
ADDLW-18H;ÏÐÅÂÛØÀÒÜ
- 24.
SKPC;ÅÑËÈ
ÁÎËÜØÅ ÈËÈ ÐÀÂÍÎ 24,
RETURN
CLRFHOU;ÒÎ
ÎÁÍÓËÈÌ ×ÀÑÛ ÄÂÎÈ×ÍÛÅ
CLRFHOUL;È
ÐÀÇÐßÄÛ ÑÒÀÐØÈÉ
CLRFHOUH;È
ÌËÀÄØÈÉ.
RETURN
YC2
INCFMINH,1;ÓÂÅËÈ×ÈÌ
ÄÅÑßÒÊÈ ÌÈÍÓÒ.
MOVLW.6;ÍÅ
ÁÎËÅÅ 5.
SUBWFMINH,0;
SKPNC;ÅÑËÈ
ÁÎËÜØÅ ÈËÈ ÐÀÂÍÎ 6,
CLRFMINH;ÒÎ
ÎÁÍÓËÈÌ.
MOVFWMINH;ÏÅÐÅÊÎÄÈÐÓÅÌ
 ÄÂÎÈ×ÍÛÉ
CALLDEBIN;ÊÎÄ
ÄÅÑßÒÊÈ.
ADDWFMINL,0;ÏÐÈÁÀÂÈÌ
ÅÄÈÍÈÖÛ È
MOVWFMIN;ÇÀÏÈØÅÌ
 ÄÂÎÈ×ÍÎÌ ÊÎÄÅ.
RETURN
YC3
INCFMINL,1;ÓÂÅËÈ×ÈÌ
ÅÄÈÍÈÖÛ ÌÈÍÓÒ.
MOVLW.10;ÍÅ
ÁÎËÅÅ 9.
SUBWFMINL,0;
SKPNC;ÅÑËÈ
ÁÎËÜØÅ ÈËÈ ÐÀÂÍÎ 10,
CLRFMINL;ÒÎ
ÎÁÍÓËÈÌ.
MOVFWMINH;ÏÅÐÅÊÎÄÈÐÓÅÌ
 ÄÂÎÈ×ÍÛÉ
CALLDEBIN;ÊÎÄ
ÄÅÑßÒÊÈ.
ADDWFMINL,0;ÏÐÈÁÀÂÈÌ
ÅÄÈÍÈÖÛ È
MOVWFMIN;ÇÀÏÈØÅÌ
 ÄÂÎÈ×ÍÎÌ ÊÎÄÅ.
RETURN
YC4
INCFDHUD,1;ÓÂÅËÈ×ÈÌ
ÄÅÑßÒÊÈ ÒÅÊÓÙÈÕ ÄÍÅÉ.
MOVLW.4;ÍÅ
ÁÎËÅÅ 3.
SUBWFDHUD,0;
SKPNC;
CLRFDHUD;ÅÑËÈ
ÁÎËÜØÅ, ÒÎ ÎÁÍÓËÈÌ.
MOVFWDHUD;ÏÅÐÅÊÎÄÈÐÓÅÌ
 ÄÂÎÈ×ÍÛÉ
CALLDEBIN;ÊÎÄ
ÄÅÑßÒÊÈ.
ADDWFDHUE,0;ÏÐÈÁÀÂÈÌ
ÅÄÈÍÈÖÛ
MOVWFDHU;È
ÏÎËÓ×ÈÌ ÄÂÎÈ×ÍÎÅ ×ÈÑËÎ.
MOVFWMEC;ÅÑËÈ
 ÒÅÊÓÙÅÌ ÌÅÑßÖÅ
CALLDAYMON;ÌÅÍÜØÅ ÄÍÅÉ,
SUBWFDHU,0;
SKPC;
GOTO$+4;
MOVLW.1;
MOVWFDHUE;ÒÎ
ÓÑÒÀÍÎÂÈÌ ÅÄÈÍÈÖÛ
GOTO$-0x0B;È
ÅÙÅ ÐÀÇ ÏÐÎÂÅÐÈÌ ÑÓÌÌÓ.
TSTFDHU;ÅÑËÈ
ÑÓÌÌÀ ÄÍÅÉ ÍÓËÅÂÀß,
BZ$-5;ÒÎ
ÑÍÎÂÀ ÓÑÒÀÍÎÂÈÌ.
MOVFWDHUD;ÏÅÐÅÏÈØÅÌ
 ÐÅÃÈÑÒÐÛ
MOVWFDHUDI;ÈÍÄÈÊÀÖÈÈ.
MOVFWDHUE;
MOVWFDHUEI;
RETURN;ÂÅÐÍÅÌÑß.
YC5
INCFDHUE,1;ÓÂÅËÈ×ÈÌ
ÅÄÈÍÈÖÛ ÄÍÅÉ.
MOVLW.10;ÍÅ
ÁÎËÅÅ 9.
SUBWFDHUE,0;
SKPNC;
CLRFDHUE;ÅÑËÈ
ÁÎËÜØÅ, ÒÎ ÎÁÍÓËÈÌ.
MOVFWDHUD;ÏÅÐÅÊÎÄÈÐÓÅÌ
 ÄÂÎÈ×ÍÛÉ
CALLDEBIN;ÊÎÄ
ÄÅÑßÒÊÈ.
ADDWFDHUE,0;ÏÐÈÁÀÂÈÌ
ÅÄÈÍÈÖÛ
MOVWFDHU;È
ÏÎËÓ×ÈÌ ÄÂÎÈ×ÍÎÅ ×ÈÑËÎ.
MOVFWMEC;ÅÑËÈ
 ÒÅÊÓÙÅÌ ÌÅÑßÖÅ
CALLDAYMON;ÌÅÍÜØÅ ÄÍÅÉ,
SUBWFDHU,0;
SKPC;
GOTO$+5;
CLRFDHUD;ÒÎ
ÎÁÍÓËÈÌ ÄÅÑßÒÊÈ ÄÍÅÉ,
MOVLW.1;ÓÑÒÀÍÎÂÈÌ
ÅÄÈÍÈÖÛ
MOVWFDHUE;ÄÍÅÉ
GOTO$-0x0C;È
ÅÙÅ ÐÀÇ ÏÐÎÂÅÐÈÌ ÑÓÌÌÓ.
TSTFDHU;ÅÑËÈ
ÑÓÌÌÀ ÄÍÅÉ ÍÓËÅÂÀß,
BZ$-5;À
ÍÓËÅÂÎÃÎ ÄÍß ÍÅÒ, ÒÎ ÑÍÎÂÀ ÓÑÒÀÍÎÂÈÌ.
MOVFWDHUD;ÏÅÐÅÏÈØÅÌ
 ÐÅÃÈÑÒÐÛ
MOVWFDHUDI;ÈÍÄÈÊÀÖÈÈ.
MOVFWDHUE;
MOVWFDHUEI;
RETURN;ÂÅÐÍÅÌÑß.
YC6
INCFMECD,1;ÓÂÅËÈ×ÈÌ
ÄÅÑßÒÊÈ ÌÅÑßÖÀ.
MOVLW.2;ÍÅ
ÁÎËÅÅ 1.
SUBWFMECD,0;
SKPNC;
CLRFMECD;ÅÑËÈ
ÁÎËÜØÅ, ÒÎ ÎÁÍÓËÈÌ.
MOVFWMECD;ÏÅÐÅÊÎÄÈÐÓÅÌ
 ÄÂÎÈ×ÍÛÉ
CALLDEBIN;ÊÎÄ
ÄÅÑßÒÊÈ.
ADDWFMECE,0;ÏÐÈÁÀÂÈÌ
ÅÄÈÍÈÖÛ
MOVWFMEC;È
ÏÎËÓ×ÈÌ ÄÂÎÈ×ÍÎÅ ×ÈÑËÎ.
MOVLW.13;ÍÅ
ÁÎËÅÅ 12.
SUBWFMEC,0;
SKPC;
GOTO$+5;
CLRFMECD;ÅÑËÈ
ÁÎËÜØÅ, ÒÎ ÎÁÍÓËÈÌ.
MOVLW.1;ÓÑÒÀÍÎÂÈÌ
ÏÅÐÂÛÉ ÌÅÑßÖ.
MOVWFMECE;
GOTO$-0x0C;
TSTFMEC;ÅÑËÈ
ÌÅÑßÖ ÍÓËÅÂÎÉ,
BZ$-5;ÒÎ
ÓÑÒÀÍÎÂÈÌ.
MOVFWMECD;ÏÅÐÅÏÈØÅÌ
 ÐÅÃÈÑÒÐÛ
MOVWFMECDI;ÈÍÄÈÊÀÖÈÈ.
MOVFWMECE;
MOVWFMECEI;
RETURN;ÂÅÐÍÅÌÑß.
YC7
INCFMECE,1;ÓÂÅËÈ×ÈÌ
ÅÄÈÍÈÖÛ ÌÅÑßÖÀ.
MOVLW.10;ÍÅ
ÁÎËÅÅ 9.
SUBWFMECE,0;
SKPNC;
CLRFMECE;ÅÑËÈ
ÁÎËÜØÅ, ÒÎ ÎÁÍÓËÈÌ.
MOVFWMECD;ÏÅÐÅÊÎÄÈÐÓÅÌ
 ÄÂÎÈ×ÍÛÉ
CALLDEBIN;ÊÎÄ
ÄÅÑßÒÊÈ.
ADDWFMECE,0;ÏÐÈÁÀÂÈÌ
ÅÄÈÍÈÖÛ
MOVWFMEC;È
ÏÎËÓ×ÈÌ ÄÂÎÈ×ÍÎÅ ×ÈÑËÎ.
MOVLW.13;ÍÅ
ÁÎËÅÅ 12.
SUBWFMEC,0;
SKPC;
GOTO$+5;
CLRFMECD;ÅÑËÈ
ÁÎËÜØÅ, ÒÎ ÎÁÍÓËÈÌ.
MOVLW.1;ÓÑÒÀÍÎÂÈÌ
ÏÅÐÂÛÉ ÌÅÑßÖ.
MOVWFMECE;
GOTO$-0x0C;
TSTFMEC;ÅÑËÈ
ÌÅÑßÖ ÍÓËÅÂÎÉ,
BZ$-5;ÒÎ
ÓÑÒÀÍÎÂÈÌ.
MOVFWMECD;ÏÅÐÅÏÈØÅÌ
 ÐÅÃÈÑÒÐÛ
MOVWFMECDI;ÈÍÄÈÊÀÖÈÈ.
MOVFWMECE;
MOVWFMECEI;
RETURN;ÂÅÐÍÅÌÑß.
YC8M
DECFDHUEI,1;ÓÌÅÍÜØÈÌ
ÅÄÈÍÈÖÛ ÄÍÅÉ ÏÐÎÑÌÎÒÐÀ.
MOVLW.255;ÅÑËÈ
ÏÅÐÅÕÎÄ ×ÅÐÅÇ 0,
SUBWFDHUEI,0;
BNC$+8;
MOVLW.9;ÒÎ
ÓÑÒÀÍÎÂÈÌ 9.
MOVWFDHUEI;
DECFDHUDI,1;ÓÌÅÍÜØÈÌ
ÄÅÑßÒÊÈ ÄÍÅÉ
MOVLW.255;ÅÑËÈ
ÍÅÒ ÏÅÐÅÕÎÄÀ ×ÅÐÅÇ 0,
SUBWFDHUDI,0;
SKPC;
GOTOYC8COY;ÒÎ
ÓÑÒÀÍÎÂÈÌ Ñ×ÅÒ×ÈÊ ÄÍÅÉ.
MOVFWDHUEI;ÅÑËÈ
ÑÓÌÌÀ ÄÍÅÉ
ADDWFDHUDI,0;ÍÅ
ÐÀÂÍÀ ÍÓËÞ,
SKPZ
GOTOYC8COY;ÒÎ
ÓÑÒÀÍÎÂÈÌ Ñ×ÅÒ×ÈÊ ÄÍÅÉ.
DECFMECZ,1;ÈÍÀ×Å
ÓÌÅÍÜØÈÌ ÌÅÑßÖ.
SKPZ;ÅÑËÈ
ÌÅÑßÖ ÍÓËÅÂÎÉ,
GOTO$+3;
MOVLW.12;ÒÎ
ÓÑÒÀÍÎÂÈÌ ÄÅÊÀÁÐÜ.
MOVWFMECZ;
MOVFWMECZ;ÏÐÎÂÅÐÈÌ
×ÈÑËÎ ÄÍÅÉ Â ÌÅÑßÖÅ.
CALLDAYMON;
MOVWFDHUDI;ÏÅÐÅÊÎÄÈÐÓÅÌ ÄÍÈ.
MOVWFTEMP;ÈÇ
2-ÃÎ Â 2_10-Å.
CALLBIDE;ÒÎËÜÊÎ ÄÎ 99!
MOVWFDHUDI;
MOVFWTEMP;
MOVWFDHUEI;
MOVFWMECZ;ÏÅÐÅÊÎÄÈÐÓÅÌ ÌÅÑßÖ.
MOVWFTEMP;ÈÇ
2-ÃÎ Â 2_10-Å.
CALLBIDE;ÒÎËÜÊÎ ÄÎ 99!
MOVWFMECDI;
MOVFWTEMP;
MOVWFMECEI;ÄÍÅÉ
 ÒÀÁËÈÖÅ ÌÅÑßÖÀ ÍÀ 1 ÁÎËÜØÅ,
GOTOYC8M;ÏÎÝÒÎÌÓ
ÏÎÂÒÎÐÈÌ.
YC8COY
INCFCOYC,1;ÓÌÅÍÜØÈÌ
Ñ×ÅÒ×ÈÊ ÄÍÅÉ.
MOVLW.8;ÍÅ
ÁÎËÅÅ 7.
SUBWFCOYC,0;
SKPC;
GOTOYC8COU;ÍÀ
ÓÑÒÀÍÎÂÊÓ Ñ×ÅÒ×ÈÊÀ Ñ×ÈÒÛÂÀÍÈß.
CLRFCOYC;ÎÁÍÓËÈÌ
Ñ×ÅÒ×ÈÊ.
CALLREGIN;ÇÀÃÐÓÇÈÌ
ÒÅÊÓÙÈÉ ÄÅÍÜ.
BCFFLAG2,6;ÑÁÐÎÑÈÌ
ÔËÀà Ñ×ÅÒ×ÈÊÀ ÄÍÅÉ.
GOTOYC8M;ÓÑÒÀÍÎÂÈÌ
Â×ÅÐÀØÍÈÉ ÄÅÍÜ.
YC8COU
BSFFLAG2,5;ÓÑÒÀÍÎÂÈÌ
ÔËÀÃ ÂÛÏÎËÍÅÍÍÎÉ ÓÑÒÀÍÎÂÊÈ ÌÈÍÓÑ.
BTFSCFLAG2,6;ÅÑËÈ
ÔËÀÃ ÍÓËÅÂÎÉ,
GOTO$+0x09;
CLRFCOYC;
MOVLW.16;ÒÎ
ÓÑÒÀÍÎÂÈÌ Ñ×ÅÒ×ÈÊ Ñ×ÈÒÛÂÀÍÈß.
SUBWFCOUZ,0;ÀÄÐÅÑ
×ÒÅÍÈß ÐÀÂÅÍ ÀÄÐÅÑÓ ÇÀÏÈÑÈ
MOVWFCOUE;ÌÈÍÓÑ
16.
BNC$+7;ÅÑËÈ
ÏÅÐÅÕÎÄ ×ÅÐÅÇ 0, ÒÎ ÓÑÒÀÍÎÂÈÌ .112.
BSFFLAG2,6;ÓÑÒÀÍÎÂÊÀ
ÂÛÏÎËÍÅÍÀ.
RETURN;ÂÅÐÍÅÌÑß.
MOVLW.16;ÑËÅÄÓÞÙÈÉ
ÀÄÐÅÑ ×ÒÅÍÈß
SUBWFCOUE,1;ÐÀÂÅÍ
ÒÅÊÓÙÅÌÓ ÌÈÍÓÑ 16.
SKPNC;ÅÑËÈ
ÏÅÐÅÕÎÄ ×ÅÐÅÇ 0,
RETURN
MOVLW.112;ÒÎ
ÓÑÒÀÍÎÂÈÌ .112.
MOVWFCOUE;
BSFFLAG2,6;ÓÑÒÀÍÎÂÊÀ
ÂÛÏÎËÍÅÍÀ.
RETURN
YC00
CLRFMIN;ÎÁÍÓËÅÍÈÅ
ÐÅÃÈÑÒÐÎÂ
CLRFMINL;ÌÈÍÓÒ
È ÑÅÊÓÍÄ
CLRFMINH;ÏÐÈ
ÓÑÒÀÍÎÂÊÅ ÏÎ ÑÈÃÍÀËÀÌ
CLRFCEK;ÒÎ×ÍÎÃÎ
ÂÐÅÌÅÍÈ.
RETURN
;======================================================
; 30.
ÂÎÑÑÒÀÍÎÂËÅÍÈÅ ÒÅÊÓÙÈÕ ÐÅÃÈÑÒÐÎÂ ÈÍÄÈÊÀÖÈÈ ÏÎÑËÅ ÏÐÎÑÌÎÒÐÀ.
;======================================================
REGIN
MOVFWMECD;
MOVWFMECDI;
MOVFWMECE;
MOVWFMECEI;
MOVFWDHUD;
MOVWFDHUDI;
MOVFWDHUE;
MOVWFDHUEI;
MOVFWMEC;
MOVWFMECZ;
RETURN
;=============================================
; 31.
ÏÐÅÄÅËÜÍÛÅ ÓÑÒÀÍÎÂÊÈ MAX, MIN  ÏÎËÍÎ×Ü.
;=============================================
POLNO
MOVLW.253;-
MOVWFSOT1X;ÇÍÀÊ 1 MAX.
MOVWFSOT2X;ÇÍÀÊ 2 MAX.
MOVLW.55;-55.
MOVWFLSB1X;ÑÎÕÐÀÍÅÍÍÎÅ
ÌÀÊÑÈÌÀËÜÍÎÅ 1 ÄÀÒ×ÈÊÀ.
MOVWFLSB2X;-"-
2 ÄÀÒ×ÈÊÀ.
CLRFDST1X;ÑÎÕÐÀÍÅÍÍÎÅ
ÌÀÊÑÈÌÀËÜÍÎÅ ÄÅÑßÒÛÕ 1 ÄÀÒ×ÈÊÀ.
CLRFDST2X;-"-
2 ÄÀÒ×ÈÊÀ.
MOVLW.251;+
MOVWFSOT1N;ÇÍÀÊ
1 MIN.
MOVWFSOT2N;ÇÍÀÊ 2 MIN.
MOVLW.99;+99.
MOVWFLSB1N;ÑÎÕÐÀÍÅÍÍÎÅ
ÌÈÍÈÌÀËÜÍÎÅ 1 ÄÀÒ×ÈÊÀ.40
MOVWFLSB2N;-"-
2 ÄÀÒ×ÈÊÀ.
MOVLW.9;0,9
MOVWFDST1N;ÑÎÕÐÀÍÅÍÍÎÅ
ÌÈÍÈÌÀËÜÍÎÅ ÄÅÑßÒÛÕ 1 ÄÀÒ×ÈÊÀ.
MOVWFDST2N;-"-
2 ÄÀÒ×ÈÊÀ.
RETURN
;=========================================
; 32.
ÈÍÈÖÈÀËÈÇÀÖÈß ÆÊÈ.
;=========================================
JEKINI
MOVLW03;
CALLJEKOM;
CALLSTROB;
MOVLW03;
CALLJEKOM;
CALLSTROB;
MOVLW03;
CALLJEKOM;
CALLSTROB;
MOVLW03;
CALLJEKOM;
CALLSTROB;
MOVLW10;ÂÛÊËÞ×ÅÍÈÅ ÄÈÑÏËÅß.
CALLJEKOM;
CALLSTROB;
MOVLW06;ÑÌÅÙÅÍÈÅ ÊÓÐÑÎÐÀ.
CALLJEKOM;
CALLSTROB;
MOVLW01;ÑÒÈÐÀÍÈÅ ÏÀÌßÒÈ ÄÈÑÏËÅß.
CALLJEKOM;
CALLSTROB;
MOVLW28;ÔÎÐÌÀÒ ÎÁÌÅÍÀ: 4 ÐÀÇÐ., 5õ7, 2 ÑÒÐÎÊÈ.
CALLJEKOM;
CALLSTROB;
MOVLW0C;ÂÊËÞ×ÅÍÈÅ ÄÈÑÏËÅß, ÇÀÏÐÅÒ ÊÓÐÑÎÐÀ.
CALLJEKOM;
CALLSTROB;
GOTOMYLTIK;ÍÀ ÐÀÑÏÐÅÄÅËÈÒÅËÜ.
;=========================================
; 33.
ÔÎÐÌÈÐÎÂÀÍÈÅ ÑÒÐÎÁÈÐÓÞÙÅÃÎ ÈÌÏÓËÜÑÀ.
;=========================================
STROB
BSF PORTB,E ;ÂÊËÞ×ÀÅÌ
ÑÒÐÎÁ-ÈÌÏÓËÜÑ.
NOP
BCF PORTB,E ;ÂÛÊËÞ×ÀÅÌ
ÑÒÐÎÁ.
RETURN ;ÂÅÐÍÅÌÑß.
;===============================================
; 34.
ÏÅÐÅÄÀ×À ÊÎÌÀÍÄÛ Â ÆÊÈ.
;===============================================
JEKOM
MOVWF TEMP ;ÏÅÐÅÏÈØÅÌ
ÇÍÀ×ÅÍÈÅ ÂÎ ÂÐÅÌÅÍÍÛÉ ÐÅÃÈÑÒÐ.
ANDLW B'11110000';ÇÀÌÀÑÊÈÐÓÅÌ
ÌËÀÄØÈÅ ÐÀÇÐßÄÛ ÏÎÄ ÍÎËÜ.
MOVWF PORTB ;ÎÑÒÀËÜÍÛÅ
ÐÀÇÐßÄÛ ÏÅÐÅÏÈØÅÌ Â ÏÎÐÒ "Â".
CALL STROB ;ÏÐÎÑÒÐÎÁÈÐÓÅÌ.
CALL
PAUSA ;ÏÀÓÇÀ.
MOVFW TEMP
SWAPF TEMP,W
;ÏÎÌÅÍßÅÌ ÌÅÑÒÀÌÈ ÏÎËÓÁÀÉÒÛ.
ANDLW B'11110000';ÇÀÌÀÑÊÈÐÓÅÌ
ÑÒÀÐØÈÅ ÐÀÇÐßÄÛ ÏÎÄ ÍÎËÜ.
MOVWF PORTB ;ÏÅÐÅÏÈØÅÌ
 ÏÎÐÒ "Â".
CALL STROB ;ÏÐÎÑÒÐÎÁÈÐÓÅÌ.
PAUSA
MOVLW
.255;1 ÌÑ. ÏÀÓÇÀ ÄËß ÇÀÏÈÑÈ ÊÎÌÀÍÄÛ.
ADDLW -1
BTFSS STATUS,2
GOTO
$-2
RETURN
;=====================================
;
35. ÇÀÏÈÑÜ ÄÀÍÍÛÕ Â ÆÊÈ.
;=====================================
JEDAT
MOVWF TEMP;ÏÅÐÅÏÈØÅÌ
ÇÍÀ×ÅÍÈÅ ÂÎ ÂÐÅÌÅÍÍÛÉ ÐÅÃÈÑÒÐ.
ANDLW B'11110000';ÇÀÌÀÑÊÈÐÓÅÌ
ÌËÀÄØÈÅ ÐÀÇÐßÄÛ ÏÎÄ ÍÎËÜ.
ADDLW 30;ÏÅÐÅÂÎÄ
 ÊÎÄ ASCII, ÒÎËÜÊÎ ÄËß ÖÈÔÐ!
MOVWF PORTB;ÎÑÒÀËÜÍÛÅ
ÐÀÇÐßÄÛ ÏÅÐÅÏÈØÅÌ Â ÏÎÐÒ "Â".
BSF PORTB,RS;ÓÑÒÀÍÎÂÈÌ
R/S ÍÀ ÐÀÇÐÅØÅÍÈÅ ÇÀÏÈÑÈ ÄÀÍÍÛÕ.
CALL STROB;ÏÐÎÑÒÐÎÁÈÐÓÅÌ.
CALL PAUS;ÏÀÓÇÀ
ÄËß ÎÑÂÎÁÎÆÄÅÍÈß ÆÊÈ ÎÒ ÖÈÊËÀ ÇÀÏÈÑÈ.
MOVFW TEMP;
SWAPF TEMP,0;ÏÎÌÅÍßÅÌ
ÌÅÑÒÀÌÈ ÏÎËÓÁÀÉÒÛ.
ANDLW B'11110000';ÇÀÌÀÑÊÈÐÓÅÌ
ÑÒÀÐØÈÅ ÐÀÇÐßÄÛ ÏÎÄ ÍÎËÜ.
MOVWF PORTB;ÎÑÒÀËÜÍÛÅ
ÐÀÇÐßÄÛ ÏÅÐÅÏÈØÅÌ Â ÏÎÐÒ "Â".
BSF PORTB,RS;ÓÑÒÀÍÎÂÈÌ
R/S ÍÀ ÐÀÇÐÅØÅÍÈÅ ÇÀÏÈÑÈ ÄÀÍÍÛÕ.
CALL STROB;ÏÐÎÑÒÐÎÁÈÐÓÅÌ.
PAUS
MOVLW
.10;40 ÌÊÑ. ÏÀÓÇÀ ÄËß ÇÀÏÈÑÈ ÄÀÍÍÛÕ.
ADDLW -1
BTFSS STATUS,2
GOTO $-2
RETURN
;========================================
; 36.
ÏÅÐÅÇÀÏÈÑÜ Â ÐÅÃÈÑÒÐÛ ÈÍÄÈÊÀÖÈÈ.
;========================================
CTP1
BTFSCFLAG2,0;
GOTOTEK1;ÒÅÊÓÙÀß
ÈÍÄÈÊÀÖÈß.
BTFSCFLAG2,1;
GOTOINDYC1;ÓÑÒÀÍÎÂÊÀ
×ÀÑÎÂ È ÄÍÅÉ.
GOTOCMOTP1;ÏÐÎÑÌÎÒÐ.
CTP2
BTFSCFLAG2,0;
GOTOTEK2;ÒÅÊÓÙÀß
ÈÍÄÈÊÀÖÈß.
BTFSCFLAG2,1;
GOTOINDYC2;ÓÑÒÀÍÎÂÊÀ
×ÀÑÎÂ È ÄÍÅÉ.
GOTOCMOTP2;ÏÐÎÑÌÎÒÐ.
TEK1
MOVFWDHUDI;ÒÅÊÓÙÀß
ÈÍÄÈÊÀÖÈß 1 ÑÒÐÎÊÈ, ÄÅÑßÒÊÈ ÄÍÅÉ.
MOVWFR1;
MOVFWDHUEI;ÅÄÈÍÈÖÛ
ÄÍÅÉ.
MOVWFR2;
MOVLW.240;ÏÓÑÒÎ.
MOVWFR3;
MOVWFR9;
MOVFWHOUH;ÄÅÑßÒÊÈ
×ÀÑÎÂ.
MOVWFR4;
MOVFWHOUL;ÅÄÈÍÈÖÛ
×ÀÑÎÂ.
MOVWFR5;
MOVLW.240;ÏÓÑÒÎ.
BTFSCCEK,0;ÄÂÎÅÒÎ×ÈÅ
ÂÊËÞ×ÀÅÒÑß ×ÅÐÅÇ 1 ÑÅÊÓÍÄÓ.
MOVLW.10;ÄÂÎÅÒÎ×ÈÅ.
MOVWFR6;
MOVFWMINH;ÄÅÑßÒÊÈ
ÌÈÍÓÒ.
MOVWFR7;
MOVFWMINL;ÅÄÈÍÈÖÛ
ÌÈÍÓÒ.
MOVWFR8;
MOVFWSOT1;ÇÍÀÊ.
MOVWFR10;
MOVFWDES1;ÄÅÑßÒÊÈ
ÒÅÌÏÅÐÀÒÓÐÛ 1.
MOVWFR11;
MOVFWEDI1;ÅÄÈÍÈÖÛ
ÒÅÌÏÅÐÀÒÓÐÛ 1.
MOVWFR12;
MOVLW.252;ÇÀÏßÒÀß
1.
MOVWFR13;
MOVFWDST1;ÄÅÑßÒÛÅ
ÒÅÌÏÅÐÀÒÓÐÛ 1.
MOVWFR14;
MOVLW.14;>.
MOVWFR15;
MOVLW.1;1.
MOVWFR16;
RETURN
TEK2
MOVFWMECDI;ÒÅÊÓÙÀß
ÈÍÄÈÊÀÖÈß 2 ÑÒÐÎÊÈ, ÄÅÑßÒÊÈ ÌÅÑßÖÀ.
MOVWFR1;
MOVFWMECEI;ÅÄÈÍÈÖÛ
ÌÅÑßÖÀ.
MOVWFR2;
MOVLW.240;ÏÓÑÒÎ.
MOVWFR3;
MOVWFR4;
MOVWFR5;
MOVWFR6;
MOVWFR7;
MOVWFR8;
MOVWFR9;
MOVFWSOT2;ÇÍÀÊ 2.
MOVWFR10;
MOVFWDES2;ÄÅÑßÒÊÈ
ÒÅÌÏÅÐÀÒÓÐÛ 2.
MOVWFR11;
MOVFWEDI2;ÅÄÈÍÈÖÛ
ÒÅÌÏÅÐÀÒÓÐÛ 2.
MOVWFR12;
MOVLW.252;ÇÀÏßÒÀß
2.
MOVWFR13;
MOVFWDST2;ÄÅÑßÒÛÅ
ÒÅÌÏÅÐÀÒÓÐÛ 2.
MOVWFR14;
MOVLW.14;>.
MOVWFR15;
MOVLW.2;2.
MOVWFR16;
RETURN
INDYC1
BTFSSPORTA,HOL;ÅÑËÈ ÍÀÆÀÒÀ ÊÍÎÏÊÀ
"ÑÁÐÎÑ",
CALLYC00;ÒÎ
ÎÁÍÓËÈÌ ÑÅÊÓÍÄÛ È ÌÈÍÓÒÛ.
MOVLW.123;ÓÑÒÀÍÎÂÊÀ
×ÀÑÎÂ È ÄÀÒÛ 1 ÑÒÐÎÊÀ.
MOVWFR1;×.
MOVLW.17;À.
MOVWFR2;
MOVLW.19;Ñ.
MOVWFR3;
MOVLW.126;Û.
MOVWFR4;
MOVLW.240;ÏÓÑÒÎ.
MOVWFR5;
MOVWFR11;
MOVWFR12;
MOVWFR13;
MOVWFR14;
MOVWFR15;
MOVWFR16;
MOVFWHOUH;ÒÅÊÓÙÈÅ
ÇÍÀ×ÅÍÈß: ÄÅÑßÒÊÈ ×ÀÑÎÂ,
MOVWFR6;
MOVFWHOUL;ÅÄÈÍÈÖÛ
×ÀÑÎÂ.
MOVWFR7;
MOVLW.10;ÄÂÎÅÒÎ×ÈÅ.
MOVWFR8;
MOVFWMINH;ÄÅÑßÒÊÈ
ÌÈÍÓÒ.
MOVWFR9;
MOVFWMINL;ÅÄÈÍÈÖÛ
ÌÈÍÓÒ.
MOVWFR10;
RETURN
INDYC2
MOVLW.176;Ä.
MOVWFR1;
MOVLW.17;À.
MOVWFR2;
MOVLW.36;Ò.
MOVWFR3;
MOVLW.17;À.
MOVWFR4;
MOVLW.240;ÏÓÑÒÎ.
MOVWFR5;
MOVWFR11;
MOVWFR12;
MOVWFR13;
MOVWFR14;
MOVWFR15;
MOVWFR16;
MOVFWDHUDI;ÄÅÑßÒÊÈ ÄÍÅÉ.
MOVWFR6;
MOVFWDHUEI;ÅÄÈÍÈÖÛ ÄÍÅÉ.
MOVWFR7;
MOVLW.253;ÏÐÎ×ÅÐÊ.
MOVWFR8;
MOVFWMECDI;ÄÅÑßÒÊÈ
ÌÅÑßÖÀ.
MOVWFR9;
MOVFWMECEI;ÅÄÈÍÈÖÛ
ÌÅÑßÖÀ.
MOVWFR10;
RETURN
CMOTP1
MOVFWDHUDI;ÅÑËÈ
ÏÐÎÑÌÎÒÐ
ADDWFDHUEI,0;ÑÅÃÎÄÍßØÍÅÉ
ÄÀÒÛ,
SUBWFDHU,0;ÒÎ
ÐÅÃÈÑÒÐÛ ÈÍÄÈÊÀÖÈÈ ÍÅ ÌÅÍßÅÌ.
SKPC;
GOTO$+5;
MOVFWMECDI;
ADDWFMECEI,0;
SUBWFMEC,0;
SKPNC;
CALLBDINZ1;ÈÍÀ×Å
ÓÑÒÀÍÎÂÈÌ Ñ×ÈÒÀÍÍÛÅ ÇÍÀ×ÅÍÈß 1 ÑÒÐÎÊÈ.
MOVFWDHUDI;ÄÅÑßÒÊÈ
ÄÍÅÉ.
MOVWFR1;
MOVFWDHUEI;ÅÄÈÍÈÖÛ
ÄÍÅÉ.
MOVWFR2;
MOVLW.14;>.
MOVWFR3;ÏÎ
ÓÌÎË×ÀÍÈÞ
MOVLW.1;1.
BTFSCFLAG1,1;ÅÑËÈ
ÔËÀÃ ÓÑÒÀÍÎÂËÅÍ,
MOVLW.2;ÒÎ -
2.
MOVWFR4;
MOVLW.240;ÏÓÑÒÎ.
MOVWFR5;
MOVWFR11;
MOVLW.253;ÏÐÎ×ÅÐÊ.
MOVWFR8;
MOVFWDES1;ÄÅÑßÒÊÈ
ÒÅÌÏÅÐÀÒÓÐÛ.
MOVWFR13;
MOVFWEDI1;ÅÄÈÍÈÖÛ
ÒÅÌÏÅÐÀÒÓÐÛ.
MOVWFR14;
MOVLW.252;ÇÀÏßÒÀß
1.
MOVWFR15;
MOVFWDST1;ÄÅÑßÒÛÅ
ÒÅÌÏÅÐÀÒÓÐÛ.
MOVWFR16;
RETURN
CMOTP2
MOVFWDHUDI;ÅÑËÈ
ÏÐÎÑÌÎÒÐ
ADDWFDHUEI,0;ÑÅÃÎÄÍßØÍÅÉ
ÄÀÒÛ,
SUBWFDHU,0;ÒÎ
ÐÅÃÈÑÒÐÛ ÈÍÄÈÊÀÖÈÈ ÍÅ ÌÅÍßÅÌ.
SKPC;
GOTO$+5;
MOVFWMECDI;
ADDWFMECEI,0;
SUBWFMEC,0;
SKPNC;
CALLBDIN12;ÈÍÀ×Å
ÓÑÒÀÍÎÂÈÌ Ñ×ÈÒÀÍÍÛÅ ÇÍÀ×ÅÍÈß 2 ÑÒÐÎÊÈ.
MOVFWMECDI;ÄÅÑßÒÊÈ
ÌÅÑßÖÀ.
MOVWFR1;
MOVFWMECEI;ÅÄÈÍÈÖÛ
ÌÅÑßÖÀ.
MOVWFR2;
MOVLW.240;ÏÓÑÒÎ.
MOVWFR3;
MOVWFR4;
MOVWFR5;
MOVWFR11;
MOVLW.253;ÏÐÎ×ÅÐÊ.
MOVWFR8;
MOVFWDES2;ÄÅÑßÒÊÈ
ÒÅÌÏÅÐÀÒÓÐÛ 2.
MOVWFR13;
MOVFWEDI2;ÅÄÈÍÈÖÛ
ÒÅÌÏÅÐÀÒÓÐÛ 2.
MOVWFR14;
MOVLW.252;ÇÀÏßÒÀß
2.
MOVWFR15;
MOVFWDST2;ÄÅÑßÒÛÅ
ÒÅÌÏÅÐÀÒÓÐÛ 2.
MOVWFR16;
RETURN
;======================================================
; 37. ÂÛÂÎÄ
ÇÍÀ×ÅÍÈÉ ÐÅÃÈÑÒÐΠÍÀ ÈÍÄÈÊÀÖÈÞ.
;======================================================
JEKIND
BSFSTATUS,5;ÏÅÐÅÕÎÄÈÌ
 ÁÀÍÊ 1.
BCFTRISB^80H,YCMI;ÍÀ
ÂÛÕÎÄ.
BCFTRISB^80H,YCPL;ÍÀ
ÂÛÕÎÄ.
BCFSTATUS,5;ÏÅÐÅÕÎÄÈÌ
 ÁÀÍÊ 0.
BTFSSFLAG1,0;ÅÑËÈ
ÒÅÊÓÙÀß ÈÍÄÈÊÀÖÈß,
GOTO$+3;ÒÎ
ÏÐÎÏÓÑÊÀÅÌ ÈÍÄÈÊÀÖÈÞ ÊÓÐÑÎÐÀ.
BTFSSFLAG,6;ÅÑËÈ
ÈÍÄÈÊÀÖÈß ÊÓÐÑÎÐÀ ÂÛÏÎËÍÅÍÀ, ÒÎ ÏÐÎÏÓÑÊÀÅÌ ÅÅ.
GOTO
JEKYC;ÏÐÎÈÍÄÈÖÈÐÓÅÌ ÊÓÐÑÎÐ.
MOVLW 02;ÂÎÇÂÐÀÒ
ÊÓÐÑÎÐÀ  ÈÑÕÎÄÍÎÅ ÑÎÑÒÎßÍÈÅ.
CALL JEKOM;ÇÀÏÈØÅÌ
ÊÎÌÀÍÄÓ.
MOVLW B'10000000';ÊÓÐÑÎÐ
ÍÀ 0 ÏÎÇÈÖÈÞ ÏÅÐÂÎÉ ÑÒÐÎÊÈ.
CALL JEKOM;ÇÀÏÈØÅÌ
ÊÎÌÀÍÄÓ.
CALLCTP1;ÏÅÐÅÏÈØÅÌ
 ÐÅÃÈÑÒÐÛ ÈÍÄÈÊÀÖÈÈ 1 ÑÒÐÎÊÓ.
CALLJEKCTP;ÇÀÏÈØÅÌ
 ÈÍÄÈÊÀÒÎÐ 1 ÑÒÐÎÊÓ.
MOVLW B'11000000';ÂÒÎÐÀß
ÑÒÐÎÊÀ. 0x0C0
CALL JEKOM;ÇÀÏÈØÅÌ
ÊÎÌÀÍÄÓ.
CALLCTP2;ÏÅÐÅÏÈØÅÌ
 ÐÅÃÈÑÒÐÛ ÈÍÄÈÊÀÖÈÈ 2 ÑÒÐÎÊÓ.
CALLJEKCTP;ÇÀÏÈØÅÌ
 ÈÍÄÈÊÀÒÎÐ 2 ÑÒÐÎÊÓ.
BCFFLAG,6;
RETURN
JEKCTP
MOVLW.16;
MOVWFCOUN;ÓÑÒÀÍÎÂÈÌ
Ñ×ÅÒ×ÈÊ ÈÍÄÈÊÀÖÈÈ ÇÍÀÊÎÌÅÑÒ.
MOVLW R1;ÀÄÐÅÑ
ÏÅÐÂÎÃÎ ÐÅÃÈÑÒÐÀ ÈÍÄÈÊÀÖÈÈ.
MOVWFFSR;ÏÎ
ÊÎÑÂÅÍÍÎÉ ÀÄÐÅÑÀÖÈÈ
MOVFWINDF;ÓÑÒÀÍÎÂÈÌ
ÇÍÀ×ÅÍÈÅ ÐÅÃÈÑÒÐÀ.
CALL JEDAT;ÇÀÏÈØÅÌ
 ÈÍÄÈÊÀÒÎÐ.
DECFCOUN,1;ÓÌÅÍÜØÈÌ
Ñ×ÅÒ×ÈÊ.
BTFSCSTATUS,2;ÅÑËÈ
ÍÅÒ ÍÓËß,
RETURN;
INCFFSR,1;ÒÎ
ÂÛÁÅÐÅÌ ÑËÅÄÓÞÙÈÉ ÐÅÃÈÑÒÐ.
GOTO$-6;ÏÎÂÒÎÐÈÌ
ÂÛÂÎÄ ÍÀ ÈÍÄÈÊÀÖÈÞ.
;=======================================
; 38.
ÏÐÎÂÅÐÊÀ ÊÍÎÏÎÊ.
;=======================================
KHOP
BSFSTATUS,5;ÏÅÐÅÕÎÄÈÌ
 ÁÀÍÊ 1.
BSFTRISB^80H,YCMI;ÍÀ
ÂÕÎÄ.
BSFTRISB^80H,YCPL;ÍÀ
ÂÕÎÄ.
BCFSTATUS,5;ÏÅÐÅÕÎÄÈÌ
 ÁÀÍÊ 0.
BTFSSFLAG1,0;ÅÑËÈ
ÍÅÒ ÓÑÒÀÍÎÂÊÈ,
GOTOKHOP1;ÊÍÎÏÊÈ
ÍÅ ÏÐÎÂÅÐßÞÒÑß.
BTFSCFLAG2,2;ÏÐÈ
ÏÐÎÑÌÎÒÐÅ
GOTO$+0x0D;ÍÅ
ÏÐÎÂÅÐßÅÒÑß ÐÀÇÐßÄ È ÏËÞÑ.
BTFSCFLAG,3;ÅÑËÈ
ÐÀÍÅÅ ÁÛËÀ ÍÀÆÀÒÀ ÊÍÎÏÊÀ,
CALLYCTAL;ÒÎ
ÈÄÅÌ ÍÀ ÓÑÒÀÍÎÂÊÓ ÐÀÇÐßÄÀ.
BTFSSPORTB,YCPL;ÅÑËÈ
ÊÍÎÏÊÀ ÏËÞÑ ÍÀÆÀÒÀ,
BSFFLAG,3;ÏÎÑÒÀÂÈÌ
ÔËÀÃ.
BTFSSPORTB,YCPL;ÅÑËÈ
ÊÍÎÏÊÀ ÏËÞÑ ÍÀÆÀÒÀ,
BSFFLAG1,2;ÇÀÏÐÅÙÀÅÌ
ÈÍÄÈÊÀÖÈÞ.
BTFSCFLAG,5;ÅÑËÈ
ÐÀÍÅÅ ÁÛËÀ ÍÀÆÀÒÀ ÊÍÎÏÊÀ "ÐÀÇÐßÄ",
CALLKYPCY;ÒÎ
ÈÄÅÌ ÍÀ ÓÑÒÀÍÎÂÊÓ ÊÓÐÑÎÐÀ.
BTFSSPORTB,PAZ;ÅÑËÈ
ÊÍÎÏÊÀ "ÐÀÇÐßÄ" ÍÀÆÀÒÀ,
BSFFLAG,5;ÏÎÑÒÀÂÈÌ
ÔËÀÃ.
BTFSCFLAG2,1;ÏÐÈ
ÓÑÒÀÍÎÂÊÅ ÄÀÒÛ
GOTOKHOP1;ÊÍÎÏÊÀ
ÌÈÍÓÑ ÍÅ ÏÐÎÂÅÐßÅÒÑß.
BTFSCFLAG,2;ÅÑËÈ
ÐÀÍÅÅ ÁÛËÀ ÍÀÆÀÒÀ ÊÍÎÏÊÀ ÌÈÍÓÑ,
CALLYCTAM;ÒÎ
ÈÄÅÌ ÍÀ ÓÑÒÀÍÎÂÊÓ ÐÀÇÐßÄÀ.
BTFSSPORTB,YCMI;ÅÑËÈ
ÊÍÎÏÊÀ ÌÈÍÓÑ ÍÀÆÀÒÀ,
BSFFLAG,2;ÏÎÑÒÀÂÈÌ
ÔËÀÃ.
BTFSSPORTB,YCMI;ÅÑËÈ
ÊÍÎÏÊÀ ÌÈÍÓÑ ÍÀÆÀÒÀ,
BSFFLAG1,2;ÇÀÏÐÅÙÀÅÌ
ÈÍÄÈÊÀÖÈÞ.
KHOP1
BTFSSPORTB,PEJ;ÅÑËÈ
ÊÍÎÏÊÀ "ÐÅÆÈÌ" ÍÀÆÀÒÀ,
BSFFLAG,4;ÏÎÑÒÀÂÈÌ
ÔËÀÃ.
BTFSSFLAG,4;ÅÑËÈ
ÊÍÎÏÊÀ "ÐÅÆÈÌ" ÍÅ ÁÛËÀ ÍÀÆÀÒÀ,
GOTOVUBOR;ÒÎ
ÈÄÅÌ ÍÀ ÂÛÁÎÐ ÐÅÆÈÌÀ ÈÍÄÈÊÀÖÈÈ.
BTFSSPORTB,PEJ;ÅÑËÈ
ÊÍÎÏÊÀ "ÐÅÆÈÌ" ÍÀÆÀÒÀ,
GOTOVUBOR;ÒÎ
ÈÄÅÌ ÍÀ ÂÛÁÎÐ ÐÅÆÈÌÀ ÈÍÄÈÊÀÖÈÈ.
BCFFLAG,4;ÑÁÐÎÑÈÌ
ÔËÀÃ ÊÍÎÏÊÈ.
INCFREID,1;ÈÇÌÅÍÅÍÈÅ
ÐÅÆÈÌÀ ÈÍÄÈÊÀÖÈÈ.
MOVLW.3;3
ÐÅÆÈÌÀ ÈÍÄÈÊÀÖÈÈ.
SUBWFREID,0;ÅÑËÈ
ÁÎËÜØÅ,
BTFSSSTATUS,2;ÒÎ
ÏÎÉÄÅÌ ÍÀ ÑÁÐÎÑ.
GOTOVUBOR;ÍÀ
ÇÀÏÈÑÜ Â ÐÅÃÈÑÒÐÛ ÈÍÄÈÊÀÖÈÈ.
CLRFREID;ÑÁÐÎÑ
ÐÅÆÈÌÀ.
GOTOVUBOR;ÍÀ
ÂÛÁÎÐ ÐÅÆÈÌÀ ÈÍÄÈÊÀÖÈÈ.
;======================================================
; 39.
ÑÎÕÐÀÍÅÍÈÅ È ÂÎÑÑÒÀÍÎÂËÅÍÈÅ ÇÍÀ×ÅÍÈÉ ÐÅÃÈÑÒÐΠÏÐÈ ÏÐÅÐÛÂÀÍÈÈ.
;======================================================
PRER
MOVWFWTEMP;ÑÎÕÐÀÍÅÍÈÅ
ÇÍÀ×ÅÍÈÉ ÐÅÃÈÑÒÐΠW È
MOVFWSTATUS;STATUS,
MOVWFSTEMP;
MOVFWFSR;FSR.
MOVWFFTEMP;
CALLS1;
REPER ;ÂÎÑÑÒÀÍÎÂËÅÍÈÅ
ÑÎÕÐÀÍÅÍÍÛÕ ÇÍÀ×ÅÍÈÉ.
MOVFWSTEMP;ÂÎÑÑÒÀÍÎÂËÅÍÈÅ
ÐÅÃÈÑÒÐÎÂ:
MOVWFSTATUS;STATUS,
MOVFWFTEMP;
MOVWFFSR;FSR,
MOVFWWTEMP;W.
BCFINTCON,2;ÑÁÐÀÑÛÂÀÅÌ ÔËÀÃ
ÏÐÅÐÛÂÀÍÈß ÎÒ TMR0.
RETFIE ;ÂÎÇÂÐÀÒ
ÈÇ ÏÐÅÐÛÂÀÍÈß.
;=============================================
; 40. Ñ×ÅÒ È
ÏÅÐÅÊÎÄÈÐÎÂÊÀ ÐÅÃÈÑÒÐÎÂ ×-Ì-Ñ.
;=============================================
S1
INCFMCK,1;ÏÐÈÁÀÂÈÌ
1 Â ÐÅÃÈÑÒÐ ÌÈËËÈÑÅÊÓÍÄ.
MOVFWMCK;
ADDLW-0x7D;Ñ×ÈÒÀÅÌ
ÄÎ 125.
BTFSSSTATUS,2;
RETURN;
CLRFMCK;ÎÁÍÓËÈÌ.
BTFSCFLAG,7;ÐÀÇÄÅËÈÌ
ÍÀ 2.
GOTO$+3;
BSFFLAG,7;
RETURN;
BCFFLAG,7;ÎÁÍÓËÈÌ
ÄÅËÈÒÅËÜ.
MOVFWCEK;ÇÀÃÐÓÇÊÀ
ÇÍÀ×ÅÍÈÉ ÑÅÊÓÍÄ Â ÐÀÁ. ÐÅÃÈÑÒÐ.
ADDLW-3BH;ÂÛ×ÅÑÒÜ
ÈÇ ÐÅÃÈÑÒÐÀ 59.236:4=59-0x0EC;
BZM1;ÑÐÀÂÍÈÒÜ
ÍÀ 0, ÅÑËÈ ÐÀÂÍÎ, ÏÅÐÅÉÒÈ ÍÀ M1,
INCFCEK,1;ÈÍÀ×Å
ÏÐÈÁÀÂÈÒÜ 1 Â ÐÅÃÈÑÒÐ ÑÅÊÓÍÄ.
RETURN;
M1
CLRFCEK;ÎÁÍÓËÅÍÈÅ
ÐÅÃÈÑÒÐÀ ÑÅÊÓÍÄ.
MOVFWMIN;ÇÀÃÐÓÇÊÀ
ÌÈÍÓÒ Â ÐÀÁ. ÐÅÃÈÑÒÐ.
ADDLW-3BH;-59.
BZH1;ÑÐÀÂÍÈÒÜ
ÍÀ 0, ÅÑËÈ ÐÀÂÍÎ, ÏÅÐÅÉÒÈ ÍÀ H1.
INCFMIN,1;ÏÐÈÁÀÂÈÒÜ
1 Â ÌÈÍÓÒÛ.
MOVFWMIN;MIN >W.
MOVWFTEMP;.
CALLBIDE;ÏÅÐÅÊÎÄÈÐÓÅÌ.
MOVWFMINH;W
> Â ÐÅÃÈÑÒÐ ÈÍÄÈÊÀÖÈÈ ÄÅÑßÒÊÎÂ ÌÈÍÓÒ.
MOVFWTEMP;ÂÐÅÌÅÍÍÛÉ
MOVWFMINL;Â
ÐÅÃÈÑÒÐ ÈÍÄÈÊÀÖÈÈ ÅÄÈÍÈÖ ÌÈÍÓÒ.
RETURN;
H1
CLRFMIN;ÎÁÍÓËßÅÌ
ÐÅÃÈÑÒÐ ÌÈÍÓÒ.
CLRFMINL;ÎÁÍÓËßÅÌ
ÅÄÈÍÈÖÛ ÌÈÍÓÒ ÈÍÄÈÊÀÖÈÈ.
CLRFMINH;ÎÁÍÓËßÅÌ
ÄÅÑßÒÊÈ ÌÈÍÓÒ ÈÍÄÈÊÀÖÈÈ.
MOVFWHOU;ÇÀÃÐÓÇÊÀ
×ÀÑΠ ÐÀÁ. ÐÅÃÈÑÒÐ.
ADDLW-17H;-
23.
BZD1;ÑÐÀÂÍÈÒÜ
ÍÀ 0, ÅÑËÈ ÐÀÂÍÎ, ÏÅÐÅÉÒÈ ÍÀ H10.
INCFHOU,1;ÏÐÈÁÀÂÈÒÜ
1  ×ÀÑÛ.
MOVFWHOU;HOU
>W.
MOVWFTEMP;
CALLBIDE;ÏÅÐÅÊÎÄÈÐÓÅÌ.
MOVWFHOUH;W
>  ÐÅÃÈÑÒÐ ÈÍÄÈÊÀÖÈÈ ÄÅÑßÒÊΠ×ÀÑÎÂ.
MOVFWTEMP;ÂÐÅÌÅÍÍÛÉ
MOVWFHOUL;Â
ÐÅÃÈÑÒÐ ÈÍÄÈÊÀÖÈÈ ÅÄÈÍÈÖ ×ÀÑÎÂ.
RETURN;
D1
CLRFHOU;ÎÁÍÓËÅÍÈÅ
ÐÅÃÈÑÒÐÀ ×ÀÑÎÂ.
CLRFHOUL;ÎÁÍÓËÅÍÈÅ
ÅÄÈÍÈÖ ×ÀÑÎÂ.
CLRFHOUH;ÎÁÍÓËÅÍÈÅ
ÄÅÑßÒÊΠ×ÀÑÎÂ.
CALLSAPIS;ÍÀ
ÇÀÏÈÑÜ.
CALLPOLNO;ÍÀ
ÓÑÒÀÍÎÂÊÓ ÏÐÅÄÅËÜÍÛÕ ÇÍÀ×ÅÍÈÉ.
INCFDHU,1;ÏÐÈÁÀÂÈÒÜ
1 Â ÄÍÈ.
MOVFWMEC;×ÈÑËÎ
ÄÍÅÉ ÍÅ ÄÎËÆÍÎ ÏÐÅÂÛØÀÒÜ
CALLDAYMON;×ÈÑËÀ
ÄÀÍÍÎÃÎ ÌÅÑßÖÀ.
SUBWFDHU,0;
SKPNC;
GOTOME1;ÈÍÀ×Å
ÓÂÅËÈ×ÈÌ ÌÅÑßÖ.
MOVFWDHU;
MOVWFTEMP;
CALLBIDE;ÏÅÐÅÊÎÄÈÐÓÅÌ.
MOVWFDHUD;W
> Â ÐÅÃÈÑÒÐ ÈÍÄÈÊÀÖÈÈ ÄÅÑßÒÊÎÂ ÄÍÅÉ.
MOVFWTEMP;ÂÐÅÌÅÍÍÛÉ
MOVWFDHUE;Â
ÐÅÃÈÑÒÐ ÈÍÄÈÊÀÖÈÈ ÅÄÈÍÈÖ ÄÍÅÉ.
RETURN;
ME1
MOVLW.1;ÓÑÒÀÍÎÂÈÌ
ÏÅÐÂÎÅ ×ÈÑËÎ.
MOVWFDHU;
MOVWFDHUE;
CLRFDHUD;
INCFMEC,1;ÏÐÈÁÀÂÈÌ
ÌÅÑßÖ.
MOVLW.13;ÍÅ
ÁÎËÅÅ 12.
SUBWFMEC,0;
SKPNC;
GOTOME1ME;ÅÑËÈ
ÁÎËÜØÅ, ÒÎ ÓÑÒÀÍÎÂÈÌ 1 ßÍÂÀÐß.
MOVFWMEC;
MOVWFTEMP;
CALLBIDE;ÏÅÐÅÊÎÄÈÐÓÅÌ.
MOVWFMECD;W
> Â ÐÅÃÈÑÒÐ ÈÍÄÈÊÀÖÈÈ ÄÅÑßÒÊÎÂ ÌÅÑßÖÀ.
MOVFWTEMP;ÂÐÅÌÅÍÍÛÉ
MOVWFMECE;Â
ÐÅÃÈÑÒÐ ÈÍÄÈÊÀÖÈÈ ÅÄÈÍÈÖ ÌÅÑßÖÀ.
RETURN;
ME1ME
MOVLW.1;1
ßÍÂÀÐß.
MOVWFMEC;01-01.
MOVWFMECE;
CLRFMECD;
RETURN;
;=======================================
; 41.
ÏÅÐÅÊÎÄÈÐÎÂÊÀ ÈÇ 2-ÃÎ Â 2_10.
;=======================================
BIDE;ÏÅÐÅÊÎÄÈÐÎÂÊÀ
ÄÅÑßÒÊÎÂ
CLRFCOUN;ÎÁÍÓËßÅÌ
Ñ×ÅÒ×ÈÊ.
ADDLW-.10;ÂÛ×ÒÅÌ
10.
BTFSSSTATUS,0;ÅÑËÈ
ÅÑÒÜ ÏÅÐÅÕÎÄ ×ÅÐÅÇ ÍÎËÜ,
GOTO$+4;ÒÎ
ÇÀÂÅÐØÀÅÌ ÏÅÐÅÊÎÄÈÐÎÂÊÓ.
MOVWFTEMP;ÈÍÀ×Å
ÏÅÐÅÏÈØÅÌ ÍÎÂÎÅ ÇÍÀ×ÅÍÈÅ ÂÎ ÂÐÅÌÅÍÍÛÉ.
INCFCOUN,1;ÓÂÅËÈ×ÈÌ
Ñ×ÅÒ×ÈÊ.
GOTO$-5;ÏÎÂÒÎÐÈÌ
ÂÛ×ÈÒÀÍÈÅ.
MOVFWCOUN;ÇÍÀ×ÅÍÈÅ
Ñ×ÅÒ×ÈÊÀ (ÐÀÂÍÎ ×ÈÑËÓ ÄÅÑßÒÊÎÂ) ÏÅÐÅÏÈØÅÌ Â ÐÀÁÎ×ÈÉ ÐÅÃÈÑÒÐ.
RETURN;ÂÅÐÍÅÌÑß.
;================================
; 42. ÇÀÏÈÑÜ
ÇÍÀ×ÅÍÈÉ Â ÏÀÌßÒÜ.
;================================
SAPIS
CALLPERZAP;ÏÅÐÅÏÈØÅÌ
ÒÅÊÓÙÈÅ ÇÍÀ×ÅÍÈß Â ÐÅÃÈÑÒÐÛ ÇÀÏÈÑÈ.
BTFSCFLAG,0;ÂÂÎÄÈÌ
ÇÍÀÊ Â ÐÅÃÈÑÒÐÛ.
BSFLSBZ1X,7;-
BTFSCFLAG,1;
BSFLSBZ1N,7;-
BTFSCFLAG2,3;
BSFLSBZ2X,7;-
BTFSCFLAG2,4;
BSFLSBZ2N,7;-
MOVLWHOUZ1X;ÏÅÐÂÛÉ
ÀÄÐÅÑ ÇÀÏÈÑÛÂÀÅÌÎÃÎ ÐÅÃÈÑÒÐÀ
MOVWFFSR;Â
ÐÅÃÈÑÒÐ ÊÎÑÂÅÍÍÎÉ ÀÄÐÅÑÀÖÈÈ.
MOVFWCOUZ;ÍÀ×ÀËÜÍÛÉ
ÀÄÐÅÑ ÇÀÏÈÑÈ Â ÐÀÁÎ×ÈÉ ÐÅÃÈÑÒÐ.
BSFSTATUS,5;ÁÀÍÊ
1.
MOVWFEEADR;ÈÇ
ÐÀÁÎ×ÅÃÎ Â ÀÄÐÅÑ ÇÀÏÈÑÈ.
BCFINTCON,7;ÇÀÏÐÅÒ
ÏÐÅÐÛÂÀÍÈÉ.
CALLZAPIS;ÍÀ
ÇÀÏÈÑÜ.
INCFEEADR,1;ÓÂÅËÈ×ÈÌ
ÀÄÐÅÑ.
INCFFSR,1;ÂÛÁÅÐÅÌ
ÑËÅÄÓÞÙÈÉ ÐÅÃÈÑÒÐ.
BTFSSFSR,7;ÅÑËÈ
ÐÅÃÈÑÒÐ ÍÅ ÏÎÑËÅÄÍÈÉ,
GOTO$-4;ÏÎÂÒÎÐÈÌ
ÇÀÏÈÑÜ.
BCFSTATUS,5;ÁÀÍÊ
0.
BSFINTCON,7;ÐÀÇÐÅØÀÅÌ
ÏÐÅÐÛÂÀÍÈß.
MOVLW.16;ÓÑÒÀÍÎÂÈÌ
ÍÀ×ÀËÜÍÛÉ ÀÄÐÅÑ
ADDWFCOUZ,1;ÑËÅÄÓÞÙÅÉ
ÇÀÏÈÑÈ.
MOVLW.128;ÅÑËÈ
ÝÒÎ ÏÎÑËÅÄÍÈÉ ÀÄÐÅÑ,
SUBWFCOUZ,0;
SKPNC;
CLRFCOUZ;ÒÎ
ÍÀ×ÍÅÌ Ñ ÍÓËß.
RETURN;ÂÎÇÂÐÀÒ.
ZAPIS
MOVFWINDF;ÏÅÐÅÏÈØÅÌ
ÇÀÏÈÑÛÂÀÅÌÎÅ ÇÍÀ×ÅÍÈÅ
MOVWFEEDATA;Â
ÐÅÃÈÑÒÐ ÄÀÍÍÛÕ.
BSF EECON1,WREN;ÐÀÇÐÅØÅÍÈÅ
ÇÀÏÈÑÈ.
MOVLW 55H;ÎÁßÇÀÒÅËÜÍÀß
ÏÎÑËÅÄÎÂÀÒÅËÜÍÎÑÒÜ
MOVWF EECON2;/
MOVLW 0AAH;/
MOVWF EECON2;/
BSF EECON1,WR;ÏÐÈ
ÇÀÏÈÑÈ ÂÎ ÔËÅØ ÏÇÓ.
BTFSC EECON1,WR;ÏÎÊÀ
ÍÅ ÁÓÄÅÒ ÎÊÎÍ×ÀÍÈß ÇÀÏÈÑÈ
GOTO $-1;ÕÎÄÈÌ
ÏÎ ÊÐÓÃÓ.
BCF EECON1,WREN;ÇÀÏÐÅÒ
ÇÀÏÈÑÈ.
RETURN;ÂÎÇÂÐÀÒ.
;=========================
; 43. ÂÛÁÎÐÊÀ
ÈÇ ÏÀÌßÒÈ.
;=========================
CXUTKA
MOVLWHOUZ1X;ÏÅÐÂÛÉ
ÀÄÐÅÑ ÇÀÏÈÑÛÂÀÅÌÎÃÎ ÐÅÃÈÑÒÐÀ
MOVWFFSR;Â
ÐÅÃÈÑÒÐ ÊÎÑÂÅÍÍÎÉ ÀÄÐÅÑÀÖÈÈ.
MOVFWCOUE;ÀÄÐÅÑ
ÇÀÏÈÑÈ Â ÐÀÁÎ×ÈÉ ÐÅÃÈÑÒÐ.
BSFSTATUS,5;ÁÀÍÊ
1.
MOVWFEEADR;ÈÇ
ÐÀÁÎ×ÅÃÎ Â ÀÄÐÅÑ ÇÀÏÈÑÈ.
BCFINTCON,7;ÇÀÏÐÅÒ
ÏÐÅÐÛÂÀÍÈÉ.
CALLAKT;ÍÀ
Ñ×ÈÒÛÂÀÍÈÅ.
MOVWFINDF;ÏÅÐÅÏÈØÅÌ
 ÐÅÃÈÑÒÐ.
INCFEEADR,1;ÓÂÅËÈ×ÈÌ
ÀÄÐÅÑ.
INCFFSR,1;ÂÛÁÅÐÅÌ
ÑËÅÄÓÞÙÈÉ ÐÅÃÈÑÒÐ.
BTFSSFSR,7;ÅÑËÈ
ÐÅÃÈÑÒÐ ÍÅ ÏÎÑËÅÄÍÈÉ,
GOTO$-5;ÏÎÂÒÎÐÈÌ
Ñ×ÈÒÛÂÀÍÈÅ.
BCFSTATUS,5;ÁÀÍÊ
0.
BSFINTCON,7;ÐÀÇÐÅØÀÅÌ
ÏÐÅÐÛÂÀÍÈß.
MOVLW.251;ÏÎ
ÓÌÎË×ÀÍÈÞ ÇÍÀÊ ÏËÞÑ.
MOVWFSOT1X;
BTFSSLSBZ1X,7;ÏÎ
7 ÐÀÇÐßÄÓ ÓÑÒÀÍÎÂÈÌ ÇÍÀÊ.
GOTO$+4;
MOVLW.253;ÌÈÍÓÑ.
MOVWFSOT1X;
BCFLSBZ1X,7;ÑÎÒÐÅÌ
ÇÍÀÊ.
MOVLW.251;ÏÎ
ÓÌÎË×ÀÍÈÞ ÇÍÀÊ ÏËÞÑ.
MOVWFSOT1N;
BTFSSLSBZ1N,7;
GOTO$+4;
MOVLW.253;ÌÈÍÓÑ.
MOVWFSOT1N;
BCFLSBZ1N,7;
MOVLW.251;ÏÎ
ÓÌÎË×ÀÍÈÞ ÇÍÀÊ ÏËÞÑ.
MOVWFSOT2X;
BTFSSLSBZ2X,7;
GOTO$+4;
MOVLW.253;ÌÈÍÓÑ.
MOVWFSOT2X;
BCFLSBZ2X,7;
MOVLW.251;ÏÎ
ÓÌÎË×ÀÍÈÞ ÇÍÀÊ ÏËÞÑ.
MOVWFSOT2N;
BTFSSLSBZ2N,7;
GOTO$+4;
MOVLW.253;ÌÈÍÓÑ.
MOVWFSOT2N;
BCFLSBZ2N,7;
BCFFLAG2,5;ÑÁÐÎÑ
ÔËÀÃÀ ÓÑÒÀÍÎÂÊÈ ÌÈÍÓÑ.
RETURN
AKT
BSFEECON1,RD;×ÒÅÍÈÅ.
BTFSCEECON1,RD;
GOTO$-1;
MOVLW.255;ÅÑËÈ
ÏÀÌßÒÜ ÍÅ ÇÀÏÎËÍÅÍÀ,
SUBWFEEDATA,0;ÇÀÏÈØÅÌ
-0.
BTFSCSTATUS,Z;
CLRFEEDATA;ÎÁÍÓËÈÌ,
Ò.Ê. 255 ÍÅÊÎÐÐÅÊÒÍÎ.
MOVFWEEDATA;ÏÅÐÅÏÈØÅÌ
 ÐÀÁÎ×ÈÉ ÐÅÃÈÑÒÐ.
RETURN;ÂÎÇÂÐÀÒ.
;========================================
; 44.
ÐÀÑÏÐÅÄÅËÈÒÅËÜ.
;========================================
MYLTIK
CALLKHOP;ÏÐÎÂÅÐÈÌ
ÊÍÎÏÊÈ.
BTFSSFLAG2,0;ÅÑËÈ
ÈÍÄÈÊÀÖÈß ÒÅÊÓÙÀß,
GOTOCMOTP;ÒÎ
ÏÐÎÏÓÑÊÀÅÌ ÓÑÒÀÍÎÂÊÓ.
CALLJEKIND;ÏÐÎÈÍÄÈÖÈÐÓÅÌ.
BTFSSCEK,0;ÆÄÅÌ
×ÅÒÍÎÉ ÑÅÊÓÍÄÛ.
GOTO$-1;
CALLINIDS1;ÏÐÎÂÅÐÈÌ
ÄÀÒ×ÈÊ.
CALLKHOP;ÏÐÎÂÅÐÈÌ
ÊÍÎÏÊÈ.
BTFSSFLAG2,0;ÅÑËÈ
ÈÍÄÈÊÀÖÈß ÒÅÊÓÙÀß,
GOTOCMOTP;ÒÎ
ÏÐÎÏÓÑÊÀÅÌ ÓÑÒÀÍÎÂÊÓ.
CALLJEKIND;ÏÐÎÈÍÄÈÖÈÐÓÅÌ.
BTFSCCEK,0;ÆÄÅÌ
ÍÅ×ÅÒÍÎÉ ÑÅÊÓÍÄÛ.
GOTO$-1;
CALLINIDS2;ÒÎ
ÏÐÎÂÅÐÈÌ ÂÒÎÐÎÉ ÄÀÒ×ÈÊ.
GOTOMYLTIK;ÂÑÅ
ÑÍÀ×ÀËÀ.
CMOTP
BTFSCFLAG2,0;ÅÑËÈ
ÈÍÄÈÊÀÖÈß ÒÅÊÓÙÀß,
GOTOMYLTIK;ÒÎ
ÈÄÅÌ ÈÇÌÅÐßÒÜ ÒÅÌÏÅÐÀÒÓÐÓ.
BTFSCFLAG2,5;ÏÐÈ
ÓÑÒÀÍÎÂÊÅ ÍÅÒ ÂÛÁÎÐÊÈ ÈÇ ÏÇÓ.
CALLCXUTKA;ÂÛÁÎÐÊÀ
ÈÇ ÏÇÓ.
BTFSCFLAG1,2;ÅÑËÈ
ÇÀÏÐÅÒ ÈÍÄÈÊÀÖÈÈ, ÒÎ ÏÐÎÏÓÑÒÈÌ.
GOTO$+4;
BTFSSFLAG,7;ÊÀÆÄÛÅ
0,5 ÑÅÊ.
GOTO$-1
CALLJEKIND;ÂÛÂÎÄÈÌ
ÍÀ ÈÍÄÈÊÀÖÈÞ.
BTFSCFLAG,7;ÊÀÆÄÛÅ
0,5 ÑÅÊ.
GOTO$-1
CALLKHOP;ÏÐÎÂÅÐÈÌ
ÊÍÎÏÊÈ.
GOTOCMOTP;
;========================================
END
;========================================
|