1 | /*****************************
|
2 | RGB-Controller
|
3 | 02.07.02
|
4 | *****************************/
|
5 |
|
6 | #include <reg51.h>
|
7 |
|
8 | sbit r_led = P1^0; // Deklaration LED-Treiber
|
9 | sbit g_led = P1^1;
|
10 | sbit b_led = P1^2;
|
11 | sbit r_en = P1^5; // Deklaration Display-Enable
|
12 | sbit g_en = P1^4;
|
13 | sbit b_en = P1^3;
|
14 | sbit sdc = P1^6; // Deklaration Clock
|
15 | sbit sdi = P1^7; // Deklaration DataIn
|
16 | sbit r_switch1 = P3^4; // Deklaration Taster
|
17 | sbit r_switch2 = P2^7;
|
18 | sbit r_switch3 = P2^6;
|
19 | sbit g_switch1 = P2^5;
|
20 | sbit g_switch2 = P2^4;
|
21 | sbit g_switch3 = P2^3;
|
22 | sbit b_switch1 = P2^2;
|
23 | sbit b_switch2 = P2^1;
|
24 | sbit b_switch3 = P2^0;
|
25 |
|
26 | unsigned char pwm = 0; // aktueller PWM-Wert 0...+255
|
27 | unsigned char Rot = 0, Gruen = 0, Blau = 0; // LED-Helligkeit
|
28 |
|
29 |
|
30 | void signal(void)
|
31 | {
|
32 | while(1)
|
33 | {
|
34 | if(r_switch1 == 0)
|
35 | {r_led = 1;
|
36 | g_led = 1;
|
37 | b_led = 1;
|
38 | }
|
39 |
|
40 | else if(r_switch1 == 1)
|
41 | {r_led = 0;
|
42 | g_led = 0;
|
43 | b_led = 0;
|
44 | }
|
45 | }
|
46 | }
|