Site içi Arama

Ara

16F628A LCD ve ASM ile buton kontrollü gösterge devresi

Mehmet Yılmaz - 03.04.2017

Devre programlandığı şekliyle, açılışta "m" harfini gösteriyor. Azalt butonuna basınca harfleri geriye doğru, artır butonuna basınca ileri doğru sayıyor. Merkez butonuna basınva "M" harfini gösteriyor.

Devre 5 volt ile beslenmelidir.

Devre şeması:

Devreye ait malzeme listesi:

U1: PIC16F628A
Y1: 4Mhz kristal
DS1: 2x16 Lcd gösterge
C1: 100nF
C2-C3: 22pF
RV1: 10k ayarlı direnç
R1-R4: 10k
R5-R6: 470R
D1-D2: Kırmızı led

Devranin çalışma resmi:

Devrenin çalışma vidyosu:

Devreya ait ASM kaynak kodları:

; ********* *********************************** *********
; 16F628A LCD ve ASM ile buton kontrollü gösterge devresi
; MPASM derleyicisi kullanınız
; Tarih: 03.04.2017 19:19:35
; http://teknomerkez.com/index.php?git=1662
; *******************************************************
        TITLE "Lcd buton"
        LIST p=16F628A
        #INCLUDE <p16f628a.inc>
        __CONFIG _XT_OSC & _WDT_OFF & _PWRTE_OFF & _MCLRE_ON & _BODEN_OFF & _LVP_OFF & _CPD_OFF & _CP_OFF

        CBLOCK  0x20    ;Değişkenler Tanımlanıyor
        TRLCD01
        TRLCD02
        TRLCD100MA
        TRLCD100MB
        TRLCD100MC
        TRLCD200UA
        TRLCD2MA
        TRLCD2MB
        TRLCD2MC
        TR500MA
        TR500MB
        TR500MC
        TR500MSEKA
        TR500MSEKB
        TR500MSEKC
        TR2SNA
        TR2SNB
        TR2SNC
        TR2SND
        YOL
        ENDC

        ORG     0x00
        GOTO    BASLA

BASLA           ;Başlangıç noktası
        CLRF    PORTA
        CLRF    PORTB
        BANKSEL TRISA
        MOVLW   b'11111100'
        MOVWF   TRISA
        MOVLW   b'00000000'
        MOVWF   TRISB
        BANKSEL CMCON
        MOVLW   0x07
        MOVWF   CMCON
        MOVLW   0x67
        MOVWF   OPTION_REG
        BCF     3,5
        CALL    TRLCDTANIMLA
        GOTO    GIRIS

