Hallo
Ich habe ein Programm geschrieben das nicht funktioniert.
Ich will das eine LED leuchtet wenn das Poti weniger als die Hälfte
aufgedreht ist sonst soll die LED nicht leuchten.
Ich verwende den dsPIC33FJ256MC710A, das dsPICDEM MCLV Development
Board, als Software MPLAB X IDE und als Compiler den PCD Compiler von
CCS.
Könnte mir bitte wer sagen wo der Fehler liegt?
1 | #include <33FJ256MC710A.h>
|
2 | #include <stdio.h>
|
3 | #include <stdlib.h>
|
4 |
|
5 | #fuses XT,NOWDT
|
6 | #use delay(clock=8000000)
|
7 |
|
8 | #define LED PIN_E1
|
9 |
|
10 | void main()
|
11 | {
|
12 | set_tris_e(0);
|
13 | int16 x;
|
14 | setup_adc_ports(sAN8);
|
15 | setup_adc(ADC_CLOCK_DIV_8);
|
16 | set_adc_channel(0);
|
17 | delay_us(20);
|
18 | read_adc();
|
19 |
|
20 | while(1)
|
21 | {
|
22 | x=read_adc();
|
23 | if(x<0.5)
|
24 | {
|
25 | output_high(LED);
|
26 | }
|
27 | else
|
28 | {
|
29 | output_low(LED);
|
30 | }
|
31 | }
|
32 | }
|
lg
Thomas