Gast
#5289719
Hallo zusammen. Ich will verschiedene PWM Signale mit einem PIC18F erzeugen. Aber wenn ich das Code auf mein PIC hochlade, dann kriege ich keine Signal raus.. mein Code sieht so aus: #include <p18f2525.h> #include <xc.h> #include <timers.h> #include <stdlib.h> void main(void) { unsigned char time = 0; TRISBbits.RB4 = 0; // Make the PORTB as Output LATB4 = 1; // Set PORTB HIGH /* Configure TIMER0 : * * Timer interrupt on * Set timer 16 bit * Source Edge HIGH-TO-LOW * Clock Source Intern * setting prescalar 256 */ OpenTimer0(TIMER_INT_ON & T0_16BIT & T0_EDGE_RISE & T0_SOURCE_INT & T0_PS_1_256); // Load starting value to the timer 0 WriteTimer0(0XE17B); // 1s // Reset Interrupt Flag INTCONbits.TMR0IF = 1; // Enable Global Interrupt ei(); while(1){ } //CloseTimer0(); return; } // Interrupt Service Routine void interrupt interruptTimer0Overflow(){ di(); // Disable Interrupt if(INTCONbits.INT0F == 1) // When TIMER0 Overflow { LATB4 = ~LATB4; INTCONbits.TMR0IF = 0; // Clear the TIMER0 Interrupt Flag WriteTimer0(0XE17B); // Load the timer Value } ei(); // Enable Interrupt }