GIRIS           ;Başlangıçta işlemler burada
        MOVLW   'm'
        MOVWF   YOL
        CALL    TRLCDTEMIZLE
        ;--- Lcd 1,1 "Teknomerkez" yaz ---
        MOVLW   d'128'
        CALL    TRLCDYAP
        CALL    TRLCD200US
        MOVLW   'T'
        CALL    TRLCDYAZ
        MOVLW   'e'
        CALL    TRLCDYAZ
        MOVLW   'k'
        CALL    TRLCDYAZ
        MOVLW   'n'
        CALL    TRLCDYAZ
        MOVLW   'o'
        CALL    TRLCDYAZ
        MOVLW   'm'
        CALL    TRLCDYAZ
        MOVLW   'e'
        CALL    TRLCDYAZ
        MOVLW   'r'
        CALL    TRLCDYAZ
        MOVLW   'k'
        CALL    TRLCDYAZ
        MOVLW   'e'
        CALL    TRLCDYAZ
        MOVLW   'z'
        CALL    TRLCDYAZ
        ;--- Lcd 2,1 "Teknik Bilgiler" yaz ---
        MOVLW   d'192'
        CALL    TRLCDYAP
        CALL    TRLCD200US
        MOVLW   'T'
        CALL    TRLCDYAZ
        MOVLW   'e'
        CALL    TRLCDYAZ
        MOVLW   'k'
        CALL    TRLCDYAZ
        MOVLW   'n'
        CALL    TRLCDYAZ
        MOVLW   'i'
        CALL    TRLCDYAZ
        MOVLW   'k'
        CALL    TRLCDYAZ
        MOVLW   ' '
        CALL    TRLCDYAZ
        MOVLW   'B'
        CALL    TRLCDYAZ
        MOVLW   'i'
        CALL    TRLCDYAZ
        MOVLW   'l'
        CALL    TRLCDYAZ
        MOVLW   'g'
        CALL    TRLCDYAZ
        MOVLW   'i'
        CALL    TRLCDYAZ
        MOVLW   'l'
        CALL    TRLCDYAZ
        MOVLW   'e'
        CALL    TRLCDYAZ
        MOVLW   'r'
        CALL    TRLCDYAZ
        BSF     PORTB,0
        BSF     PORTB,3
        CALL    TR2SN   
        CALL    TRLCDTEMIZLE
        ;--- Lcd 1,1 "Bir buton sec" yaz ---
        MOVLW   d'128'
        CALL    TRLCDYAP
        CALL    TRLCD200US
        MOVLW   'B'
        CALL    TRLCDYAZ
        MOVLW   'i'
        CALL    TRLCDYAZ
        MOVLW   'r'
        CALL    TRLCDYAZ
        MOVLW   ' '
        CALL    TRLCDYAZ
        MOVLW   'b'
        CALL    TRLCDYAZ
        MOVLW   'u'
        CALL    TRLCDYAZ
        MOVLW   't'
        CALL    TRLCDYAZ
        MOVLW   'o'
        CALL    TRLCDYAZ
        MOVLW   'n'
        CALL    TRLCDYAZ
        MOVLW   ' '
        CALL    TRLCDYAZ
        MOVLW   's'
        CALL    TRLCDYAZ
        MOVLW   'e'
        CALL    TRLCDYAZ
        MOVLW   'c'
        CALL    TRLCDYAZ
        ;--- Lcd 2,1 "<Azal> <M> <Art>" yaz ---
        MOVLW   d'192'
        CALL    TRLCDYAP
        CALL    TRLCD200US
        MOVLW   '<'
        CALL    TRLCDYAZ
        MOVLW   'A'
        CALL    TRLCDYAZ
        MOVLW   'z'
        CALL    TRLCDYAZ
        MOVLW   'a'
        CALL    TRLCDYAZ
        MOVLW   'l'
        CALL    TRLCDYAZ
        MOVLW   '>'
        CALL    TRLCDYAZ
        MOVLW   ' '
        CALL    TRLCDYAZ
        MOVLW   '<'
        CALL    TRLCDYAZ
        MOVLW   'M'
        CALL    TRLCDYAZ
        MOVLW   '>'
        CALL    TRLCDYAZ
        MOVLW   ' '
        CALL    TRLCDYAZ
        MOVLW   '<'
        CALL    TRLCDYAZ
        MOVLW   'A'
        CALL    TRLCDYAZ
        MOVLW   'r'
        CALL    TRLCDYAZ
        MOVLW   't'
        CALL    TRLCDYAZ
        MOVLW   '>'
        CALL    TRLCDYAZ
        BSF     PORTB,0
        BSF     PORTB,3

GOREVLER        ;Yapılacak işlemler burada
        BTFSS   PORTA,3
        GOTO    TR_ISE0
        MOVLW   'M'
        MOVWF   YOL
        CALL    TRLCDTEMIZLE
        ;--- Lcd 1,1 "Merkez Butonu" yaz ---
        MOVLW   d'128'
        CALL    TRLCDYAP
        CALL    TRLCD200US
        MOVLW   'M'
        CALL    TRLCDYAZ
        MOVLW   'e'
        CALL    TRLCDYAZ
        MOVLW   'r'
        CALL    TRLCDYAZ
        MOVLW   'k'
        CALL    TRLCDYAZ
        MOVLW   'e'
        CALL    TRLCDYAZ
        MOVLW   'z'
        CALL    TRLCDYAZ
        MOVLW   ' '
        CALL    TRLCDYAZ
        MOVLW   'B'
        CALL    TRLCDYAZ
        MOVLW   'u'
        CALL    TRLCDYAZ
        MOVLW   't'
        CALL    TRLCDYAZ
        MOVLW   'o'
        CALL    TRLCDYAZ
        MOVLW   'n'
        CALL    TRLCDYAZ
        MOVLW   'u'
        CALL    TRLCDYAZ
        ;--- Lcd 2,1 YOL yaz ---
        MOVLW   d'192'
        CALL    TRLCDYAP
        CALL    TRLCD200US
        MOVF    YOL,W
        CALL    TRLCDYAZ
        BCF     PORTB,0
        BCF     PORTB,3
