MPXA4115A picbasic code


Closed Thread
Results 1 to 40 of 104

Hybrid View

  1. #1
    Join Date
    Jan 2004
    Location
    Thessaloniki , GREECE
    Posts
    61


    Did you find this post helpful? Yes | No

    Default maybe interrupt is the way to go

    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 11:58.

  2. #2
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by bitmaniac View Post
    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.

    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!!!
    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.

  3. #3
    Join Date
    Jan 2004
    Location
    Thessaloniki , GREECE
    Posts
    61


    Did you find this post helpful? Yes | No

    Default

    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 ......

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Unhappy

    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 " !!!
    *****************************************

  5. #5
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Interrupts ... ok, nice idea, ... but it will surely interfere with your INPUT Pulsin ....
    Alain
    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.

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Talking

    Hi,

    If you want to give a try ...

    with " classical " receivers ( CMOS 4015/4017/HC164/NE5045 decoders ) you have ...

    15 ns ... as a " mark pulse " ...

    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 " !!!
    *****************************************

  7. #7
    Join Date
    Jan 2004
    Location
    Thessaloniki , GREECE
    Posts
    61


    Did you find this post helpful? Yes | No

    Default

    ... or maybe using HPWM for pulsout ? to keep SC alive all the time!

Similar Threads

  1. sample code for AT45DB642D in Picbasic Pro
    By itsssyam in forum General
    Replies: 0
    Last Post: - 10th March 2010, 06:01
  2. 16f887 44 pin demo board code problem?
    By jessey in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 7th December 2008, 14:17
  3. How to configure SPI in PICBASIC PRO?
    By moogle in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 15th April 2007, 18:31
  4. PicBasic code problems with a 16F84A
    By Lauren Barta in forum mel PIC BASIC
    Replies: 3
    Last Post: - 30th May 2006, 22:50
  5. PicBasic Fundamentals
    By Billyc in forum General
    Replies: 9
    Last Post: - 4th May 2004, 10:04

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts