So ist es fehlerfrei, kann allerdings keinen rechten Sinn erkennen.
Wenn du dich später auch noch auskennen willst, dann jeden Aufruf kommentieren.
Code:#include "avrlab.h" #include "gpio.h" int press; void AvrLabInit(void); void AvrLabPoll(void); //#define SIMULATION void AvrLabInit(void){ //your code goes here PortB.DataDirection.Bit3 = DataDirectionOutput; PortB.DataDirection.Bit5 = DataDirectionInput; PortB.Output.Bit5 = 1; PortB.Output.Bit2 = 1; PortB.DataDirection.Bit2 = DataDirectionInput; } void AvrLabPoll(void) { } int main(void) //(Zeile 12 [ Gehört natürlich nicht zum skript also die Klammer]) { AvrLabInit(); while (1) { if (PortB.Input.Bit5 == 0) {press = 1;} if ((PortB.Input.Bit2 == 0) && (press == 1)) {press = 0;} if (press == 1) {PortB.Output.Bit3 = 1;} if (press == 0) {PortB.Output.Bit3 = 0;} AvrLabPoll();//must be called at least every 40 ms //muss mindestens alle 40 ms aufgerufen werden } }







Zitieren

Lesezeichen