TR_ISE0
        BTFSS   PORTA,4
        GOTO    TR_ISE1
        INCF    YOL,F
        CALL    TRLCDTEMIZLE
        ;--- Lcd 1,1 "Artma Butonu" yaz ---
        MOVLW   d'128'
        CALL    TRLCDYAP
        CALL    TRLCD200US
        MOVLW   'A'
        CALL    TRLCDYAZ
        MOVLW   'r'
        CALL    TRLCDYAZ
        MOVLW   't'
        CALL    TRLCDYAZ
        MOVLW   'm'
        CALL    TRLCDYAZ
        MOVLW   'a'
        CALL    TRLCDYAZ
        MOVLW   ' '
        CALL    TRLCDYAZ
        MOVLW   'B'
        CALL    TRLCDYAZ
        MOVLW   'u'
        CALL    TRLCDYAZ
        MOVLW   't'
        CALL    TRLCDYAZ
        MOVLW   'o'
        CALL    TRLCDYAZ
        MOVLW   'n'
        CALL    TRLCDYAZ
        MOVLW   'u'
        CALL    TRLCDYAZ
        ;--- Lcd 2,1 YOL yaz ---
        MOVLW   d'192'
        CALL    TRLCDYAP
        CALL    TRLCD200US
        MOVF    YOL,W
        CALL    TRLCDYAZ
        ;--- Lcd 2,4 "(arttir)" yaz ---
        MOVLW   d'195'
        CALL    TRLCDYAP
        CALL    TRLCD200US
        MOVLW   '('
        CALL    TRLCDYAZ
        MOVLW   'a'
        CALL    TRLCDYAZ
        MOVLW   'r'
        CALL    TRLCDYAZ
        MOVLW   't'
        CALL    TRLCDYAZ
        MOVLW   't'
        CALL    TRLCDYAZ
        MOVLW   'i'
        CALL    TRLCDYAZ
        MOVLW   'r'
        CALL    TRLCDYAZ
        MOVLW   ')'
        CALL    TRLCDYAZ
        BCF     PORTB,0
        BSF     PORTB,3
        CALL    TR500MS
TR_ISE1
        BTFSS   PORTA,2
        GOTO    TR_ISE2
        DECF    YOL,F
        CALL    TRLCDTEMIZLE
        ;--- Lcd 1,1 git ---
        MOVLW   d'128'
        CALL    TRLCDYAP
        CALL    TRLCD200US
        ;Lcd "Eksilme Butonu" yaz
        MOVLW   'E'
        CALL    TRLCDYAZ
        MOVLW   'k'
        CALL    TRLCDYAZ
        MOVLW   's'
        CALL    TRLCDYAZ
        MOVLW   'i'
        CALL    TRLCDYAZ
        MOVLW   'l'
        CALL    TRLCDYAZ
        MOVLW   'm'
        CALL    TRLCDYAZ
        MOVLW   'e'
        CALL    TRLCDYAZ
        MOVLW   ' '
        CALL    TRLCDYAZ
        MOVLW   'B'
        CALL    TRLCDYAZ
        MOVLW   'u'
        CALL    TRLCDYAZ
        MOVLW   't'
        CALL    TRLCDYAZ
        MOVLW   'o'
        CALL    TRLCDYAZ
        MOVLW   'n'
        CALL    TRLCDYAZ
        MOVLW   'u'
        CALL    TRLCDYAZ
        ;--- Lcd 2,1 YOL yaz ---
        MOVLW   d'192'
        CALL    TRLCDYAP
        CALL    TRLCD200US
        MOVF    YOL,W
        CALL    TRLCDYAZ
        ;--- Lcd 2,4 "(azalt)" yaz ---
        MOVLW   d'195'
        CALL    TRLCDYAP
        CALL    TRLCD200US
        MOVLW   '('
        CALL    TRLCDYAZ
        MOVLW   'a'
        CALL    TRLCDYAZ
        MOVLW   'z'
        CALL    TRLCDYAZ
        MOVLW   'a'
        CALL    TRLCDYAZ
        MOVLW   'l'
        CALL    TRLCDYAZ
        MOVLW   't'
        CALL    TRLCDYAZ
        MOVLW   ')'
        CALL    TRLCDYAZ
        BSF     PORTB,0
        BCF     PORTB,3
        CALL    TR500MS
TR_ISE2
        GOTO    GOREVLER


