Gast
#3985296
Hallo, ich bin grade dabei folgende Aufgabe zu loesen: Write a C Program that will read a two-bit value via Port 2.0, 2.1 when a push button is momentarily pressed. The push button is connected to Port 1.1 LEDs are connected to Port 1 bits 6 and 7. a. The routine should send a high output to Port 2 bit 6 if the value read in is greater than the last value read in. The value should remain high for approx 1 second. b. The routine should add one to a memory location SAME, when the value is equal to the previous value read in. c. The routine should send a low output to Port 1 bit 7 if it is less than the previous value read in. The light should extinguish for approximately 1 second. The routine should be initialised with the last value read in as 0, port 1.6 low and port 1.7 high. Ich habe etwas geschrieben und wuerde gerne wissen ob es einen einfacheren weg gibt. Es geht mir im wesentlichen um den kommentierten Teil. Wir benutzen microC und einen At89S8253. Der Compiler bringt keine Fehlermeldung. Leider habe ich erst wieder naechste Woche die moeglichkeit es am Board zu testen. Gibt es einen besseren weg z.B. ohne die Variable "buffer"?
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | |
25 | |
26 | |
27 | |
28 | |
29 | |
30 | |
31 | |
32 | |
33 | |
34 | |
35 | |
36 | |
37 | |
38 | |
39 | |
40 | |
41 | |
42 | |
43 | |
44 | |
45 | |
46 | |
47 | |
48 | |
49 | |
50 | |
51 | |
52 | |
53 | |