| ??? 02/11/04 19:01 Read: times |
#64517 - Timer 2 in auto reload mode |
Hi,
Sorry for my English I want to generate a pwm. I use timer 2 with 16 bit in autoreload mode only. for the moment I want blink a led. #include<reg320> #include<stdio.h> unsigned char xdata out _at_ 0xE003; int stato_pin; void TIMER2 (void) interrupt 6 { if(stato_pin==0){out=0x01; stato_pin=1;} else {out=0x00; stato_pin=0;} TF2=0; //clear flag } main() { RCAP2H=... //reload 16384 RCAP2L= ET2=1; //enable timer 2 interrupt TR2=1; //timer 2 start EA =1; //enable global interrupts } while(1) {} } I know the code isn't complete. Timer count to 65535 but I want the timer begin count, for example, at 16384=2^14. Can somebody complete my code please and explain what wrong. xtal=11.059 Mhz thank bye. |



