Hallo,
ich habe mir eine kleine Controllerplatine aufgebaut mit einem
PIC18F2550.
Nun möchte ich eine LED ansteuern die am Pin RB4 liegt mit einem Taster
der am Pin RB3 liegt.
Habe dieses Programm geschrieben:
1 | #include <stdio.h>
|
2 | #include <stdlib.h>
|
3 | #include <p18f2550.h>
|
4 |
|
5 | void main() {
|
6 | int taster;
|
7 | TRISBbits.TRISB4=1;
|
8 | TRISBbits.TRISB3=0;
|
9 |
|
10 | while(1){
|
11 | taster=PORTBbits.RB4;
|
12 |
|
13 | if(taster == 1){
|
14 | LATBbits.LATB3 = 1;
|
15 |
|
16 | }else
|
17 | LATBbits.LATB3 =0;
|
18 | };
|
19 |
|
20 |
|
21 | return (0);
|
22 | }
|
Jedoch funktioniert mein vorhaben nicht.
Wäre sehr toll wenn Ihr mir helfen könntet!!
Danke schon mal im Vorraus!