| ??? 12/04/02 11:16 Read: times |
#33744 - RE: Problem with reading timers |
I tried to make it static, but it didn't work either, I know you guys won't like me doing this, but here is all of my code...I'm really out of ideas.
/******* Main Project File ********************************/ #include <math.h> #include "my_stddefs.h" #include "user_functions.h" #include <stdio.h> _rom char userbytes[32] _at (0xFCE0)="ADV.LIGHTCONTROLLED BETA v1.1"; extern void T1_Init(void); extern void T0_Init(void); #pragma smart_switch volatile int teller,time,timeh,gem[11]; static teller2=0; void main(void) { WDRST=0x1E; WDRST=0xE1; WDCON=0x13; teller=99; P0M1=0x38; P0M2=0xA7; P1M1=0x1C; P1M2=0xDF; T1_Init(); EA=ENABLE; EX1=DISABLE; P1_6=0; P1_7=0; time=1; timeh=1; gem[0]=0; T0_Init(); while(1) { WDRST=0x1E; WDRST=0xE1; if(teller2>20&&teller2<25) gem[0]=(gem[5]+gem[6]+gem[7]+gem[8]+gem[9])/5; if (teller2>200) teller2=0; if(teller2>25&&time<gem[0]) { while(1) { TR0=0; EX1=DISABLE; ET1=DISABLE; ET0=DISABLE; P0_0=0; P0_1=1; WDRST=0x1E; WDRST=0xE1; } } } } void Knipper(void) { teller2++; if (teller2<100) { TR0=1; teller=0; EX1=ENABLE; IT1=ENABLE; P1_6=1; P1_7=1; P0_1=0; P0_0=0; } } _interrupt(2) _using(2) void Meet(void) { TR0=0; time=(TL0+(256*TH0)); TL0=0; TH0=0; TR0=1; P0_1=1; P0_0=1; if((teller2<20)&&(teller2>14)) gem[teller2-10]=time; P1_7=0; P1_6=0; while((TL0!=0)&&(TH0!=0)) { WDRST=0x1E; WDRST=0xE1; } TR0=0; } When P0_0 and P0_1 are made active, as a result the ext1 interrupt will occur. I have to determine the time that goes by until the interrupt occurs. Probably the structure of my program isn't right, as I said I'm a newbie...so any advice is welcome |



