| ??? 02/12/04 09:16 Read: times |
#64589 - RE: Timer 2 in auto reload mode Responding to: ???'s previous message |
#include<reg320>
#include<stdio.h> unsigned char xdata out _at_ 0xE003; int stato_pin; void TIMER2 (void) interrupt 6 { TF2=0; //clear flag if(stato_pin==0){out=0x01; stato_pin=1;} else {out=0x00; stato_pin=0;} } main() { RCAP2H =(65535-23040)>>8; //~25ms RCAP2L =(65535-23040)&0xFF; TH2 = RCAP2H; TL2 = RCAP2L; T2CON = 0x80; ET2=1; //enable timer 2 interrupt TR2=1; //timer 2 start EA =1; //enable global interrupts } while(1) {} } ok....is the code complete now? |



