bu assembler kodunu ccs c diline çevirebilecek biri yardımcı olabilir mi

Katılım
3 Mar 2016
Mesajlar
6
Puanları
1
Yaş
28
LIST P=16F876
ERRORLEVEL -302
;--------
include <p16f876.inc>
__CONFIG _CP_OFF &_WDT_OFF &_PWRTE_ON &_HS_OSC &_BODEN_OFF &_LVP_OFF &_CPD_OFF &_WRT_ENABLE_OFF
;------
DEGER EQU H'0020'
DEGERH EQU H'0021'
DEGERL EQU H'0022'
DEGER3 EQU H'0023'
SAYI1 EQU H'0024'
SAYI2 EQU H'0025'
SAYI3 EQU H'0026'
SAYI4 EQU H'0027'
D1 EQU H'0028'
D2 EQU H'0029'
D3 EQU H'002A'
D4 EQU H'002B'
LSB EQU H'002C'
MSB EQU H'002D'
TEMP EQU H'002E'
BEKLEM EQU H'002F'
TOPLA1 EQU H'0034'
TOPLA2 EQU H'0035'
TOPLA3 EQU H'0036'
SAYACH EQU H'0037'
SAYACL EQU H'0038'
COKBK EQU H'0039'
;---------
ORG 00H
GOTO START
;-------------
START
CLRF PORTA
CLRF PORTB
CLRF PORTC
CLRF DEGER
CLRF DEGERH
CLRF DEGERL
CLRF SAYACH
CLRF SAYACL
CLRF DEGER3
CLRF SAYI1
CLRF SAYI2
CLRF SAYI3
CLRF SAYI4
CLRF D1
CLRF D2
CLRF D3
CLRF D4
CLRF LSB
CLRF MSB
CLRF TEMP
CLRF COKBK
CLRF BEKLEM
MOVLW B'01000001'
MOVWF ADCON0
BSF STATUS,RP0
MOVLW B'11010111'
MOVWF TRISA^80H
CLRF TRISB^80H
MOVLW B'11110000'
MOVWF TRISC^80H
MOVLW B'10001110'
MOVWF ADCON1^80
MOVLW B'10000111'
MOVWF OPTION_REG
BCF STATUS,RP0
CALL TEMIZLE
GOTO GOSTER_LCD
;------------------------------
ADC
MOVLW .250
MOVWF TEMP
ADBEKLE
DECFSZ TEMP,F
GOTO ADBEKLE
MOVLW .250
MOVWF TEMP
ADBEK2
DECFSZ TEMP,F
GOTO ADBEK2
BSF ADCON0,GO ;Start A/D conversion
TARA
BTFSC ADCON0,GO
GOTO TARA

BSF STATUS,RP0
MOVF ADRESL,W
BCF STATUS,RP0
MOVWF DEGERL
MOVWF SAYACL
MOVF ADRESH,W
MOVWF DEGERH
MOVWF SAYACH
RETURN
;-----------------------
BEKLE
MOVLW .10
MOVWF MSB
D11
MOVLW .150
MOVWF LSB
D22
DECFSZ LSB,F
GOTO D22
DECFSZ MSB,F
GOTO D11
RETURN
COKBEKLE
MOVLW .50
MOVWF COKBK
CBKDNG
MOVLW .255
MOVWF MSB
CDN1
MOVLW .255
MOVWF LSB
CDN2
DECFSZ LSB,F
GOTO CDN2
DECFSZ MSB,F
GOTO CDN1

DECFSZ COKBK,F
GOTO CBKDNG

RETURN
;-----------------------
HESAP
MOVLW .0
MOVWF SAYI1
MOVWF SAYI2
MOVWF SAYI3
MOVWF SAYI4
HES
MOVLW .100
SUBWF DEGER,W
BTFSS STATUS,C
GOTO HES1
MOVLW .100
SUBWF DEGER,F
INCF SAYI2,F
GOTO HES
HES1
MOVLW .10
SUBWF DEGER,W
BTFSS STATUS,C
GOTO HES2
MOVLW .10
SUBWF DEGER,F
INCF SAYI3,F
GOTO HES1
HES2
MOVLW .1
SUBWF DEGER,W
BTFSS STATUS,C
GOTO HESSON
MOVLW .1
SUBWF DEGER,F
INCF SAYI4,F
GOTO HES2
HESSON
RETURN
;-----------------------------------------------------------------
ANA
CALL ADC
MOVF DEGERL,W
MOVWF DEGER
CALL HESAP
CALL HESAP2
MOVF SAYI1,W
SUBWF D1,W
BTFSS STATUS,Z
GOTO GOSTER_LCD
MOVF SAYI2,W
SUBWF D2,W
BTFSS STATUS,Z
GOTO GOSTER_LCD
MOVF SAYI3,W
SUBWF D3,W
BTFSS STATUS,Z
GOTO GOSTER_LCD
MOVF SAYI4,W
SUBWF D4,W
BTFSS STATUS,Z
GOTO GOSTER_LCD
BU_TEST
BTFSS PORTC,4
GOTO SAG
BTFSS PORTC,5
GOTO SOL
GOTO ANA
;---------------------------
SOL
CALL SATIR2
CALL MOTORSOL
SOLDVM
CALL ADMSAY
MOVLW B'11000110'
MOVWF PORTC
CALL SURE

