Guest Wolfman Posted July 26, 2004 Report Share Posted July 26, 2004 also der folgende code funzt nich kann mir jemand sagen ob ich da was falsch mache? #include <p18f452.h> #pragma romdata CONFIG _CONFIG_DECL(_CONFIG1H_DEFAULT & _OSC_HS_1H, _CONFIG2L_DEFAULT, _CONFIG2H_DEFAULT & _WDT_OFF_2H, _CONFIG3H_DEFAULT, _CONFIG4L_DEFAULT & _LVP_OFF_4L, _CONFIG5L_DEFAULT, _CONFIG5H_DEFAULT, _CONFIG6L_DEFAULT, _CONFIG6H_DEFAULT, _CONFIG7L_DEFAULT, _CONFIG7H_DEFAULT); #pragma romdata void main(void) { TRISBbits.TRISB0 = 1; TRISBbits.TRISB1 = 1; TRISBbits.TRISB2 = 0; INTCON2bits.RBPU = 0; while(1) { if(PORTBbits.RB0 == 0) { PORTBbits.RB2 = 1; }else if(PORTBbits.RB1 == 0) { PORTBbits.RB2 = 0; } } } Es soll ein led ein und auschalten und auf RB0 und RB1 sind 2 taster das komische ist das ich totall latenz zeit hab wenn ich den taster betätige und wenn ich das led ausschalte mit dem anderen taster schaltet sich das led wieder ein :( Quote Link to comment Share on other sites More sharing options...
Guest Wolfman Posted July 26, 2004 Report Share Posted July 26, 2004 My Problem in Englisch:The Source Code Above seems to work but it dont Work i use Pic18f452 and have 2 buttons and one led the first button hangs on RB0 the second on RB1,.If i press RB0 the led should go on.If i press RB1 the led should go off.Here comes the fault wenn i start the led is on and when i press RB1 the led goes off but after a little time it goes on and i dont know why :( is there a fault in my C-Code? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.