نوشته اصلی توسط
سنجری
در مورد مطلبی که در بالا در مورد زیر برنامه وبازگشت آ ن مدار و شماتیک و برنامه بسکام آن را قرار دادم. در این برنامه ،وقتی برنامه sp به دستور GoTo WS میرسد ، به زیر برنامه Ws رفته وکار برنامه WS به پایان میرسد،ولی با اینکه دستور Return وجود دارد .به سطری که پرش از آنجا صورت گرفته بود بر نمی گردد--یعنی GoTo WS __
$regfile = "m16def.dat"
$crystal = 8000000
Config Porta = Input
Config Portc = Output
Config Portb.7 = Output
Config Portb.6 = Output
Config Portd.0 = Output
Config Portd.1 = Output
Config Portd.2 = Output
Config Portd.4 = Output
Config Portd.5 = Output
Config Pind.6 = Input
Config Pind.7 = Input
Dim M As Integer
Dim D As Integer
Dim Crl As Integer
Dim P As Integer
Dim I As Integer
Config Lcdpin = Pin , Db4 = Portb.0 , Db5 = Portb.1 , Db6 = Portb.2 , _
Db7 = Portb.3 , E = Portb.4 , Rs = Portb.5
Config Lcd = 16 * 2
Config Debounce = 5
Start1:
P = 1
D = 0
Do
Debounce Pina.0 , 1 , Power1 , Sub
Debounce Pina.1 , 1 , Play.pause , Sub
Debounce Pina.2 , 1 , Sp , Sub
Debounce Pina.3 , 1 , Dct , Sub
Debounce Pina.4 , 1 , Snt , Sub
Debounce Pina.5 , 1 , Cot , Sub
Debounce Pina.6 , 1 , Wl , Sub
Debounce Pina.7 , 1 , Q W , Sub
Loop
End
Power1:
If P = 1 Then
Set Portb.7 'led power is on
P = 0
Cls
Lcd "select program"
Else
Cls
Reset Portc
Reset Portd.0
Reset Pinb.7
P = 1
End If
Return
Play.pause:
If M = 0 Then
D = 1
Else
D = 0
End If
M = 1
Return
Sp:
If P = 0 Then
Cls
Lcd "sp"
Set Portd.0
Crl = 6
Goto Ws
Cls
Lcd "end"
End If
Return
Ws:
Reset Portc
While Crl > 0
Set Portc.2
Waitms 100
Reset Portc.2
Waitms 100
Set Portc.3
Set Portc.2
Waitms 100
Reset Portc.2
Reset Portc.3
Waitms 100
Crl = Crl - 1
Lcd Crl
Wend
Return