Hey Bitmaniac,
You could try using a 20ms interrupt, and start your pulsout on interrupt. That would make things more consistent, and probably keep your motor controller happy.
Hey Bitmaniac,
You could try using a 20ms interrupt, and start your pulsout on interrupt. That would make things more consistent, and probably keep your motor controller happy.
Hey Bitmaniac,
I was thinking this use of interrupts would probably keep things happy as far as motor controllers. It may need some more work though, and I still have to test it on a motor control.
http://www.picbasic.co.uk/forum/show...3834#post83834
Walter
Well, Scalerobotics , Alain and others
May be we could give this aproach a try and see...
So let's sum up what I have tried so far:
1st just 12f683 -> 10bit ADC cannot do any MPX4115 useful calculations!
2nd 12f683 + LM358 op-amp for 'window-range' method -> clever idea but I think we may have erratic behavour as op-amp temp drift!
3rd 12f683 DT 14 bit oversampling method very good idea and increased resolution but delay issues with servo pass-through routines.
4th 12f683 + MAX187 12bit ADC (increased resolution-not as bad as internal 10bit and not as good as oversampling method) and interrupts for servo 'pass-trhough' LET's try it
Now I ended up in using a 12f683 internal osc (4MHz) + MAX187 so we have free interrupt sources and speed to try other methods.Also note that I have tried also with internal and external crystals and keep in-mind that I have already TMR1 running for the moment to keep track of 30sec. passing time.
Maybe I think somehow wrong / or weird for any of the above ideas ,please feel free to express your method / comments
Alain (Acetronics) some time ago , already gave a great idea for a completely different approach to the whole project, using an external DAC (NOT ADC!) to set the Vref of the pic internal 10bit adc so we 'narrow' the measurements of MPX to a resonable amount
This has also to be tried!!!
(P.S:For the moment I have a PIC ethernet project open.... in the same time)
Last edited by bitmaniac; - 29th January 2010 at 12:58.
Hey Alexandros,
Certainly lots of methods to try. I am sure that Alain's method would work just fine. I just like the idea of interrupts, and using fewer components. And besides, I am learning a lot about interrupts and timers in the process, so that is good!
And for your 30 seconds: Since it is using a time base of 20ms on timer2, you could easily add a counter in that interrupt handler. And when it reached 1500, that is 30 seconds.
I will try adding the ADC oversample into it, and let you know how it goes. But my motor controller is taking kindly to it, and accepting it's pulses.
Well a little bit of experiment with my last hardware : 12f683 , max187 12bit ADC , 4 Mhz Int osc. Servo attached instead of SC working ok (a little bit jerky -but acceptable) BUT when I connect SC it works only once at the begining when you plug the battery in.
So, after a little notice THE OBVIOUS THING CAME IN MY MIND!!
Of course there is a problem meanwhile with the SC , as soon as I 'break' for the first time just to to jump to my motor pre-check routine afterwards SC accepts no pulses at all for a period of time. So when I come back to re-activate the motor last position SC does not arm . It must go to arm procedure first (throttle low) and then it accepts signals!
So, the only way we can go is WITH interrupts just to keep the pulsout routine alive!
So obvious ......
Hi, Alex
Interrupts ... ok, nice idea, ... but it will surely interfere with your INPUT Pulsin ....
hé,hé ... you said " Aaaargh !!! " ???
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
If you go to interrupts, you will not need any pulsin, or pulsout. There are a couple ways to input multiple channels for pulse width measurement. You could either make an interrupt on change on GPIO port, then poll the pins for change, or ....
tie both outputs of the receiver together, and connect them to the CPP1 pin. Only one will pulse at a time (on most rc receivers), so you will be able to read one at a time, even though they are connected together.
One thing I am not sure about is if there is enough time between pulses to read adjacent channels. Have not tried that yet. But channels that are separated by one channel, like 1 and 3, etc would be easy. Hard part would be telling channels from each other. For this, you could place an input on one of the in between channels to mark which pulse width you would be measuring next.
Or, make a multiplexing switch that switches between the throttle, and the on/off switch, and have those go to the same CCP1 pin.
Bookmarks