gosub git128
git128:
'......
return
DEVICE 16F877
XTAL=4
ALL_DIGITAL=TRUE 'tüm çikislar djital acik
PORTB_PULLUPS=FALSE 'portb deki pull up kapali
'LCD TANITMA BOLÜMÜ.....................................................................................
DEFINE LCD_DREG PORTB 'LCD data bacaklari hangi porta bagli? portb
DEFINE LCD_DBIT PORTB.4 'LCD data bacaklari hangi bitten basliyor? portb.4 den itibaren
DECLARE LCD_ENPIN PORTB.1 'LCD "E" pin portb nin hangi bitine baglidir.
DECLARE LCD_RSPIN PORTB.0 'LCD "RS" pin portb nin hangi bitine baglidir.
DEFINE LCD_BITS 4 'LCD 4 bit olarak bağlı
TRISA=%00000000
TRISB=%00000000
TRISC=%00000000
TRISD=%00001110
portd=0
portc=0
'Y:SATIR_Atay
'D:dikey
Symbol SATIR_A= PORTD.4
Symbol SATIR_B= PORTD.5
Symbol SATIR_C= PORTD.6
Symbol SATIR_D= PORTD.7
Symbol SUTUN_1= PORTD.1
Symbol SUTUN_2= PORTD.2
Symbol SUTUN_3= PORTD.3
delayms 750 'lcd açilmasi için
dim sayi1 as byte
dim sayi2 as byte
dim sayi3 as byte
dim tsayi as byte
tus var word
dim sutun as byte
dim satir as byte
satir=1 '//ilk sayının ilk karakter olacağını belirler
sutun=1
print at 1,1,"PERIYODIK CETVEL UYGULAMASI"
print at 2,1,"8-A SINIFI"
print at 3,1,"HAZIRLAYAN:CEREN ACAR"
print at 4,1,"<<OGRETMEN:................ >>"
delayms 2000 : print $fe,1
tus="*"
BASLA:
tus="x" '//burda tus degerine x atıyoruzki döngü boş dönmeye devam etsin
gosub tus_oku
gosub goster
goto BASLA
'---------------------------------------------------------------------------
tus_oku:
high SATIR_A
high SATIR_B
high SATIR_C
high SATIR_D
low SATIR_A
if SATIR_A=0 and SUTUN_1=0 then tus=1
if SATIR_A=0 and SUTUN_2=0 then tus=2
if SATIR_A=0 and SUTUN_3=0 then tus=3
high SATIR_A
low SATIR_B
if SATIR_B=0 and SUTUN_1=0 then tus=4
if SATIR_B=0 and SUTUN_2=0 then tus=5
if SATIR_B=0 and SUTUN_3=0 then tus=6
high SATIR_B
low SATIR_C
if SATIR_C=0 and SUTUN_1=0 then tus=7
if SATIR_C=0 and SUTUN_2=0 then tus=8
if SATIR_C=0 and SUTUN_3=0 then tus=9
high SATIR_C
low SATIR_D
if SATIR_D=0 and SUTUN_1=0 then tus="*"
if SATIR_D=0 and SUTUN_2=0 then tus=0
if SATIR_D=0 and SUTUN_3=0 then tus="#"
high SATIR_D
return
goster:
if tus="#" then gosub sonuc endif
if tus="*" then gosub sil endif
if tus="x" or tus="a" or tus="b" or tus="c" or tus="d" then
return
endif
if sutun=0 then sutun=1
if sutun>3 then sutun=1
Print At satir,sutun, DEC1 tus
sutun=sutun+1
if sutun=1 then sayi1=tus
if sutun=2 then sayi2=tus
if sutun=3 then sayi3=tus
delayms 150
return
'goster2:
'tus="x"
'print at 1,1,"* veya # basildi"
'delayms 500 : print $fe,1 'bekle ekranı temizle
'sutun=0
'return
sil:
tus="x"
delayms 500 : print $fe,1 'bekle ekranı temizle
sutun=0
return
sonuc:
tus="x"
print $fe,1
print at 1,1,"sayi girildi"
print at 2,1, sayi1
print at 3,1, sayi2
'tsayi=sayi1+sayi2+sayi3
'if sayi1=6 then
'print at 1,1,"sayi girildi"
'endif
return
Device=16F877
XTAL 4
Dim sutun As word
Dim KOD As Byte
Dim VAR1 As Byte
Dim DUR As 200
Declare LCD_DTPIN PORTC.4 'DATA girişi PORTC'nin 4. ucundan başlayacak
Declare LCD_ENPIN PORTC.3
Declare LCD_RSPIN PORTC.2
Declare LCD_INTERFACE 4
Declare LCD_LINES 4 'LCD 4 satırdan oluşuyor
Declare KEYPAD_PORT PORTB 'KEYPAD'in bağlandığı port
PORTB_PULLUPS = 1 'PORTB'nin pull-upları aktif
REMINDERS = OFF
ALL_DIGITAL = True 'bütün çıkışlar dijital
'____________________________________________________________________________________________
BASLA:
Print At 1,1, " KOD GIRINIZ: "
DelayMS 100
sutun=1
'_________________________________________________________________________________________
KODGIR:
PORTD=0 'portd'yi sıfırla
PORTE=0 'porte'yi sıfırla
KOD=0 'kod'u sıfırla
VAR1 = InKey 'VAR1 değişkenini Inkey'e at
If VAR1=16 Then GoTo KODGIR 'Keypad'de herhangi bir tuşa basılmadığı zaman 0'a basılmış gibi algılıyor ve bu VAR1'de 16'ya karşılık geliyor.VAR1=16 olursa işlem yapmadan KODGIR'e gönderilir.
KOD = LookUp VAR1,[1,2,3,255,4,5,6,255,7,8,9,255,10,0,11] 'keypad'de basılan numarayı kod değişkenine at
Print At 2,1,@ KOD 'KOD'u decimal olarak ekranda göster
If KOD = 0 Or KOD > 9 Then GoTo KODGIR 'eğer 0'a ya da 9'dan büyük bir
DelayMS 100 'sayıya basılmışsa(* ya da # gibi) KODGIR etiketine git
goto KODGIR
'.................................................................................................
If KOD=1 Then 'KOD=1 ise RD7'deki ledi yak
High PORTD.7
DelayMS DUR
ElseIf KOD=2 Then 'KOD=2 ise RD6'daki ledi yaki
High PORTD.6
DelayMS DUR
ElseIf KOD=3 Then
High PORTD.5
DelayMS DUR
ElseIf KOD=4 Then
High PORTD.4
DelayMS DUR
ElseIf KOD=5 Then
High PORTD.3
DelayMS DUR
ElseIf KOD=6 Then
High PORTD.2
DelayMS DUR
ElseIf KOD=7 Then
High PORTD.1
DelayMS DUR
ElseIf KOD=8 Then
High PORTD.0
DelayMS DUR
ElseIf KOD=9 Then
High PORTE.2
DelayMS DUR
EndIf
GoTo KODGIR
End
Device=16F877
XTAL 4
Dim sutun As word
Dim s1 As word
Dim s2 As word
Dim s3 As word
Dim sayi As word
Dim KOD As Byte
Dim VAR1 As Byte
Dim DUR As 200
Declare LCD_DTPIN PORTC.4 'DATA girişi PORTC'nin 4. ucundan başlayacak
Declare LCD_ENPIN PORTC.3
Declare LCD_RSPIN PORTC.2
Declare LCD_INTERFACE 4
Declare LCD_LINES 4 'LCD 4 satırdan oluşuyor
Declare KEYPAD_PORT PORTB 'KEYPAD'in bağlandığı port
PORTB_PULLUPS = 1 'PORTB'nin pull-upları aktif
REMINDERS = OFF
ALL_DIGITAL = True 'bütün çıkışlar dijital
'____________________________________________________________________________________________
BASLA:
Print At 1,1, " KOD GIRINIZ: "
DelayMS 100
sutun=1
s1="x"
s2="x"
s3="x"
'_________________________________________________________________________________________
KODGIR:
PORTD=0 'portd'yi sıfırla
PORTE=0 'porte'yi sıfırla
KOD=0 'kod'u sıfırla
VAR1 = InKey 'VAR1 değişkenini Inkey'e at
If VAR1=16 Then GoTo KODGIR 'Keypad'de herhangi bir tuşa basılmadığı zaman 0'a basılmış gibi algılıyor ve bu VAR1'de 16'ya karşılık geliyor.VAR1=16 olursa işlem yapmadan KODGIR'e gönderilir.
KOD = LookUp VAR1,[1,2,3,255,4,5,6,255,7,8,9,255,10,0,11] 'keypad'de basılan numarayı kod değişkenine at
sutun=sutun+1
Print At 2,sutun,@ KOD 'KOD'u decimal olarak ekranda göster
if sutun=2 Then s1=KOD
if sutun=3 Then s2=KOD
if sutun=4 Then s3=KOD
if s1=1 and s2="x" and s3="x" then sayi=1
if s1=2 and s2="x" and s3="x" then sayi=2
if s1=3 and s2="x" and s3="x" then sayi=3
if s1=4 and s2="x" and s3="x" then sayi=4
if s1=5 and s2="x" and s3="x" then sayi=5
if s1=6 and s2="x" and s3="x" then sayi=6
if s1=7 and s2="x" and s3="x" then sayi=7
if s1=8 and s2="x" and s3="x" then sayi=8
if s1=9 and s2="x" and s3="x" then sayi=9
if s1=1 and s2=0 and s3="x" then sayi=10
if s1=1 and s2=1 and s3="x" then sayi=11
if s1=1 and s2=2 and s3="x" then sayi=12
if s1=1 and s2=3 and s3="x" then sayi=13
'............
if s1=1 and s2=0 and s3=0 then sayi=100
if s1=1 and s2=0 and s3=1 then sayi=101
If KOD = 11 Then GoTo degerlendir
DelayMS 200
goto KODGIR
'.......................................................................................
degerlendir:
cls
if sayi=1 Then GoTo git1
if sayi=2 Then GoTo git2
if sayi=3 Then GoTo git3
if sayi=4 Then GoTo git4
if sayi=5 Then GoTo git5
if sayi=6 Then GoTo git6
if sayi=7 Then GoTo git7
if sayi=8 Then GoTo git8
if sayi=9 Then GoTo git9
if sayi=10 Then GoTo git10
if sayi=11 Then GoTo git11
if sayi=12 Then GoTo git12
if sayi=13 Then GoTo git13
'...............
if sayi=100 Then GoTo git100
if sayi=101 Then GoTo git101
GoTo KODGIR
'.................................................................................................
git1:
Print At 1,1,"girdiginiz sayi:1"
DelayMS 200
GoTo KODGIR
git2:
Print At 1,1,"girdiginiz sayi:2"
DelayMS 200
GoTo KODGIR
git3:
Print At 1,1,"girdiginiz sayi:3"
DelayMS 200
GoTo KODGIR
git4:
Print At 1,1,"girdiginiz sayi:4"
DelayMS 200
GoTo KODGIR
git5:
Print At 1,1,"girdiginiz sayi:5"
DelayMS 200
GoTo KODGIR
git6:
Print At 1,1,"girdiginiz sayi:6"
DelayMS 200
GoTo KODGIR
git7:
Print At 1,1,"girdiginiz sayi:7"
DelayMS 200
GoTo KODGIR
git8:
Print At 1,1,"girdiginiz sayi:8"
DelayMS 200
GoTo KODGIR
git9:
Print At 1,1,"girdiginiz sayi:9"
DelayMS 200
GoTo KODGIR
git10:
Print At 1,1,"girdiginiz sayi:10"
DelayMS 200
GoTo KODGIR
git11:
Print At 1,1,"girdiginiz sayi:11"
DelayMS 200
GoTo KODGIR
git12:
Print At 1,1,"girdiginiz sayi:12"
DelayMS 200
GoTo KODGIR
git13:
Print At 1,1,"girdiginiz sayi:13"
DelayMS 200
GoTo KODGIR
'..............
git100:
Print At 1,1,"girdiginiz sayi:100"
DelayMS 200
GoTo KODGIR
git101:
Print At 1,1,"girdiginiz sayi:101"
DelayMS 200
GoTo KODGIR
End
'****************************************************************
'* Name : KEYPAD3X4.BAS *
'* Author : [ERGUNBT ] *
'* Notice : Copyright (c) 2016 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 22.12.2016 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
Device = 16F876A
XTAL = 4
LCD_DTPIN = PORTC.4
LCD_RSPIN = PORTC.2
LCD_ENPIN = PORTC.3
LCD_INTERFACE = 4 ' 4-bit Interface
LCD_LINES = 2
LCD_TYPE = 0
LCD_COMMANDUS = 2000
LCD_DATAUS = 5
ADCON1 = 7
TRISA=%110000
TRISB=%00000000
TRISC=%00000001
Dim TEMP As Byte
Dim TEMP2 As Word
Dim ISLEM As Byte
Dim DEGER As Byte
Dim DEGER1 As Word
Dim DEGER2 As Word
Dim YENI As Bit
Dim IKINCI As Bit
Dim MYARRAY[10] As Byte '*** 10-BYTE'LIK BIR DIZIN OLUŞTURUR. ***
Symbol YATAY_A= PORTA.0
Symbol YATAY_B= PORTA.1
Symbol YATAY_C= PORTA.2
Symbol YATAY_D= PORTA.3
Symbol DIKEY_1= PORTA.4
Symbol DIKEY_2= PORTA.5
Symbol DIKEY_3= PORTC.0
Print At 1, 1, " ERGUNBT "
Print At 2, 1, " 25/01/2017 "
DelayMS 1500
Clear '*** TÜM DEGISKENLERI SIFIRLADIK
DEGER = 77 '*** TUS TAKIMDA OLMAYAN BIR DEGER
Print $FE,1
Str MYARRAY = "GIRIS= " ' *** DIZININ ILK 7 BYTE'INI YUKLER
Print Str MYARRAY \7 ' *** 7 BYTE'LIK DIZINI LCD YE AKTARIR
DelayMS 50
;***********************************************************
ANA: 'YAZILAN PROGRAMIN OMURGASI
;************************************************************
Call TARA
Call GOSTER
Call DEGERLENDIR
GoTo ANA
;*********************************************************************
GOSTER: 'GIRILEN DEGERI LCD DE GOSTERIR
;*********************************************************************
If DEGER < 10 And YENI = 0 Then Print #DEGER
TEMP=DEGER 'BASILAN TUSU (DEGERI) KAYBETMEMEK IÇIN
;*********************************************************************
GERIBAS: 'TUS TAKIMINDAN ELIN ÇEKILMESINI KONTROL EDIYOR
;*********************************************************************
GoSub TARA
If DEGER! = 77 Then GERIBAS
DelayMS 50 ' *** GECIKME SURESI
Return
;*********************************************************************
DEGERLENDIR:
;*********************************************************************
If TEMP < 10 And IKINCI = 0 Then Call SAYIYAP
If TEMP > 9 Then GoSub ISLEMYAP
Return
;*********************************************************************
SAYIYAP: 'GİRİLEN DEGERİ ONLUK SAYI DUZENINDE YAZAR
;*********************************************************************
DEGER1 = TEMP
DEGER2 = DEGER2*10 + DEGER1 '*** SAYIYI ONDALIK DÜZENDE YAZAR
If DEGER2>255 Then '*** GIRILEN SAYIYA SINIR KOYAR
Clear
Print At 1 ,1, " GIRILEN DEGER "
Print At 2, 1, " 0-255 DEGIL "
DelayMS 1000
Print At 1, 1, "LCD TEMIZLENDI "
Print At 2 , 1,"YENI NO GIRINIZ "
DelayMS 1000
Print 254, 1
Str MYARRAY = "GIRIS= "
Print Str MYARRAY \7
EndIf
Return
;*********************************************************************
ISLEMYAP:
;*********************************************************************
If TEMP = 11 Then ''#' E BASINCA BINARY CIKISI PORTA GONDERIR
Print At 1 , 1 ,"GIRIS= ", #DEGER2
DelayMS 50
Print At 2 , 1 ,"CIKIS= ", BIN8 DEGER2
PORTB = DEGER2
YENI=1
EndIf
If TEMP = 10 Then '( * ) TUŞUNA BASILIRSA EKRANI TEMIZLER
Clear
Print At 1, 1, "LCD TEMIZLENDI "
Print At 2 , 1,"YENI NO GIRINIZ "
DelayMS 1000
Print 254, 1
Str MYARRAY = "GIRIS= "
Print Str MYARRAY \7
EndIf
Return
;*********************************************************************
TARA: 'TUS TAKIMINI TARAR
;*********************************************************************
DEGER = 77
YATAY_A=1 :YATAY_B=0 : YATAY_C=0 : YATAY_D=0
If DIKEY_1=1 Then DEGER=1
If DIKEY_2=1 Then DEGER=2
If DIKEY_3=1 Then DEGER=3
YATAY_A=0 : YATAY_B=1 : YATAY_C=0 : YATAY_D=0
If DIKEY_1=1 Then DEGER=4
If DIKEY_2=1 Then DEGER=5
If DIKEY_3=1 Then DEGER=6
YATAY_A=0 : YATAY_B=0 : YATAY_C=1 : YATAY_D=0
If DIKEY_1=1 Then DEGER=7
If DIKEY_2=1 Then DEGER=8
If DIKEY_3=1 Then DEGER=9
YATAY_A=0 : YATAY_B=0 : YATAY_C=0 : YATAY_D=1
If DIKEY_1=1 Then DEGER=10
If DIKEY_2=1 Then DEGER=0
If DIKEY_3=1 Then DEGER=11
Return
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?