Proton AD8403 PIC16F877A Dijital Potansiyometre Uygulaması

haterbol

Üye
Katılım
27 Eyl 2008
Mesajlar
3
Puanları
1
Yaş
39
Konum
istanbul
proteusta sorunsuz calışan ve kütüphanesi olan ad8403 lü dijital potansiyometre kodlarını ve isis şemasını sunuyorum umarım işinize yarar..

Kod:
'

****************************************************************
'*  Name    : AD8403.BAS                                        *
'*  Author  : [ergunbt]                                         *
'*  Notice  : Copyright (c) 2015 [select VIEW...EDITOR OPTIONS] *
'*          : All Rights Reserved                               *
'*  Date    : 09.09.2015                                        *
'*  Version : 1.0                                               *
'*  Notes   : AD8403 dijital pot uygalaması                     *
'*          :                                                   *
'****************************************************************
        REMARKS On
       Include "proton_20.inc"
        Device 16F877A 

        Symbol CS       PORTB.5                       
        Symbol Sdi      PORTB.4                        
        Symbol Clk      PORTB.3                        
        Symbol AZALT    PORTB.0                       
        Symbol ARTTIR   PORTB.1                       
        Symbol MODE     PORTB.2                        
        
       Symbol true = 1
       Symbol false = 0       
       
        Dim HESAP1      As Word                   
        Dim P_OUT1      As Word 
        Dim HESAP2      As Word                  
        Dim P_OUT2      As Word                  
        Dim HESAP3      As Word                   
        Dim P_OUT3      As Word
        Dim HESAP4      As Word                   
        Dim P_OUT4      As Word              
        Dim MOD         As Byte

        Print $FE,$50,$08,$04,$02,$0D,$02,$04,$08,$00       'LCD 2. KARAKTER HAFIZASI YÖN İŞARETİ

        Cls                                            
        'EData 0                                   
         HESAP1 = 0 
         HESAP2 = 0
         HESAP3 = 0
         HESAP4 = 0
        OPTION_REG.7=0                           
  DelayMS 200
 
  Print At 1,1, " ERGUNBT AD8403  "
  Print At 2,1, "DIJITAL POT 2015 "
DelayMS 2500
       
Main:
If MODE=0 Then
While MODE=0 : Wend
MOD=MOD+1
If MOD>3 Then MOD=0
EndIf

If MOD=0 Then
        If AZALT=0 Then 
           If HESAP1 >0 Then                   
                Dec HESAP1                            
               GoSub Potout1                   
              
                DelayMS 200                     
           EndIf
        EndIf
        
       If ARTTIR=0 Then 
           If HESAP1 <510 Then               
                Inc HESAP1
               If HESAP1>50 Then HESAP1=50                   
               GoSub Potout1                    
                       
                DelayMS 200                      
           EndIf
        EndIf
       
                Print At 1,1,2, "POT1 ",DEC2,HESAP1," POT2 ",DEC2,HESAP2                       
                Print At 2,1, " POT3 ",DEC2,HESAP3, " POT4 ",DEC2,HESAP4
EndIf
If MOD=1 Then
        If AZALT=0 Then
           If HESAP2 >0 Then                    
                Dec HESAP2                          
               GoSub Potout2                   
              
                DelayMS 200                      
           EndIf
        EndIf
        
       If ARTTIR=0 Then 
           If HESAP2 <510 Then               
                Inc HESAP2
            If HESAP2>50 Then HESAP2=50                        
               GoSub Potout2                       
                       
                DelayMS 200                       
           EndIf
        EndIf
       
                Print At 1,1, " POT1 ",DEC2,HESAP1,2,"POT2 ",DEC2,HESAP2                       
                Print At 2,1, " POT3 ",DEC2,HESAP3," POT4 ",DEC2,HESAP4
                    
                
EndIf                                                
If MOD=2 Then
        If AZALT=0 Then
           If HESAP3 >0 Then                    
                Dec HESAP3                           
               GoSub Potout3                    
              
                DelayMS 200                     
           EndIf
        EndIf
        
       If ARTTIR=0 Then 
           If HESAP3 <510 Then                
                Inc HESAP3
                If HESAP3>50 Then HESAP3=50                    
               GoSub Potout3                     
                       
                DelayMS 200                       
           EndIf
        EndIf
       
                Print At 1,1, " POT1 ",DEC2,HESAP1, " POT2 ",DEC2,HESAP2                       
                Print At 2,1,2,"POT3 ",DEC2,HESAP3, " POT4 ",DEC2,HESAP4
                    
                
EndIf                                       
If MOD=3 Then
        If AZALT=0 Then
           If HESAP4 >0 Then                    
                Dec HESAP4                           
               GoSub Potout4                   
              
                DelayMS 200                        
           EndIf
        EndIf
        
       If ARTTIR=0 Then 
           If HESAP4 <510 Then                
                Inc HESAP4
                If HESAP4>50 Then HESAP4=50                   
               GoSub Potout4                       
                       
                DelayMS 200                        
           EndIf
        EndIf
       
                Print At 1,1, " POT1 ",DEC2,HESAP1, " POT2 ",DEC2,HESAP2                       
                Print At 2,1, " POT3 ",DEC2,HESAP3,2,"POT4 ",DEC2,HESAP4
                    
                
EndIf                           
    

        GoTo Main                              
'POT KONTROLÜNÜ SAĞLAYAN KISIM DATASHEETTEKİ ADRESLERİ VE HESAP DÖNÜŞÜMÜ
Potout1:
        
        P_OUT1=(HESAP1*510)/100
                      
        P_OUT1.8=0   'POT ADRESLERİ                        
        P_OUT1.9=0   'POT ADRESLERİ                         
        Low CS                                   
        SHOut Sdi,Clk,msbfirst,[P_OUT1\10]    
        High CS                                   
Return                                    
Potout2: 
        P_OUT2=(HESAP2*510)/100               
        P_OUT2.8=1   'POT ADRESLERİ                        
        P_OUT2.9=0    'POT ADRESLERİ                       
        Low CS                                    
        SHOut Sdi,Clk,msbfirst,[P_OUT2\10]   
        High CS                                   
Return
Potout3: 
        P_OUT3=(HESAP3*510)/100                
        P_OUT3.8=0     'POT ADRESLERİ                       
        P_OUT3.9=1      'POT ADRESLERİ                     
        Low CS                                   
        SHOut Sdi,Clk,msbfirst,[P_OUT3\10]    
        High CS                                    
Return
Potout4: 
        P_OUT4=(HESAP4*510)/100               
        P_OUT4.8=1      'POT ADRESLERİ                     
        P_OUT4.9=1      'POT ADRESLERİ                     
        Low CS                                   
        SHOut Sdi,Clk,msbfirst,[P_OUT4\10]    
        High CS                                   
Return
 

Ekli dosyalar

  • proton208403.PDF
    64.8 KB · Görüntüleme: 39
Sayın @haterbol lütfen konu açarken konu başlığını tamamen büyük harflerle yazmamaya özen gösterelim. Paylaşım için teşekkür ederiz.
 
merhaba, kodları hangi programda çalıştırıyoruz?
 
Basic dili ile PIC programlamak için geliştirilmiş olan Proton BASIC compiler adlı
3. parti derleyici için yazılmış kodlar.
http://www.protonbasic.co.uk/

Proton dan uzak durun.
 

Forum istatistikleri

Konular
128,179
Mesajlar
915,658
Kullanıcılar
449,940
Son üye
yavuzturan

Yeni konular

Çevrimiçi üyeler

Geri
Üst