Jean-Francois Joly wrote: > I have a little program here wich generates PWM but it doesn`t > work. When I run it on my PIC16C84-04, all PORTB pins are low, > that`s all... no pulse! Can someone take the time to check it out? > (File attached to this message) I tried to find the problem, but > coudn`t! Jean-Francois: I've mde changes, marked with ">>>>>", to your code: ORG 0X000 GOTO START ORG 0X004 >>>>> change: BCF INTCON, T0IF BTFSS STAT, 0 ; Is bit 0 in STAT set? GOTO PORTON ; Turn on RBO/Stat GOTO PORTOFF ; Turn off RBO/Stat CONT RETFIE ; Return from Interrupt PORTON BSF STAT, 0 ; Set bit 0 of STAT reg BSF PORTB, 0 ; Set high pin RB0 GOTO CONT ; Go back to ISR PORTOFF BCF STAT, 0 ; Clear bit 0 of STAT reg BCF PORTB, 0 ; Set low pin RB0 >>>>> change: GOTO CONT ; Main Program Execution START CLRWDT ; Cleat Watchdog Timer BSF STATUS, RP0 ; Select Bank 1 MOVLW B'11010100' ; Set Option register MOVWF OPTION_REG ; Move values to option reg BCF STATUS, RP0 ; Select Bank 0 CLRF PORTB ; Clear PORTB BSF STATUS, RP0 ; Select Bank 1 MOVLW B'00000000' ; All pins as outputs MOVWF TRISB ; Send values to TRISB >>>>> insert: BCF STATUS,RP0 CLRF STAT ; Initialize STAT register MOVLW B'10100000' ; GIE/T0IF Set MOVWF INTCON ; Send values to INTCON reg >>>>> In its current form, the code below has no >>>>> effect on the PWM duty-cuycle or period. SETCNT MOVLW B'11111111' ; Set counter register val MOVWF COUNTER ; Move value to counter LOOP DECFSZ COUNTER, F ; Decrease Counter GOTO LOOP ; Decrease once again GOTO SETCNT ; Re initialize counter END Hope this helps... -Andy === Andrew Warren - fastfwd@ix.netcom.com === Fast Forward Engineering - Vista, California === === Did the information in this post help you? Consider === contributing to the PICLIST Fund. Details are at: === http://www.geocities.com/SiliconValley/2499/fund.html