Hi Jinx, PWM_DIFF and then also PWM_Temp wil change before entering the subroutine. It wil change from 0x00 to 0xFF Harry > -----Oorspronkelijk bericht----- > Van: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] > Namens Jinx > Verzonden: zondag 11 januari 2009 23:48 > Aan: Microcontroller discussion list - Public. > Onderwerp: Re: [PIC] Preapering CCP1CON register for PWM > > > ; CCP1CON = 0b 0111 1100 > > > ; At this point the value of CCP1_Temp = 0b 0001 0000 > > > ; iorlw b'11001111' > > ; iorwf CCP1CON, f ; Mask with the changes > > > ; And CCP1CON should become 0b0101 1100 > > > movwf CCP1CON ; and rewrite the new value > > Harry, it seems to me that CCP1CON will never change from > 0111 1100 to 0101 1100. The bit you want to change, bit5, > doesn't appear in the CCP1_Temp mask > > rrf CCP1_Temp ; Do this always to > rrf CCP1_Temp ; prepare the CCP!CON mask > rrf CCP1_Temp ; afterwards > > Too far ? > > What would help are comments explaining why the instructions > are used, and in detail what the function of the routine is. > For example, in these three lines, I can see what's > happening, but don't know why > > bcf STATUS, C ; Clear C flag > rrf PWM_Temp ; Move LSB:0 out > rrf CCP1_Temp ; And save it > > As for the banking, according to the .inc file all of those > CCP registers are in bank 0, so as long as you're entering > the routine in bank0 that should be OK > > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist