asp1987
New Member
Hi,
I was going through Nigel's tutorial on PWM. He has set the prescaler and postscaler as 16 and 1 resp. by writing to T2CON in 'two' steps. Is that any standard way of writing to the same register? Couldn't find any such statements in 16F877A datasheet.
I was going through Nigel's tutorial on PWM. He has set the prescaler and postscaler as 16 and 1 resp. by writing to T2CON in 'two' steps. Is that any standard way of writing to the same register? Couldn't find any such statements in 16F877A datasheet.
Code:
MOVF T2CON,W ;set prescaler to 16
ANDLW 0xF8 ;PWM at 2500HZ
IORLW 0x02
MOVWF T2CON
MOVF T2CON,W ;set postscaler to 1
ANDLW 0x07
IORLW 0x00
MOVWF T2CON