xxcom
Üye
- Katılım
- 1 Eki 2011
- Mesajlar
- 1
- Puanları
- 1
- Yaş
- 35
HTML:
'****************************************************************
'* Name : ISI ZAMANLAMA.BAS *
'* Author : [Tasarım: SEFER ARAT] *
'* Notice : Bu program haftalık programlı ISI için *
'* : SEFER ARAT tarafınca hazırlanmıştır. *
'* Date : 15.10.2011 *
'* Version : 1.2 *
'* Notes : Kullanılan işlemci Pic16F876 dır. 4MHz Kristal *
'* : kullanılacaktır. *
'****************************************************************
DEFINE OSC 4
@ DEVICE pic16F876
@ DEVICE pic16F876, WDT_ON
@ DEVICE pic16F876, PWRT_ON
@ DEVICE pic16F876, PROTECT_OFF
@ DEVICE pic16F876, XT_OSC
TRISA=%00010111
TRISB=%00000000
TRISC=%00000111
PORTA=0
PORTB=0
PORTC=0
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 2
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 3
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
ADCON1 = 7
ON INTERRUPT GoTo KESME
OPTION_REG=%10000101
INTCON=%10100000
TMR0=0
X VAR WORD
E VAR BYTE
AY var byte
YIL var byte
SN VAR BYTE
DAK VAR BYTE
SAAT VAR BYTE
GUN VAR BYTE
MEM VAR BYTE
ONLAR VAR BYTE
BIRLER VAR BYTE
SAYAC VAR BYTE
HAFTA VAR BYTE
SAYI VAR BYTE
ADR VAR BYTE
SYC VAR BYTE
AYR VAR BYTE
ZYM VAR BYTE
ZMN VAR BYTE
SNY VAR BYTE
SNS VAR BYTE
KDS VAR BYTE
AS var byte
AD var byte
KS VAR BYTE
KD VAR BYTE
KP VAR BIT
RYM VAR BIT
RAM VAR BIT
GRS VAR BIT
POZ VAR BIT
PTESI VAR BIT
SALI VAR BIT
CARS VAR BIT
PERS VAR BIT
CUMA VAR BIT
CTESI VAR BIT
PAZAR VAR BIT
MENU VAR PORTA.0
YUKARI VAR PORTA.1
ASAGI VAR PORTA.2
SET VAR PORTA.4
RTC_RST var PORTC.0
RTC_CLK var PORTC.1
RTC_DTA var PORTC.2
SYMBOL ROLE=PORTA.3
SYMBOL BUZER=PORTA.5
SYMBOL LED=PORTB.1
PAUSE 300
HIGH LED
LCDOUT $FE,$40,0,1,2,18,10,4,0,0 'LCD 0. KARAKTER HAFIZASI ONAY İŞARETİ
LCDOUT $FE,$48,0,17,10,4,10,17,0,0 'LCD 1. KARAKTER HAFIZASI ÇARPI İŞARETİ
LCDOUT $FE,$50,16,8,4,2,4,8,16,0 'LCD 2. KARAKTER HAFIZASI YÖN İŞARETİ
LCDOUT $FE,$58,14,17,16,16,17,14,4,0 'LCD 3. KARAKTER HAFIZASI Ç HARFİ
LCDOUT $FE,$60,4,0,14,4,4,4,14,0 'LCD 4. KARAKTER HAFIZASI İ HARFİ
LCDOUT $FE,$68,10,0,14,17,17,17,14,0 'LCD 5. KARAKTER HAFIZASI Ö HARFİ
LCDOUT $FE,$70,14,0,15,16,19,17,15,0 'LCD 6. KARAKTER HAFIZASI Ğ HARFİ
LCDOUT $FE,$78,10,0,17,17,17,17,14,0 'LCD 7. KARAKTER HAFIZASI Ü HARFİ
LCDOUT $FE,1
GIRIS:
LCDOUT $FE,$81,"OTOMAT",4,"K ",3,4,3,"EK "
LCDOUT $FE,$C4,"ISI"
PAUSE 1500
LCDOUT $FE,1
LCDOUT $FE,$84,"TASARIM"
LCDOUT $FE,$C3,"SEFER ARAT"
PAUSE 1500
LCDOUT $FE,1
ZMN=0:SNY=0:KP=0
GOSUB BIPBIP
BASLANGIC:
READ $0,RYM
READ $1,PTESI
READ $2,SALI
READ $3,CARS
READ $4,PERS
READ $5,CUMA
READ $6,CTESI
READ $7,PAZAR
READ $8,AS:IF AS>23 THEN AS=0
READ $9,AD:IF AD>59 THEN AD=0
READ $10,KS:IF KS>23 THEN KS=0
READ $11,KD:IF KD>59 THEN KD=0
read $12,KP:IF KP>1 THEN KP=0
IF SAAT>23 THEN SAAT=0
IF DAK>59 THEN DAK=0
IF SN>59 THEN SN=0
IF GUN>31 THEN GUN=1
IF AY>12 THEN AY=1
IF YIL>50 THEN YIL=1
IF HAFTA>7 THEN HAFTA=1
GOSUB ZAMAN_OKU:GOSUB ZAMAN_OKU
POZ=0
IF KS<=SAAT and KD<=DAK THEN KP=0:WRITE $12,KP:PAUSE 1
IF AS<=SAAT AND AD<=DAK AND saat<=KS AND DAK<=KD AND KP=1 THEN HIGH ROLE
ROLE=KP
BASLA:
GOSUB EKRANAYAZ
GOSUB ZAMAN_OKU
IF RYM=1 THEN GOSUB ZAMANA_BAK
IF ZMN>100 THEN
ZMN=0:POZ=1:low ROLE
GOSUB BIP:GOTO AYAR_MENUSU
ENDIF
IF MENU=1 OR YUKARI=1 OR ASAGI=1 OR SET=1 THEN
SNS=0:SNY=0
HIGH LED
ENDIF
IF SET=0 THEN ZMN=0
IF SNY>15 THEN LOW LED
IF ROLE<>KP THEN
IF ROLE=1 THEN KP=1
IF ROLE=0 THEN KP=0
WRITE $12,KP
ENDIF
IF KS<=SAAT and KD<=DAK THEN low ROLE
GOTO BASLA
'---------------------------ALT PROGRAMLAR-------------------------------------
EKRANAYAZ:
ADR=$8B:GOSUB GUNE_BAK
ADR=$C3:GOSUB AYABAK
LCDOUT $FE,$80,DEC2 SAAT,":",DEC2 DAK,":",DEC2 SN
LCDOUT $FE,$C0,DEC2 GUN,"/"
LCDOUT $FE,$C6,"/20",DEC2 YIL
IF RYM=1 THEN LCDOUT $FE,$CC,"P.ON"
IF RYM=0 THEN LCDOUT $FE,$CC,"P.OF"
RETURN
AYABAK:
SELECT CASE AY
CASE 1
LCDOUT $FE,ADR,"OCA"
CASE 2
LCDOUT $FE,ADR,"SUB"
CASE 3
LCDOUT $FE,ADR,"MAR"
CASE 4
LCDOUT $FE,ADR,"NiS"
CASE 5
LCDOUT $FE,ADR,"MAY"
CASE 6
LCDOUT $FE,ADR,"HAZ"
CASE 7
LCDOUT $FE,ADR,"TEM"
CASE 8
LCDOUT $FE,ADR,"AGU"
CASE 9
LCDOUT $FE,ADR,"EYL"
CASE 10
LCDOUT $FE,ADR,"EKi"
CASE 11
LCDOUT $FE,ADR,"KAS"
CASE 12
LCDOUT $FE,ADR,"ARA"
END SELECT
RETURN
GUNE_BAK:
select case hafta
case 1
LCDOUT $FE,ADR,"PAZAR"
case 2
LCDOUT $FE,ADR,"PTES",4
case 3
LCDOUT $FE,ADR," SALI"
case 4
LCDOUT $FE,ADR," CARS"
case 5
LCDOUT $FE,ADR," PERS"
case 6
LCDOUT $FE,ADR," CUMA"
case 7
LCDOUT $FE,ADR,"CTES",4
end select
RETURN
ZAMANA_BAK:
IF HAFTA=1 AND PAZAR=1 AND AS=SAAT AND AD=DAK AND SN=0 THEN HIGH ROLE
IF HAFTA=2 AND PTESI=1 AND AS=SAAT AND AD=DAK AND SN=0 THEN HIGH ROLE
IF HAFTA=3 AND SALI=1 AND AS=SAAT AND AD=DAK AND SN=0 THEN HIGH ROLE
IF HAFTA=4 AND CARS=1 AND AS=SAAT AND AD=DAK AND SN=0 THEN HIGH ROLE
IF HAFTA=5 AND PERS=1 AND AS=SAAT AND AD=DAK AND SN=0 THEN HIGH ROLE
IF HAFTA=6 AND CUMA=1 AND AS=SAAT AND AD=DAK AND SN=0 THEN HIGH ROLE
IF HAFTA=7 AND CTESI=1 AND AS=SAAT AND AD=DAK AND SN=0 THEN HIGH ROLE
RETURN
TEMIZLE:
LCDOUT $FE,1
RETURN
BIPBIP:
HIGH buzer
PAUSE 50
LOW buzer
PAUSE 100
HIGH BUZER
PAUSE 50
LOW BUZER
RETURN
BIP:
HIGH BUZER
FOR X=0 TO 1000
NEXT X
LOW BUZER
RETURN
KAYDET:
lcdout $FE,1,"AYARLAR"
LCDOUT $FE,$C0,"KAYDEDILDI..."
GOSUB BIPBIP
PAUSE 800
AYR=0:SNS=0:SNY=0
GOSUB TEMIZLE
GOTO BASLANGIC
AYARLANDI:
lcdout $FE,1,"AYARLANDI..."
GOSUB BIP
PAUSE 1000
AYAR_MENUSU:
WHILE MENU=1:WEND
GOSUB TEMIZLE
HIGH LED
AYR=0
ANA_MENU:
IF YUKARI=1 THEN
AYR=AYR+1
gosub BIP
WHILE YUKARI=1:WEND
IF AYR>3 THEN AYR=0
ENDIF
IF ASAGI=1 THEN
AYR=AYR-1
GOSUB BIP
WHILE ASAGI=1:WEND
IF AYR=255 THEN AYR=3
ENDIF
GOSUB DURUM
GOTO ANA_MENU
DURUM:
SELECT CASE AYR
CASE 0
LCDOUT $FE,$81," ZAMAN AYARI "
IF MENU=1 THEN
WHILE MENU=1:WEND
GOSUB BIP
GOTO SAATAYAR1
ENDIF
CASE 1
LCDOUT $FE,$81,"ISI AYARLARI"
IF MENU=1 THEN
WHILE MENU=1:WEND
GOSUB BIP
GOTO MOTORAYAR
ENDIF
CASE 2
LCDOUT $FE,$81," MANUEL ISI "
IF MENU=1 THEN
WHILE MENU=1:WEND
GOSUB BIP
GOTO MANUEL_KONT
ENDIF
CASE 3
LCDOUT $FE,$81," MENUDEN ",3,"IKIS "
IF MENU=1 THEN
WHILE MENU=1:WEND
LCDOUT $FE,1
GOTO KAYDET
ENDIF
END SELECT
RETURN
MANUEL_KONT
GOSUB TEMIZLE
MANUELKONT:
LCDOUT $FE,$80,"YUKARIYA BASINIZ"
IF YUKARI=1 THEN
LCDOUT $FE,$C0,"ISI ACIK "
HIGH ROLE
ELSE
LCDOUT $FE,$C0,"ISI KAPALI"
LOW ROLE
ENDIF
IF MENU=1 THEN
GOSUB BIP:GOTO AYAR_MENUSU
ENDIF
GOTO MANUELKONT
MOTORAYAR:
GOSUB TEMIZLE
READ $0,RYM
MOTOAYAR:
LCDOUT $FE,$82,"ISI DURUMU"
IF MENU=1 and RYM=1 THEN
WHILE MENU=1:WEND
WRITE $0,RYM
GOSUB BIP:syc=0
GOTO M_ZAMANI
ENDIF
IF MENU=1 AND RYM=0 THEN
WHILE MENU=1:WEND
WRITE $0,RYM
WRITE $12,KP
GOSUB BIP:GOTO AYARLANDI
ENDIF
IF SET=1 THEN
gosub TEMIZLE:GOSUB BIP:GOTO ANA_MENU
ENDIF
IF YUKARI=1 THEN RYM=1
IF ASAGI=1 THEN RYM=0
IF RYM=1 THEN lcdout $FE,$C4," ACIK "
IF RYM=0 THEN LCDOUT $FE,$C4,"KAPALI"
GOTO MOTOAYAR
M_ZAMANI:
GOSUB TEMIZLE
READ $1,PTESI
READ $2,SALI
READ $3,CARS
READ $4,PERS
READ $5,CUMA
READ $6,CTESI
READ $7,PAZAR
M_ZAMAN:
LCDOUT $FE,$81,"ISI G",7,"NLER",4
IF MENU=1 THEN
GOSUB BIP
SYC=SYC+1
WHILE MENU=1:WEND
ENDIF
IF SET=1 THEN
GOSUB BIP
SYC=SYC-1
IF SYC>7 THEN MOTORAYAR
WHILE SET=1:WEND
ENDIF
GOSUB GUNEBAK
IF SYC=7 THEN
SYC=0:KDS=0
WRITE $1,PTESI
WRITE $2,SALI
WRITE $3,CARS
WRITE $4,PERS
WRITE $5,CUMA
WRITE $6,CTESI
WRITE $7,PAZAR
GOTO M_CALISMA
ENDIF
GOTO M_ZAMAN
GUNEBAK:
SELECT CASE SYC
CASE 0
IF YUKARI=1 THEN TOGGLE PTESI
WHILE YUKARI=1:WEND
LCDOUT $FE,$C0,"PAZARTESi=",(1-PTESI)," "
CASE 1
IF YUKARI=1 THEN TOGGLE SALI
WHILE YUKARI=1:WEND
LCDOUT $FE,$C0,"SALI=",(1-SALI)," "
CASE 2
IF YUKARI=1 THEN TOGGLE CARS
WHILE YUKARI=1:WEND
LCDOUT $FE,$C0,"CARSAMBA=",(1-CARS)," "
CASE 3
IF YUKARI=1 THEN TOGGLE PERS
WHILE YUKARI=1:WEND
LCDOUT $FE,$C0,"PERSEMBE=",(1-PERS)," "
CASE 4
IF YUKARI=1 THEN TOGGLE CUMA
WHILE YUKARI=1:WEND
LCDOUT $FE,$C0,"CUMA=",(1-CUMA)," "
CASE 5
IF YUKARI=1 THEN TOGGLE CTESI
WHILE YUKARI=1:WEND
LCDOUT $FE,$C0,"CUMARTESI=",(1-CTESI)," "
CASE 6
IF YUKARI=1 THEN TOGGLE PAZAR
WHILE YUKARI=1:WEND
LCDOUT $FE,$C0,"PAZAR=",(1-PAZAR)," "
END SELECT
RETURN
M_CALISMA:
GOSUB TEMIZLE
READ $8,AS
READ $9,AD
READ $10,KS
READ $11,KD
ACILIS:
lcdout $FE,$82,3,"ALISMA SAATi"
IF MENU=1 THEN
GOSUB BIP
KDS=KDS+1
WHILE MENU=1:WEND
ENDIF
IF SET=1 THEN
GOSUB BIP
KDS=KDS-1
WHILE SET=1:WEND
ENDIF
IF KDS>4 THEN
SYC=6
GOTO M_ZAMANI
ENDIF
GOSUB BAK3
IF AS=255 THEN AS=23
IF AS=24 THEN AS=0
IF AD=255 THEN AD=59
IF AD=60 THEN AD=0
IF KDS>1 THEN
GOSUB TEMIZLE
GOTO KAPANIS
ENDIF
GOTO ACILIS
KAPANIS:
LCDOUT $FE,$82,"KAPANIS SAATi"
IF MENU=1 THEN
GOSUB BIP
KDS=KDS+1
WHILE MENU=1:WEND
ENDIF
IF SET=1 THEN
gosub BIP
KDS=KDS-1
WHILE SET=1:WEND
ENDIF
IF KDS<2 THEN
KDS=1
GOTO ACILIS
ENDIF
GOSUB BAK4
IF KS=255 THEN KS=23
IF KS=24 THEN KS=0
IF KD=255 THEN KD=59
IF KD=60 THEN KD=0
IF KDS>3 THEN
KDS=0
WRITE $8,AS
WRITE $9,AD
WRITE $10,KS
WRITE $11,KD
GOTO AYARLANDI
ENDIF
GOTO KAPANIS
SAATAYAR1:
GOSUB ZAMAN_OKU
GOSUB TEMIZLE
ZYM=0
SAATAYAR:
lcdout $FE,$83,"SAAT AYARI"
LCDOUT $FE,$C5,DEC2 SAAT,":",dec2 DAK,":",dec2 SN
IF MENU=1 THEN
ZYM=ZYM+1:GOSUB BIP
WHILE MENU=1:WEND
ENDIF
IF SET=1 THEN
ZYM=ZYM-1:GOSUB BIP
IF ZYM>0 THEN GOSUB BIP
IF ZYM>2 THEN
GOSUB TEMIZLE:GOTO ANA_MENU
ENDIF
WHILE SET=1:WEND
ENDIF
IF ZYM>5 THEN ZYM=0
GOSUB BAK1
IF ZYM=2 THEN
GOSUB TEMIZLE
GOTO TARIHAYAR
ENDIF
GOTO SAATAYAR
TARIHAYAR:
ADR=$C7:GOSUB AYABAK
lcdout $FE,$83,"TARIH AYARI"
LCDOUT $FE,$C4,DEC2 GUN,"/"
LCDOUT $FE,$CA,"/20",DEC2 YIL
IF MENU=1 THEN
ZYM=ZYM+1
GOSUB BIP
WHILE MENU=1:WEND
ENDIF
IF GUN>31 THEN GUN=1
IF GUN<1 THEN GUN=31
IF AY>12 THEN AY=1
IF AY<1 THEN AY=12
IF YIL>50 THEN YIL=0
IF SET=1 THEN
ZYM=ZYM-1
GOSUB BIP
WHILE SET=1:WEND
ENDIF
IF ZYM<2 THEN
LCDOUT $FE,1
ZYM=1:GOTO SAATAYAR
ENDIF
GOSUB BAK2
IF ZYM=5 THEN GOTO GUN_AYARI
GOTO TARIHAYAR
GUN_AYARI:
GOSUB TEMIZLE
GUNAYARI:
LCDOUT $FE,$84,"G",7,"N AYARI"
IF YUKARI=1 THEN
WHILE YUKARI=1:WEND
HAFTA=HAFTA+1
IF HAFTA>7 THEN HAFTA=1
ENDIF
IF SET=1 THEN
GOSUB BIP
WHILE SET=1:WEND
ZYM=4:GOTO TARIHAYAR
ENDIF
IF ASAGI=1 THEN
WHILE ASAGI=1:WEND
HAFTA=HAFTA-1
IF HAFTA=0 THEN HAFTA=7
ENDIF
IF HAFTA>7 THEN HAFTA=0
ADR=$C1:GOSUB GUNE_BAK
IF MENU=1 THEN
WHILE MENU=1:WEND
gosub ZAMAN_YAZ
goto AYARLANDI
ENDIF
GOTO GUNAYARI
BAK1:
SELECT CASE ZYM
CASE 0
LCDOUT $FE,$C0,"SAAT"
IF YUKARI=1 THEN SAAT=SAAT+1
WHILE YUKARI=1:WEND
IF ASAGI=1 THEN SAAT=SAAT-1
WHILE ASAGI=1:WEND
IF SAAT>23 THEN SAAT=0
CASE 1
LCDOUT $FE,$C0,"DAK "
IF YUKARI=1 THEN DAK=DAK+1
WHILE YUKARI=1:WEND
IF ASAGI=1 THEN DAK=DAK-1
WHILE ASAGI=1:WEND
IF DAK>59 THEN DAK=0
END SELECT
RETURN
BAK2:
SELECT CASE ZYM
CASE 2
LCDOUT $FE,$C0,"GUN "
IF YUKARI=1 THEN GUN=GUN+1
WHILE YUKARI=1:WEND
IF ASAGI=1 THEN GUN=GUN-1
WHILE ASAGI=1:WEND
CASE 3
LCDOUT $FE,$C0,"AY "
IF YUKARI=1 THEN AY=AY+1
WHILE YUKARI=1:WEND
IF ASAGI=1 THEN AY=AY-1
WHILE ASAGI=1:WEND
CASE 4
LCDOUT $FE,$C0,"YIL "
IF YUKARI=1 THEN YIL=YIL+1
WHILE YUKARI=1:WEND
IF ASAGI=1 THEN YIL=YIL-1
WHILE ASAGI=1:WEND
END SELECT
RETURN
BAK3:
SELECT CASE KDS
CASE 0
LCDOUT $FE,$C5,2,DEC2 AS,":",DEC2 AD
IF YUKARI=1 THEN
AS=AS+1
WHILE YUKARI=1:WEND
ENDIF
IF ASAGI=1 THEN
AS=AS-1
WHILE ASAGI=1:WEND
ENDIF
CASE 1
LCDOUT $FE,$C5,DEC2 AS,":",2,DEC2 AD
IF YUKARI=1 THEN
AD=AD+1
WHILE YUKARI=1:WEND
ENDIF
IF ASAGI=1 THEN
AD=AD-1
WHILE ASAGI=1:WEND
ENDIF
END SELECT
RETURN
BAK4:
SELECT CASE KDS
CASE 2
LCDOUT $FE,$C5,2,DEC2 KS,":",DEC2 KD
IF YUKARI=1 THEN
KS=KS+1
WHILE YUKARI=1:WEND
ENDIF
IF ASAGI=1 THEN
KS=KS-1
WHILE ASAGI=1:WEND
ENDIF
CASE 3
LCDOUT $FE,$C5,DEC2 KS,":",2,DEC2 KD
IF YUKARI=1 THEN
KD=KD+1
WHILE YUKARI=1:WEND
ENDIF
IF ASAGI=1 THEN
KD=KD-1
WHILE ASAGI=1:WEND
ENDIF
END SELECT
RETURN
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
ZAMAN_OKU:
high RTC_RST:OUTPUT RTC_DTA
shiftout RTC_DTA, RTC_CLK, 0, [$BF]:INPUT RTC_DTA
SHIFTIN RTC_DTA, RTC_CLK, 1, [SN, DAK, SAAT,GUN , AY, HAFTA, YIL, MEM] 'OKU
MEM=SN:GOSUB CEVIR:SN=SAYI
MEM=DAK:GOSUB CEVIR:DAK=SAYI
MEM=SAAT:GOSUB CEVIR:SAAT=SAYI
MEM=GUN:GOSUB CEVIR:GUN=SAYI
MEM=AY:GOSUB CEVIR:AY=SAYI
MEM=YIL:GOSUB CEVIR:YIL=SAYI
MEM=HAFTA:GOSUB CEVIR:HAFTA=SAYI
low RTC_RST
return
ZAMAN_YAZ:
MEM=sn:gosub TERSCEVIR:sn=SAYI
MEM=DAK:gosub TERSCEVIR:DAK=SAYI
MEM=SAAT:gosub TERSCEVIR:SAAT=SAYI
MEM=GUN:gosub TERSCEVIR:GUN=SAYI
MEM=AY:gosub TERSCEVIR:AY=SAYI
MEM=YIL:gosub TERSCEVIR:YIL=SAYI
MEM=HAFTA:GOSUB TERSCEVIR:HAFTA=SAYI
high RTC_RST
SHIFTOUT RTC_DTA, RTC_CLK, 0, [$8E, 0] 'WRT Protek açıldı
low RTC_RST:PAUSEUS 10
high RTC_RST
SHIFTOUT RTC_DTA, RTC_CLK, 0, [$BE, SN, DAK, SAAT,GUN , AY, HAFTA, YIL, 128] 'YAZ
low RTC_RST
PAUSEUS 10
return
CEVIR:
ONLAR=MEM & %01110000
ONLAR=ONLAR>>4
BIRLER=MEM & %00001111
SAYI=ONLAR*10+BIRLER
return
TERSCEVIR:
ONLAR=MEM DIG 1
ONLAR=ONLAR<<4
BIRLER=MEM DIG 0
SAYI=ONLAR+BIRLER
return
DISABLE
KESME:
IF POZ=1 THEN ATLA
IF SET=1 THEN
ZMN=ZMN+1
IF ZMN=200 THEN ZMN=0
ENDIF
SNS=SNS+1
IF SNS=55 THEN
SNS=0
SNY=SNY+1
IF SNY>16 THEN SNY=0
ENDIF
ATLA:
INTCON.2=0
RESUME
ENABLE
END