TRLCDTANIMLA
        CALL    TRLCD100MS
        BCF     PORTA,0  
        BCF     PORTA,1   

        MOVLW   b'00110000'  
        MOVWF   PORTB       
        BSF     PORTA,1
        NOP
        BCF     PORTA,1
        CALL    TRLCD100MS
        MOVLW   b'00110000'    
        MOVWF   PORTB       
        BSF     PORTA,1
        NOP
        BCF     PORTA,1
        CALL    TRLCD200US
        MOVLW   b'00110000'   
        MOVWF   PORTB       
        BSF     PORTA,1
        NOP
        BCF     PORTA,1
        CALL    TRLCD200US
        MOVLW   b'00100000'
        MOVWF   PORTB        
        BSF     PORTA,1
        NOP
        BCF     PORTA,1
        CALL    TRLCD200US
        MOVLW   b'00001100'   
        CALL    TRLCDYAP
        CALL    TRLCD200US
        MOVLW   b'00000110'   
        CALL    TRLCDYAP
        CALL    TRLCD200US
        MOVLW   b'00000001'  
        CALL    TRLCDYAP
        CALL    TRLCD2MS
        RETURN

TRLCDYAP
        BCF     PORTA,0
        GOTO    TRLCDYAZ1
TRLCDYAZ
        BSF     PORTA,0
TRLCDYAZ1
        MOVWF   TRLCD02
        ANDLW   b'11110000'
        MOVWF   PORTB     
        BSF     PORTA,1
        NOP
        BCF     PORTA,1
        MOVLW   b'10101010'  
        MOVWF   TRLCD01
TRLCDYAZ2
        DECFSZ  TRLCD01,1
        GOTO    TRLCDYAZ2
        MOVF    TRLCD02,0
        ANDLW   b'11110000'
        SWAPF   TRLCD02,0
        MOVWF   PORTB    
        BSF     PORTA,1
        NOP
        BCF     PORTA,1
        MOVLW   b'10101010'   
        MOVWF   TRLCD01
TRLCDYAZ3
        DECFSZ  TRLCD01,1
        GOTO    TRLCDYAZ3
        RETURN

TRLCDTEMIZLE
        MOVLW   b'00000001' 
        CALL    TRLCDYAP
        CALL    TRLCD2MS
        CALL    TRLCD2MS
        RETURN

TRLCD100MS
        MOVLW   d'100'
        MOVWF   TRLCD100MA
TRLCD100MS1
        MOVLW   d'27'
        MOVWF   TRLCD100MB
TRLCD100MS2
        MOVLW   d'11'
        MOVWF   TRLCD100MC
TRLCD100MS3
        DECFSZ  TRLCD100MC,F
        GOTO    TRLCD100MS3
        DECFSZ  TRLCD100MB,F
        GOTO    TRLCD100MS2
        DECFSZ  TRLCD100MA,F
        GOTO    TRLCD100MS1
        RETURN

TRLCD200US
        MOVLW   d'64'
        MOVWF   TRLCD200UA
TRLCD200US1
        DECFSZ  TRLCD200UA,F
        GOTO    TRLCD200US1
        NOP
        RETURN

TRLCD2MS
        MOVLW   d'2'
        MOVWF   TRLCD2MA
TRLCD2MS1
        MOVLW   d'27'
        MOVWF   TRLCD2MB
TRLCD2MS2
        MOVLW   d'11'
        MOVWF   TRLCD2MC
TRLCD2MS3
        DECFSZ  TRLCD2MC,F
        GOTO    TRLCD2MS3
        DECFSZ  TRLCD2MB,F
        GOTO    TRLCD2MS2
        DECFSZ  TRLCD2MA,F
        GOTO    TRLCD2MS1
        RETURN
TR500MS
        MOVLW   d'246'
        MOVWF   TR500MA
TR500MS1
        MOVLW   d'27'
        MOVWF   TR500MB
TR500MS2
        MOVLW   d'11'
        MOVWF   TR500MC
TR500MS3
        DECFSZ  TR500MC, F
        GOTO    TR500MS3
        DECFSZ  TR500MB, F
        GOTO    TR500MS2
        DECFSZ  TR500MA, F
        GOTO    TR500MS1
TR500MSEK
        MOVLW   d'255'
        MOVWF   TR500MSEKA
TR500MSEK1
        MOVLW   d'27'
        MOVWF   TR500MSEKB
TR500MSEK2
        MOVLW   d'11'
        MOVWF   TR500MSEKC
TR500MSEK3
        DECFSZ  TR500MSEKC, F
        GOTO    TR500MSEK3
        DECFSZ  TR500MSEKB, F
        GOTO    TR500MSEK2
        DECFSZ  TR500MSEKA, F
        GOTO    TR500MSEK1
        RETURN
        
TR2SN
        MOVLW   d'2'
        MOVWF   TR2SNA
TR2SN1
        MOVLW   d'8'
        MOVWF   TR2SNB
TR2SN2
        MOVLW   d'209'
        MOVWF   TR2SNC
TR2SN3
        MOVLW   d'200'
        MOVWF   TR2SND
