sönmez1703
Üye
- Katılım
- 2 Şub 2012
- Mesajlar
- 19
- Puanları
- 1
- Yaş
- 36
eywallah kardeş ilgilenmen yeter , uğraşcam yapmam gerekiyor bitirme projem bu benim çok sağolun
Device = 16F877
XTAL = 20
LCD_DTPIN = PORTD.4
LCD_RSPIN = PORTE.0
LCD_ENPIN = PORTE.1
LCD_INTERFACE = 4 ' 4-bit Interface
LCD_LINES = 2
LCD_TYPE = 0
LCD_COMMANDUS = 2000
LCD_DATAUS = 50
LCD_RWPIN = PORTE.2
CCP1_PIN = PORTC.2
CCP2_PIN = PORTC.1
Symbol SW1 = PORTB.6
Symbol SW2 = PORTB.7
Dim Duty As Byte
Dim US As Word
Dim sn As Byte
Dim RPM As Word
Dim BUF1 As Byte
Dim BUF2 As Byte
On_Interrupt GoTo Main_Int
ALL_DIGITAL = TRUE
PORTB = 0
TRISB = 255
TRISE.2 = 0
OPTION_REG=%10000111
PORTB_PULLUPS = On
INTCON.4 = 1 ' Portb.0 External Interrupt Acık
INTCON.5 = 1 ' Timer0 Interrupt Acık PORTB
INTCON.7=1
Print At 1,1, "PWM DUTY :"
Print At 2,1, "RPM :"
Clear BUF1
Clear BUF2
Duty = 1
Loop:
HPWM 1,Duty,1000 ' Send duty cycle PWM signal at 1KHz
B1: 'Button SW1,0,240,100,BUF1,0,B2
If BUF1=2 Then
BUF1= 0
Inc Duty
Print At 1,11," "
Print At 1,11,Dec Duty
If Duty > 254 Then
Duty = 254
Print At 1,11," "
Print At 1,11,Dec Duty
EndIf
EndIf
B2:
If BUF2 = 2 Then
BUF2 = 0
'Button SW2,0,240,100,BUF2,0,BExit
Dec Duty
Print At 1,11," "
Print At 1,11,Dec Duty
If Duty < 1 Then
Duty = 1
Print At 1,11," "
Print At 1,11,Dec Duty
EndIf
EndIf
BExit:
If SW1=0 And BUF1=0 Then
DelayUS 10
If SW1 = 0 Then
BUF1= 1
EndIf
EndIf
If SW2=0 And BUF2=0 Then
DelayUS 10
If SW2 = 0 Then
BUF2=1
EndIf
EndIf
GoTo Loop
Disable 'Butun interruptları kapat
Main_Int:
' Portb.0 int veya Timer 0 interruptlarını kontrol et
INTCON.7=0
If INTCON.1 = 1 Then
ExtInt:
'Portb.0 dan gelen interrupt
RPM=rpm+1
INTCON.1 =0
ElseIf INTCON.2 = 1 Then
'pir1 = 0
TimerInt:
'Timer dan gelen interrupt
Inc US
If US = 318 Or US=36 Or US=54 Or US=74 Then
If BUF1 = 1 Then BUF1=2
If BUF2 = 1 Then BUF2=2
EndIf
If US > 74 Then
Clear US
Inc sn
If sn>60 Then
Print At 2,6," ";
Print At 2,6,Dec RPM
Clear RPM
Clear sn
EndIf
EndIf
INTCON.2=0
EndIf
Context Restore
Resume
Enable
ben de dc motor hız kontrolü bitirme ödevi aldım bu konuda bitirme ödevi tezi elinde olan varsa paylaşabilir mi acaba ?