Sorry, ich war der Meinung, die wichtigen Snippets gepostet zu haben.
Code:processor 16F685 #include <P16F685.INC> __config (_INTOSCIO & _WDT_OFF & _PWRTE_ON) org 0 init: banksel OSCCON MOVLW B'01110001' MOVWF OSCCON MOVLW B'00000000' ; Ports C output MOVWF TRISC MOVLW 0x3f ; Pulsweite 255 MOVWF PR2 BCF STATUS, RP0 ; Bank 0 MOVLW 0x00 MOVWF 0x70 ; Startwert Pulsweite = 0 MOVWF CCPR1L ; Pulsweite MSB = 0 MOVLW B'00001100' ; Pulsweite LSB = 0 ; Schalte CCP auf PWM MOVWF CCP1CON BCF PIR1, TMR2IF ; Interruptflag von Timer 2 löschen MOVLW 0x04 MOVWF T2CON ; Timer 2 on, Vorteiler = 1 PROGRAM_LOOP: NOP CALL LED_RC0_ON CALL LED_RC1_ON CALL PAUSE_1_SEK CALL LED_RC0_OFF CALL LED_RC1_OFF CALL PAUSE_1_SEK GOTO PROGRAM_LOOP PAUSE_1_SEK: BSF STATUS, RP0 ; Bank 1 BCF STATUS, RP1 CLRF 0xa0 CLRF 0xa1 MOVLW 0x0f ; Zähler 15 mal bis 0xffff MOVWF 0xa2 LOOP_PAUSE_1S: DECFSZ 0xa0, 1 GOTO LOOP_PAUSE_1S NOP DECFSZ 0xa1, 1 GOTO LOOP_PAUSE_1S DECFSZ 0xa2, 1 GOTO LOOP_PAUSE_1S RETURN LED_RC0_ON: banksel PORTC BSF PORTC, 0 RETURN LED_RC1_ON: banksel PORTC BSF PORTC, 1 RETURN LED_RC0_OFF: banksel PORTC BCF PORTC, 0 RETURN LED_RC1_OFF: banksel PORTC BCF PORTC, 1 RETURN end







Zitieren

Lesezeichen