TR2SN4
        DECFSZ  TR2SND, F
        GOTO    TR2SN4
        DECFSZ  TR2SNC, F
        GOTO    TR2SN3
        DECFSZ  TR2SNB, F
        GOTO    TR2SN2
        DECFSZ  TR2SNA, F
        GOTO    TR2SN1
        RETURN
        
        END     ; Program sonu

Devreya ait HEX dosya içeriği

:020000040000FA
:1000000001288501860183160313FC30850000302A
:1000100086008312031307309F006730810083122C
:10002000352112286D30B300732180305A2185218B
:1000300054305C2165305C216B305C216E305C217A
:100040006F305C216D305C2165305C2172305C2149
:100050006B305C2165305C217A305C21C0305A21E4
:10006000852154305C2165305C216B305C216E3021
:100070005C2169305C216B305C2120305C21423096
:100080005C2169305C216C305C2167305C21693017
:100090005C216C305C2165305C2172305C2106147F
:1000A0008615B121732180305A21852142305C218F
:1000B00069305C2172305C2120305C2162305C212F
:1000C00075305C2174305C216F305C216E305C21B6
:1000D00020305C2173305C2165305C2163305C2111
:1000E000C0305A2185213C305C2141305C217A307E
:1000F0005C2161305C216C305C213E305C21203021
:100100005C213C305C214D305C213E305C21203054
:100110005C213C305C2141305C2172305C217430C8
:100120005C213E305C2106148615851DBE284D30AD
:10013000B300732180305A2185214D305C21653018
:100140005C2172305C216B305C2165305C217A303F
:100150005C2120305C2142305C2175305C217430A0
:100160005C216F305C216E305C2175305C21C030C9
:100170005A21852133085C2106108611051EF828B6
:10018000B30A732180305A21852141305C217230BD
:100190005C2174305C216D305C2161305C21203049
:1001A0005C2142305C2175305C2174305C216F3001
:1001B0005C216E305C2175305C21C0305A21852174
:1001C00033085C21C3305A21852128305C216130FD
:1001D0005C2172305C2174305C2174305C216930A8
:1001E0005C2172305C2129305C2106108615982133
:1001F000051D3429B303732180305A2185214530F0
:100200005C216B305C2173305C2169305C216C3087
:100210005C216D305C2165305C2120305C214230F6
:100220005C2175305C2174305C216F305C216E3054
:100230005C2175305C21C0305A21852133085C2156
:10024000C3305A21852128305C2161305C217A300D
:100250005C2161305C216C305C2174305C21293080
:100260005C210614861198219528782105108510A7
:1002700030308600851400008510782130308600EB
:10028000851400008510852130308600851400001B
:100290008510852120308600851400008510852179
:1002A0000C305A21852106305A21852101305A21EE
:1002B0008B21080005105D290514A100F039860086
:1002C000851400008510AA30A000A00B6529210824
:1002D000F039210E8600851400008510AA30A00098
:1002E000A00B7029080001305A218B218B210800B6
:1002F0006430A2001B30A3000B30A400A40B7E29A5
:10030000A30B7C29A20B7A2908004030A500A50B7D
:100310008729000008000230A6001B30A7000B3020
:10032000A800A80B9129A70B8F29A60B8D290800DF
:10033000F630A9001B30AA000B30AB00AB0B9E2996
:10034000AA0B9C29A90B9A29FF30AC001B30AD00E9
:100350000B30AE00AE0BAA29AD0BA829AC0BA62919
:1003600008000230AF000830B000D130B100C83012
:10037000B200B20BB929B10BB729B00BB529AF0B3D
:04038000B329080095
:04038400003400340D
:02400E00293F48
:00000001FF


Adana'da dünyaya geldi. Televizyon tamirciliğınde çırak olarak erken dönemde iş hayatına başladı. Daha sonraları Adana ve Ankara'da imalat, bilgisayar ve danışmanlık sektöründe iş hayatına devam etti. Şu anda kendisine ait işyerinde çalışmalarına devam etmektedir.
Web adresi: www.teknimer.com
E-posta: mehmet@teknimer.com

Yorumlarınız

Hiç yorum yapılmamış, ilk yorumu siz yapabilirsiniz.

Yorum yapabilirsiniz

İsim:
E-posta:
Yorumunuz:
Güvenlik Kodu:
 
Tüm alanları doldurmak zorunludur. Yorumunuz kontrol edilince yayınlanacaktır
İçerik Yan Blok
Konular
Tasarım: Teknimer Teknoloji
Yukarı