Hallo,
Ich möchte einem Taster nach einer bestimmten Zeit Abgefragt wird d.h.
dass wenn der Taster unter 1,5 Sekunden gedrückt wird soll der Ausgang
Ausgeschaltet wird wenn er über 1,5 Sekunden gedrückt wird soll Portb.0
eingeschaltet werden und Portb.1 so lange eingeschaltet werden wie auch
der Taster gedrückt wird.
1 | $regfile = "2313def.dat"
|
2 | $crystal = 400000
|
3 |
|
4 | Config Portb.0 = Output 'Relais1
|
5 | Config Portb.1 = Output 'Relais2
|
6 | Config Portb.3 = Input 'Taster
|
7 | Config Portb.4 = Output 'LED
|
8 | Portb.3 = 1
|
9 | Portb.4 = 1
|
10 | Waitms 500
|
11 | Portb.4 = 0
|
12 | Waitms 500
|
13 | Portb.4 = 1
|
14 | Waitms 500
|
15 | Portb.4 = 0
|
16 |
|
17 | Main:
|
18 |
|
19 | If Pinb.3 = 1 Then
|
20 | Waitms 1500
|
21 | If Pinb.3 = 0 Then
|
22 | Portb.0 = 0
|
23 | Portb.1 = 0
|
24 | Goto Main
|
25 | End If
|
26 | Waitms 3000
|
27 | Portb.0 = 1
|
28 | Taster:
|
29 | If Pinb.3 = 1 Then
|
30 | Portb.1 = 1
|
31 | Goto Taster
|
32 | Else
|
33 | Portb.1 = 0
|
34 | Goto Main
|
35 | End If
|
36 | Else
|
37 | Goto Main
|
38 | End If
|
Ich hoffe ihr wisst was ich meine :)
MFG