Hello =20 I'm a student in computer science in Belgium and it is my last year of st= udy.=20 My thesis consists in realising an automatic horizon for a camera which is in a remotily controled helicopter (www.flying-cam.com). =20 I studied Intel assembly at school, but I've never learned how to program a microcontroler. So I looked for help and tutorials on the Internet. I'm working with PIC's since only two months. I'm currently coding my automatic horizon software on a PIC16F877 and I have some real time problems. I'll try explain that clearly. My PIC must measure a PWM signal in input, then it computes this value=20 with values from captors (accelerometer and gyro), finaly it outputs the result in the form of an other PWM signal.=20 =20 I must measure the input signal with 1 =B5s precision. I use the RBIF interrupt to detect the edges of the input signal,=20 timer 0 to measure the lenght of the signal. I use timer 1 with the CPP=20 to output the result signal. TMR2 is used to generate the frequency of the output signal. The problem is that RBI interrupt can occur while=20 executing the tmr2 interrupt code, and the measure of the input signal will be faulty because the RBI does not react immediately. So I've used nested=20 interrupts with a software stack (I found this method in the piclist source code library), but there is always a part of the code where interrupts are disabled. =20 Does anybody has an idea to make this measure accurately ? Thanks a lot for your help. Laurent NB : I'm french speaking, so I hope I haven't made too much mistakes in English -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads