Haberler:

Forum kuralları güncellendi LÜTFEN  okuyunuz:  https://bit.ly/2IjR3ME

Ana Menü

DelayMs komutunda problem

Başlatan bederik, 22 Haziran 2019, 14:36:44

bederik

Sayın Usta arkadaşlar. Sorunum protonda DelayMs 1000 yazdığımda 1 saniyelik gecikme yapmaması. Ancak DelayMs 27000 yazdığımda yaklaşık 1 saniye gecikme yapıyor. Bu durum simulasyonda da gerçekte de aynı şekilde. Acaba sizler nasıl bir fikir verebilirsiniz? Yüklemiş olduğum Protonda mı yoksa Sigorta ayarlarında mı yanlış yapıyorum. Değerli fikirleriniz için şimdiden teşekkürler.

Device = 16F628A
Config FOSC_INTOSCCLK, WDTE_OFF, PWRTE_OFF, MCLRE_OFF, BOREN_ON, LVP_OFF, CPD_OFF, CP_OFF
'Config FOSC_INTOSCIO, WDTE_OFF, PWRTE_OFF, MCLRE_OFF, BOREN_ON, LVP_OFF, CPD_OFF, CP_OFF

;**** End of Fuse Configurator Settings ****
;-------------------------------------------------------------------------------
Include "modedefs.bas"
Declare LCD_DTPin PORTA.0
Declare LCD_RSPin PORTB.0
Declare LCD_ENPin PORTB.1
Declare LCD_RWPin PORTB.7
Declare LCD_Interface 4
Declare LCD_Lines 2
Declare LCD_CommandUs 4000
Declare LCD_DataUs	 250
CMCON = 7
TRISB=%10001101
TRISA=%11110000
Symbol girsen =PORTA.4
Symbol ciksen =PORTB.2
Symbol buton =PORTB.3
Symbol girkil =PORTB.4
Symbol cikkil =PORTB.5
Symbol lamba =PORTB.6
girkil=0
cikkil=0
lamba=0
Dim A As Word
Dim b As Word
Dim c As Word
A=0
b=0
c=0
DelayMS 25000
DelayMS 25000
DelayMS 25000

BASLA:
If girsen=0 And ciksen=0 Then
A=a+1
lamba=1
girkil=1
cikkil=1
Else
A=0
lamba=0
EndIf
If A=60 Then
c=c+1
A=0
EndIf
Print $fe,$2,"Sure = ",Dec2 c,":",Dec2 A
Print $fe,$c0,"               "
If buton=1 Then
GoSub but
EndIf

If c=30 Then
GoSub sur
EndIf
DelayMS 27300
GoTo BASLA

sur:
lamba=0
cikkil=0
DelayMS 25000
If ciksen=0 Then
GoTo sur
EndIf
If ciksen=1 Then 
Print $fe,$c0,"CIKIS ACIK"
DelayMS 25000
DelayMS 25000
DelayMS 25000
While ciksen=1 
DelayMS 25000
Wend
DelayMS 25000
DelayMS 25000
EndIf
A=0
c=0
girkil=0
cikkil=1
If girsen=0 Then
While girsen=0
DelayMS 25000
Wend
DelayMS 25000
DelayMS 25000
EndIf
Print $fe,$c0,"Giris ACIK"
If girsen=1 Then
While girsen=1
DelayMS 25000
Wend
DelayMS 25000
DelayMS 25000
EndIf
Return


but:
girkil=0
For b=0 To 20 step1
If girsen=1 Then
Print $fe,$c0,"Giris ACIK"
A=0
c=0
lamba=0 
While girsen=1
Wend
DelayMS 25000
DelayMS 25000
Else
lamba=1
A=a+1
If A=60 Then
c=c+1
A=0
EndIf
Print $fe,$2,"Sure = ",Dec2 c,":",Dec2 A
EndIf
DelayMS 27300
Next b
Return
End


power20

Declare Xtal...

ile çalışma frekansı belirtilir. Aksi halde program çalıştığı frekansı bilmediği için gecikme yanlış hesaplanır

bederik

Teşekkürler Arkadaşım küçük ayrıntı ama unutulmaması gerekir demekki.