Interrupts richtig verwenden

Gast #696910
Lesenswert?
• ▲
▼
Port-Interrupts sind i.A. flanken- und nicht zustandsgetriggert.
Also Portd.0 IRQ auf steigende UND fallende Flanke triggern lassen, in 
der ISR dann den Pegel feststellen, entsprechendes Flag setzen (Prog 
1/2) und in Deiner main() dann aufgrund des Flags Prog 1/2 ausführen, 
ferdich!
Gast #696920
Lesenswert?
• ▲
▼
ok, ich möchte diese 2 Programmen Verknüpfen
Wenn pind.0 low ist, soll das programm 1 ausgeführt werden (pinp.0 high 
, dann das zweite)

Programm1:
1
Cls
2
Cursor Off
3

4
Dim Gray As Word
5
Dim Lobyte As Word
6
Dim Hibyte As Word
7
Locate 1 , 1
8
Lcd "P.G.Tester(GRAY)"
9
Locate 4 , 1
10
Lcd "Ausbildung EGS05"
11
Locate 2 , 5
12
Lcd "*-"
13
Locate 2 , 10
14
Lcd "-*"
15
Locate 3 , 3
16
Lcd "------------"
17

18
Do
19
Lobyte = Pina
20
Hibyte = Pinc
21
Hibyte = Hibyte And &B0000000000001111
22
Rotate Hibyte , Left , 8
23

24
Gray = Lobyte + Hibyte
25
Gray = Gray2bin(gray)
26

27
Locate 2 , 7
28
Lcd Gray
29

30
Waitms 200
31
Locate 2 , 7
32
Lcd "   "
33
Loop
34
End


Programm2
1
Cls
2
Cursor Off
3

4
Dim Lobyte As Word
5
Dim Hibyte As Word
6
Dim Code2 As Byte
7

8
Locate 1 , 1
9
Lcd "P.G.Tester(BCD)"
10
Locate 4 , 1
11
Lcd "Ausbildung EGS05"
12
Locate 2 , 5
13
Lcd "*-"
14
Locate 2 , 10
15
Lcd "-*"
16
Locate 3 , 3
17
Lcd "------------"
18

19
Do
20
Lobyte = Pina
21
Hibyte = Pinc
22
Hibyte = Hibyte And &B0000000000001111
23
Rotate Hibyte , Left , 8
24
Code2 = Lobyte + Hibyte
25
Locate 2 , 7
26
Lcd Code2
27

28
Waitms 200
29
Locate 2 , 7
30
Lcd "   "
31
Loop
32
End

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren