First of all, you want to thank Olin Lathrop, Wouter van Ooijen, Alan B. = Pearce and Herbert Graf for their help. I'm going to go a little deeper in my problem explanation. My task is to control a motor which makes roll the sphere (the camera is = in the sphere) left and right. The cameraman has a transmiter. When he push the = stick=20 more or less to the left, the motor must spin more or less to the left. S= ame thing=20 with stick pushed to the right of course.=20 My PIC is connected to a receiver. This receiver emits pulses according t= o the stick position. Period of the pulses : 14 ms. Lenght of the pulses : from= 0.9 ms (stick max left, motor max spinning left) to 2.1 ms (stick max right, mot= or max spinning right). Stick at neutral position : 1.5 ms (motor doesn't spin). My PIC must measure these pulses (1=B5s precision).=20 If pulse equals 0.9 ms -> PIC emits a pulse which last 90% of its period = on CPP1 If pulse equals 2.1 ms -> PIC emits a pulse which last 90% of its period = on CPP2 If pulse equals 1.5 ms -> PIC emits nothing The period of the output signal is a parameter. Furthermore, there is a regulation loop which also measure the spinning s= peed of the motor thanks to the current it produces, but this part works well. I have also to include the values of the accelerometer and the gyro in th= e regulation loop, but it's not yet done.=20 To summarize the all things, we can say that the input signal is amplifie= d=20 and it is output on CPP1 or CPP2. Because of the amplification, which=20 can be up to 100 x, the measure must be accurate at 1 =B5s. When I arrived at the company two month ago, I hadn't ever worked with=20 a microcontroler and I was reponsible for choosing the microcontroler. I spended several days looking for informations on the Internet. I finall= y found a very well done tutorial (more than 700 pages in french !) about PIC's.=20 It is focused on the 16F84 and 16F877. So I decided to buy a 16F877 for my first try with microcontrolers. I heard about the 18 family, but I was a little affraid to start with the most advanced one. But now, my question is : \"Should I migrate to 18 family ?\". Allan B. Pearce said there is two level of interrupts. I think it's exactly what I need : an interrupt that measures the edges of my input signal at top priority. The timing of the output signals is less critical. Is migration a hard step ? Will it take much time ? I have 1 month and a = half left to maybe migrate, integrate the gyro and the accelerometer in the re= gulation loop and program something to change some parameters on the field (that's= why the company is interrested in making this task with a microcontroler : th= e possibility to configure the behavior of the automatic horizon when they want). And a last question : \"Is LVP still possible with 18 family ?\" The company doesn't own a programming device. With the engineer's help, I realized the Byron Jeff's TLVP. I use the software FPP. Will we have to buy a programming device ? So, ... thanks for reading this message, and sorry for this endless story I'm looking forward your advices=20 Laurent Haniken (Below, my first message) -------------------------------------------------------------------------= -- 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=20 is in a remotily controled helicopter (www.flying-cam.com).=20 I studied Intel assembly at school, but I've never learned how to=20 program a microcontroler. So I looked for help and tutorials on the=20 Internet. I'm working with PIC's since only two months.=20 I'm currently coding my automatic horizon software on a PIC16F877=20 and I have some real time problems. I'll try explain that clearly.=20 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=20 result in the form of an other PWM signal.=20 I must measure the input signal with 1 =B5s precision.=20 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.=20 TMR2 is used to generate the frequency of the output=20 signal. The problem is that RBI interrupt can occur while=20 executing the tmr2 interrupt code, and the measure of=20 the input signal will be faulty because the RBI does not=20 react immediately. So I've used nested=20 interrupts with a software stack (I found this method in the piclist=20 source code library), but there is always a=20 part of the code where interrupts are disabled.=20 [Update] I use the two CPP to output signals. These signals are used to make spinning a motor. The motor have to spin in the two ways, so when the motor have to spin left, I use CPP1, and when it have to spin right, I use CPP2 Does anybody has an idea to make this measure accurately ?=20 Thanks a lot for your help.=20 =20 -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics