shaolinyo
Newbie level 6
Help PIC16f877A start adc reading at spesific time using timer0 interrupt
hello , used timer0 interrupt to start reading adc , but it not work when i debug the code , i see that the interruption never occur
thank you
hello , used timer0 interrupt to start reading adc , but it not work when i debug the code , i see that the interruption never occur
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 int t=0; //time counter void interrupt() { if(INTCON.T0IF){ t++; //for evry inettruption occure we increment t TMR0=150;//the value to start the tmr0 if is spesified in the main program } INTCON.T0IF=0; } float i; float data1; char txt[20]; void main() { Option_Reg=0b10010000; INTCON=0b10100000; trisd=0; portd=0; TMR0=150; i=0; data1=0 ; lcd_init(); ADC_Init(); for(;;){ if(t==1) { i=ADC_Read(0); data1=i/(1023/5); } } }
thank you
Last edited by a moderator: