Code entering endless loop


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Blackhawk's Avatar
    Blackhawk Guest


    Did you find this post helpful? Yes | No

    Default

    Ok adding pull down resistors and properly poking trisB fixed my problem. New problem is the altimeter is detecting apogee when it is just sitting there immediately after the acceleration arms it. I have coded it such that if the current reading is more than 15 units bigger than the previous reading then it triggers an apogee event. However it is immediately triggering an apogee event, a previous datalogger using the same PIC/ADC and pressure sensor only have +/- unit of 'bit jitter' when stationary, so I can't see how currently two readings at the same pressure would be 15 units different.

    Here is the code in which the new problem is.

    Code:
    launched:   poke ADCON0 , $91
                pause 1
                poke ADCON0 , $95
                pause 5
                peek ADRESH,B6
                Peek ADRESL,B7
                W6 = W6 + 15
                if W3 > W6 then apogee
                W6 = W3
                goto launched
    EDIT: hahahaha oops, look at my code, I was placing the lower half of the 10 bit A/D result at the top of the word and the upper half on the bottom half of the word. As such the +/- 1 unit of bit jitter would have a huge difference. Why do I always only catch these things after posting them.

    EDIT2: Except now the circuit is instantly arming and delaying by a random number before thinking it's at apogee, this is really annoying me.
    Last edited by Blackhawk; - 26th November 2006 at 06:36.

Similar Threads

  1. Help with Pic Delay Pulse code please
    By g7jiq in forum mel PIC BASIC Pro
    Replies: 36
    Last Post: - 17th April 2009, 18:19
  2. Help with Pic Delay code mod please
    By g7jiq in forum General
    Replies: 1
    Last Post: - 26th March 2009, 00:06
  3. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  4. Help with LCD commands with button I/P
    By g7jiq in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 9th January 2008, 10:57
  5. help optimising code
    By Darrenmac in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 26th March 2007, 10:27

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