BTFSS PORTC,6
GOTO DUR
CALL ADMSAY
MOVLW B'01000011'
MOVWF PORTC
CALL SURE

BTFSS PORTC,6
GOTO DUR
CALL ADMSAY
MOVLW B'01001001'
MOVWF PORTC
CALL SURE

BTFSS PORTC,6
GOTO DUR
CALL ADMSAY
MOVLW B'11001100'
MOVWF PORTC
CALL SURE

BTFSS PORTC,6
GOTO DUR
GOTO SOLDVM

SAG
CALL SATIR2
CALL MOTORSAG
SAGDVM
CALL ADMSAY
MOVLW B'00110011'
MOVWF PORTC
CALL SURE

BTFSS PORTC,6
GOTO DUR
CALL ADMSAY
MOVLW B'00100110'
MOVWF PORTC
CALL SURE

BTFSS PORTC,6
GOTO DUR
CALL ADMSAY
MOVLW B'00101100'
MOVWF PORTC
CALL SURE

BTFSS PORTC,6
GOTO DUR
CALL ADMSAY
MOVLW B'00111001'
MOVWF PORTC
CALL SURE

BTFSS PORTC,6
GOTO DUR
GOTO SAGDVM
DUR
CLRF PORTC
CALL TEMIZLE
CALL MOTORDUR
CALL COKBEKLE
CALL TEMIZLE
GOTO GOSTER_LCD
GOTO ANA
ADMSAY
MOVLW .1
SUBWF SAYACL,F
BTFSC STATUS,C
RETURN
MOVLW .0
SUBWF SAYACH,W
BTFSC STATUS,Z
GOTO DUR
MOVLW .255
MOVWF SAYACL
DECF SAYACH,F
RETURN
;----------------------------------------------
SURE

MOVLW B'10001001'
MOVWF ADCON0
BSF STATUS,RP0
MOVLW B'00000000'
MOVWF ADCON1^80
BCF STATUS,RP0

BSF ADCON0,GO ;Start A/D conversion
SUTARA
NOP
BTFSC ADCON0,GO
GOTO SUTARA
MOVF ADRESH,W
MOVWF TEMP

SUREDON
MOVLW .30
MOVWF LSB
SUR1
MOVLW .30
MOVWF MSB
SUR2
DECFSZ MSB,F
GOTO SUR2
DECFSZ LSB,F
GOTO SUR1
DECFSZ TEMP,F
GOTO SUREDON

