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

    (SO....I have to see both codes side by side so I can learn for my mistakes )

    You 've done excellent coding ...I'll give it a try although I had problems with averaging routines -keep sending '0' as result!

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    I agree with Walter.
    All this "Software Timed" stuff just doesn't work well together.

    Everything, should be Interrupt driven.

    Capture (CCP) the received pulses.
    Use A/D interrupt to OverSample the Altitude. (oversampling does not have to be "Blocking")
    Timer interrupt to drive the servo.

    No PULSIN's, no PULSOUT's, no SHIFTIN/OUT.

    These PIC chips are extremely fast. (As long as the program isn't sitting in a loop somewhere waisting 90% of it's time.)
    And with the Hardware doing most of the work, they "Scream".

    Even if you don't use Interrupts ... Use the hardware.
    <br>
    DT

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


    Did you find this post helpful? Yes | No

    Wink

    Hi, Alex ...

    just two little "bugs" of mine ...
    Code:
    '---------------------------------------------------------------------------
    pause 3000
    
    for x=1 to 4
    	high led
    	pause 200
    	low led
    	pause 100
    next x

    ... I only forgot to clear the comments for shortening delays when using MPSIM ...

    Here is the good sequence ...

    AND

    Code:
    Average:' -=-=-=-=-=-=  Average 16 X Analog values -=-=-=-=-=-=-=-=-=-=
    
    Value = 0
    
      For x = 0 to 15			' 16 Samples MAXI !!!
      
      shiftin ADC_DATA,ADC_SCLK,msbpost,[advalue\12]	'337 µs
      
      value = value + advalue
    Forgot resetting "value" ... Boooo.


    But ... you of course had noticed it !

    Alain

    PS for Darrel ...

    Everything, should be Interrupt driven.
    You really sure ??? ... not me, here for R/C Gadgets ...
    Last edited by Acetronics2; - 3rd February 2010 at 09:44.
    ************************************************** ***********************
    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 " !!!
    *****************************************

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