
اگه میشه راهنمایی کنید به جای ولوم و دیپ سوییچ push bottom بزارم
اینم سورس بسکام
-----------------------------------------------
$regfile = "M8def.dat"
$crystal = 1000000
Config Portd = Output
Config Portb = Input
Config Adc = Single , Prescaler = Auto , Reference = Internal
Dim X_time As Word
Dim A As Byte
Dim B As Byte
Dim C As Byte
Dim D As Byte
Dim E As Byte
Dim F As Byte
Dim G As Byte
Dim H As Byte
Dim I As Byte
Dim T1 As Byte
Dim T2 As Byte
Do
'******************************
'******************************
If Pinb.0 = 1 Then
For A = 0 To 3
X_time = Getadc(0)
Portd = &B00000001 : Waitms X_time
Portd = &B00000010 : Waitms X_time
Portd = &B00000100 : Waitms X_time
Next A : End If
'******************************
'******************************
If Pinb.1 = 1 Then
For B = 0 To 3
X_time = Getadc(0)
Portd = &B00000011 : Waitms X_time
Portd = &B00000110 : Waitms X_time
Portd = &B00000101 : Waitms X_time
Next B : End If
'******************************
'******************************
If Pinb.2 = 1 Then
For C = 0 To 3
X_time = Getadc(0)
Portd = &B00000001 : Waitms X_time
Portd = &B00000011 : Waitms X_time
Portd = &B00000111 : Waitms X_time
Portd = &B00000000 : Waitms X_time
Next C : End If
'******************************
'******************************
If Pinb.3 = 1 Then
For D = 0 To 3
X_time = Getadc(0)
Portd = &B00000001 : Waitms X_time
Portd = &B00000011 : Waitms X_time
Portd = &B00000111 : Waitms X_time
Portd = &B00000011 : Waitms X_time
Portd = &B00000001 : Waitms X_time
Portd = &B00000000 : Waitms X_time
Next : End If
'******************************
'******************************
If Pinb.4 = 1 Then
For E = 0 To 3
X_time = Getadc(0)
Portd = &B00000110 : Waitms X_time
Portd = &B00000101 : Waitms X_time
Portd = &B00000011 : Waitms X_time
Next E : End If
'******************************
'******************************
If Pinb.5 = 1 Then
For E = 0 To 3
X_time = Getadc(0)
Portd = &B00000111 : Waitms X_time
Portd = &B00000000 : Waitms X_time
Next E : End If
'******************************
'******************************
If Pinb.6 = 1 Then
For H = 0 To 3
F = 0
G = 100
For T1 = 0 To 100
For T2 = 0 To F
Set Portd.0
Set Portd.1
Set Portd.2
Set Portd.3
Set Portd.4
Set Portd.5
Set Portd.6
Set Portd.7
Waitus 95
'----
Next T2
For T2 = 0 To G
Reset Portd.0
Reset Portd.1
Reset Portd.2
Reset Portd.3
Reset Portd.4
Reset Portd.5
Reset Portd.6
Reset Portd.7
Waitus 95
'----
Next T2
F = F + 1
G = G - 1
Next T1
F = 0
G = 100
'******************
For T1 = 0 To 100
For T2 = 0 To G
Set Portd.0
Set Portd.1
Set Portd.2
Waitus 95
'----
Next T2
For T2 = 0 To F
Reset Portd.0
Reset Portd.1
Reset Portd.2
Waitus 95
'----
Next T2
F = F + 1
G = G - 1
Next T1
Next H
End If
'**********************************
'**********************************
'**********************************
If Pinb.7 = 1 Then
'1 led
For I = 0 To 3
F = 0
G = 100
For T1 = 0 To 100
For T2 = 0 To F
Set Portd.0
Waitus 95
'----
Next T2
For T2 = 0 To G
Reset Portd.0
Waitus 95
'----
Next T2
F = F + 1
G = G - 1
Next T1
F = 0
G = 100
'******************
For T1 = 0 To 100
For T2 = 0 To G
Set Portd.0
Waitus 95
'----
Next T2
For T2 = 0 To F
Reset Portd.0
Waitus 95
'----
Next T2
F = F + 1
G = G - 1
Next T1
'Next I
'2 led
'For I = 0 To 3
F = 0
G = 100
For T1 = 0 To 100
For T2 = 0 To F
Set Portd.1
Waitus 95
'----
Next T2
For T2 = 0 To G
Reset Portd.1
Waitus 95
'----
Next T2
F = F + 1
G = G - 1
Next T1
F = 0
G = 100
'******************
For T1 = 0 To 100
For T2 = 0 To G
Set Portd.1
Waitus 95
'----
Next T2
For T2 = 0 To F
Reset Portd.1
Waitus 95
'----
Next T2
F = F + 1
G = G - 1
Next T1
'Next I
'3 led
'For I = 0 To 3
F = 0
G = 100
For T1 = 0 To 100
For T2 = 0 To F
Set Portd.2
Waitus 95
'----
Next T2
For T2 = 0 To G
Reset Portd.2
Waitus 95
'----
Next T2
F = F + 1
G = G - 1
Next T1
F = 0
G = 100
'******************
For T1 = 0 To 100
For T2 = 0 To G
Set Portd.2
Waitus 95
'----
Next T2
For T2 = 0 To F
Reset Portd.2
Waitus 95
'----
Next T2
F = F + 1
G = G - 1
Next T1
Next I
End If
'**********************************
Loop
End
$regfile = "M8def.dat"
$crystal = 1000000
Config Portd = Output
Config Portb = Input
Config Adc = Single , Prescaler = Auto , Reference = Internal
Dim X_time As Word
Dim A As Byte
Dim B As Byte
Dim C As Byte
Dim D As Byte
Dim E As Byte
Dim F As Byte
Dim G As Byte
Dim H As Byte
Dim I As Byte
Dim T1 As Byte
Dim T2 As Byte
Do
'******************************
'******************************
If Pinb.0 = 1 Then
For A = 0 To 3
X_time = Getadc(0)
Portd = &B00000001 : Waitms X_time
Portd = &B00000010 : Waitms X_time
Portd = &B00000100 : Waitms X_time
Next A : End If
'******************************
'******************************
If Pinb.1 = 1 Then
For B = 0 To 3
X_time = Getadc(0)
Portd = &B00000011 : Waitms X_time
Portd = &B00000110 : Waitms X_time
Portd = &B00000101 : Waitms X_time
Next B : End If
'******************************
'******************************
If Pinb.2 = 1 Then
For C = 0 To 3
X_time = Getadc(0)
Portd = &B00000001 : Waitms X_time
Portd = &B00000011 : Waitms X_time
Portd = &B00000111 : Waitms X_time
Portd = &B00000000 : Waitms X_time
Next C : End If
'******************************
'******************************
If Pinb.3 = 1 Then
For D = 0 To 3
X_time = Getadc(0)
Portd = &B00000001 : Waitms X_time
Portd = &B00000011 : Waitms X_time
Portd = &B00000111 : Waitms X_time
Portd = &B00000011 : Waitms X_time
Portd = &B00000001 : Waitms X_time
Portd = &B00000000 : Waitms X_time
Next : End If
'******************************
'******************************
If Pinb.4 = 1 Then
For E = 0 To 3
X_time = Getadc(0)
Portd = &B00000110 : Waitms X_time
Portd = &B00000101 : Waitms X_time
Portd = &B00000011 : Waitms X_time
Next E : End If
'******************************
'******************************
If Pinb.5 = 1 Then
For E = 0 To 3
X_time = Getadc(0)
Portd = &B00000111 : Waitms X_time
Portd = &B00000000 : Waitms X_time
Next E : End If
'******************************
'******************************
If Pinb.6 = 1 Then
For H = 0 To 3
F = 0
G = 100
For T1 = 0 To 100
For T2 = 0 To F
Set Portd.0
Set Portd.1
Set Portd.2
Set Portd.3
Set Portd.4
Set Portd.5
Set Portd.6
Set Portd.7
Waitus 95
'----
Next T2
For T2 = 0 To G
Reset Portd.0
Reset Portd.1
Reset Portd.2
Reset Portd.3
Reset Portd.4
Reset Portd.5
Reset Portd.6
Reset Portd.7
Waitus 95
'----
Next T2
F = F + 1
G = G - 1
Next T1
F = 0
G = 100
'******************
For T1 = 0 To 100
For T2 = 0 To G
Set Portd.0
Set Portd.1
Set Portd.2
Waitus 95
'----
Next T2
For T2 = 0 To F
Reset Portd.0
Reset Portd.1
Reset Portd.2
Waitus 95
'----
Next T2
F = F + 1
G = G - 1
Next T1
Next H
End If
'**********************************
'**********************************
'**********************************
If Pinb.7 = 1 Then
'1 led
For I = 0 To 3
F = 0
G = 100
For T1 = 0 To 100
For T2 = 0 To F
Set Portd.0
Waitus 95
'----
Next T2
For T2 = 0 To G
Reset Portd.0
Waitus 95
'----
Next T2
F = F + 1
G = G - 1
Next T1
F = 0
G = 100
'******************
For T1 = 0 To 100
For T2 = 0 To G
Set Portd.0
Waitus 95
'----
Next T2
For T2 = 0 To F
Reset Portd.0
Waitus 95
'----
Next T2
F = F + 1
G = G - 1
Next T1
'Next I
'2 led
'For I = 0 To 3
F = 0
G = 100
For T1 = 0 To 100
For T2 = 0 To F
Set Portd.1
Waitus 95
'----
Next T2
For T2 = 0 To G
Reset Portd.1
Waitus 95
'----
Next T2
F = F + 1
G = G - 1
Next T1
F = 0
G = 100
'******************
For T1 = 0 To 100
For T2 = 0 To G
Set Portd.1
Waitus 95
'----
Next T2
For T2 = 0 To F
Reset Portd.1
Waitus 95
'----
Next T2
F = F + 1
G = G - 1
Next T1
'Next I
'3 led
'For I = 0 To 3
F = 0
G = 100
For T1 = 0 To 100
For T2 = 0 To F
Set Portd.2
Waitus 95
'----
Next T2
For T2 = 0 To G
Reset Portd.2
Waitus 95
'----
Next T2
F = F + 1
G = G - 1
Next T1
F = 0
G = 100
'******************
For T1 = 0 To 100
For T2 = 0 To G
Set Portd.2
Waitus 95
'----
Next T2
For T2 = 0 To F
Reset Portd.2
Waitus 95
'----
Next T2
F = F + 1
G = G - 1
Next T1
Next I
End If
'**********************************
Loop
End
دیدگاه