MOVLW B'01000001'
MOVWF ADCON0
BSF STATUS,RP0
MOVLW B'10001110'
MOVWF ADCON1^80
BCF STATUS,RP0
RETURN
;---------------------------
GOSTER_LCD
MOVF SAYI1,W
MOVWF D1
MOVF SAYI2,W
MOVWF D2
MOVF SAYI3,W
MOVWF D3
MOVF SAYI4,W
MOVWF D4
CALL TEMIZLE
MOVF D1,W
ADDLW H'30'
CALL VERIYAZ
MOVF D2,W
ADDLW H'30'
CALL VERIYAZ
MOVF D3,W
ADDLW H'30'
CALL VERIYAZ
MOVF D4,W
ADDLW H'30'
CALL VERIYAZ
GOTO ANA
;---------------------------------------------------
HESAP2
MOVLW .0
SUBWF DEGERH,W
BTFSC STATUS,Z
RETURN
BTFSC DEGERH,0
GOTO YAZ256
DEVAM
BTFSC DEGERH,1
GOTO YAZ512
RETURN
SONUC
MOVLW .10
SUBWF SAYI4,W
BTFSC STATUS,C
CALL BUYUK
MOVLW .10
SUBWF SAYI3,W
BTFSC STATUS,C
CALL BUYUK1
MOVLW .10
SUBWF SAYI2,W
BTFSC STATUS,C
CALL BUYUK2
RETURN
BUYUK
MOVWF SAYI4
INCF SAYI3,F
RETURN
BUYUK1
MOVWF SAYI3
INCF SAYI2,F
RETURN
BUYUK2
MOVWF SAYI2
INCF SAYI1,F
RETURN
YAZ256
MOVLW .2
ADDWF SAYI2,F
MOVLW .5
ADDWF SAYI3,F
MOVLW .6
ADDWF SAYI4,F
CALL SONUC
GOTO DEVAM
YAZ512
MOVLW .5
ADDWF SAYI2,F
MOVLW .1
ADDWF SAYI3,F
MOVLW .2
ADDWF SAYI4,F
CALL SONUC
RETURN
;------------------------------------------
MOTORDUR
MOVLW A'M'
CALL VERIYAZ
MOVLW A'O'
CALL VERIYAZ
MOVLW A'T'
CALL VERIYAZ
MOVLW A'O'
CALL VERIYAZ
MOVLW A'R'
CALL VERIYAZ
MOVLW A' '
CALL VERIYAZ
MOVLW A'D'
CALL VERIYAZ
MOVLW A'U'
CALL VERIYAZ
MOVLW A'R'
CALL VERIYAZ
MOVLW A'D'
CALL VERIYAZ
MOVLW A'U'
CALL VERIYAZ
MOVLW A'R'
CALL VERIYAZ
MOVLW A'U'
CALL VERIYAZ
MOVLW A'L'
CALL VERIYAZ
MOVLW A'D'
CALL VERIYAZ
MOVLW A'U'
CALL VERIYAZ
RETURN
MOTORSAG
MOVLW A'M'
CALL VERIYAZ
MOVLW A'O'
CALL VERIYAZ
MOVLW A'T'
CALL VERIYAZ
MOVLW A'O'
CALL VERIYAZ
MOVLW A'R'
CALL VERIYAZ
MOVLW A' '
CALL VERIYAZ
MOVLW A'D'
CALL VERIYAZ
MOVLW A'O'
CALL VERIYAZ
MOVLW A'N'
CALL VERIYAZ
MOVLW A'U'
CALL VERIYAZ
MOVLW A'Y'
CALL VERIYAZ
MOVLW A'O'
CALL VERIYAZ
MOVLW A'R'
CALL VERIYAZ
MOVLW A'>'
CALL VERIYAZ
MOVLW A'>'
CALL VERIYAZ
MOVLW A'>'
CALL VERIYAZ
RETURN
MOTORSOL
MOVLW A'<'
CALL VERIYAZ
MOVLW A'<'
CALL VERIYAZ
MOVLW A'<'
CALL VERIYAZ
MOVLW A'M'
CALL VERIYAZ
MOVLW A'O'
CALL VERIYAZ
MOVLW A'T'
CALL VERIYAZ
MOVLW A'O'
CALL VERIYAZ
MOVLW A'R'
CALL VERIYAZ
MOVLW A' '
CALL VERIYAZ
MOVLW A'D'
CALL VERIYAZ
MOVLW A'O'
CALL VERIYAZ
MOVLW A'N'
CALL VERIYAZ
MOVLW A'U'
CALL VERIYAZ
MOVLW A'Y'
CALL VERIYAZ
MOVLW A'O'
CALL VERIYAZ
MOVLW A'R'
CALL VERIYAZ
RETURN
;------------------------------------------
SATIR2
MOVLW H'C0'
CALL KOMUTYAZ
RETURN
SATIR1
MOVLW H'80'
CALL KOMUTYAZ
RETURN
VERIYAZ
BSF PORTA,5
MOVWF PORTB
BCF PORTA,3
CALL BEKLE
BSF PORTA,3
RETURN
TEMIZLE
MOVLW H'0C'
CALL KOMUTYAZ
MOVLW H'01'
CALL KOMUTYAZ
MOVLW H'38'
CALL KOMUTYAZ
MOVLW H'0C'
CALL KOMUTYAZ
RETURN
KOMUTYAZ
BCF PORTA,5
MOVWF PORTB
BCF PORTA,3
CALL BEKLE
BSF PORTA,3
RETURN
;------------------------------------------------------------------
END
 
Assembly yazmayalı yıllar oldu, bunu okuyup anlamaya çalışmaktansa, ne yaptığını söyleyin xc8de yazıp yollayayım. Sanırım bir motoru durdurup çalıştırıyor. Ekrana da yazı yazıyor. Varsa isis şeması da ekleyin.
 

Step motor potansiyo metre yardımıyla hız ayarı ve adım ayarı yapabilmemizi sağlıyor. motor sağ ve sola döndünğünde lcd ekran üzerinde sağa veya sola dönüyor diye yazı çıkıyor. temel çalışma mantğı bu şekilde ve ccs c diline çevirmemiz şart bana ccs c dili lazım.
 

Ekli dosyalar

  • devre şeması.PNG
    120.3 KB · Görüntüleme: 10
Son düzenleme:
Bu siteyi kullanmak için çerezler gereklidir. Siteyi kullanmaya devam etmek için onları kabul etmelisiniz. Daha fazla bilgi edin…