Is there a wise way to debug a large code?


Closed Thread
Results 1 to 28 of 28

Hybrid View

  1. #1
    Join Date
    Feb 2013
    Posts
    1,158


    Did you find this post helpful? Yes | No

    Default Re: Is there a wise way to debug a large code?

    Yes I can post, but the issue is that in both cases PCBs are different - it is thru hole (and big) components in one case, and small and SMD components in another, but giving the same issue. I think, maybe this is RMW issue somehow? because say PORTA.1 is used as ADC IN, but PORTA.2 is used as a digital output, has MPSA42 transistor connected to it's pin.

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,705


    Did you find this post helpful? Yes | No

    Default Re: Is there a wise way to debug a large code?

    I think, maybe this is RMW issue somehow?
    not at all likely , which pin is having its expected digitally "read back" value changed by a digital write to another pin on the the same port ?

    as ioannis suggests this is looks very much an EMI problem that could most likely could be ameliorated by having the switch circuitry of more suitable impedance and using appropriate adc conversion speed along with sample hold time and rate.


    with no schematic or code to look at it might just be bad code who would know
    Warning I'm not a teacher

  3. #3
    Join Date
    Feb 2013
    Posts
    1,158


    Did you find this post helpful? Yes | No

    Default Re: Is there a wise way to debug a large code?

    Ok, here is the part of code which reads the keys:
    Code:
    adcin 7,ard
    if ard<130 then 'if any button is pressed
    ticker=ticker+1 'increase value and wait - debouncing
    pause 1
    endif
    if ticker>150 and ard<100 then  'if left button is pressed then next menu item
    menuitem=menuitem+1
    ticker=0 'reset debouncer
    endif
    if ticker>150 and ard<130 AND ARD>100 then  'if right button pressed, change the value
    CVLADI=CVLADI+1
    if cvladi>ulim or cvladi<dlim then cvladi=dlim
    ticker=0
    here is PCB

    Name:  herepcb.jpg
Views: 1085
Size:  579.6 KB

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,705


    Did you find this post helpful? Yes | No

    Default Re: Is there a wise way to debug a large code?

    Ok, here is the part of code which reads the keys:
    pointless snippet . how is adc setup ?

    good luck trying to use adc value without passing it through a lpf

    a pic of blank pcb is not a schematic
    Warning I'm not a teacher

  5. #5
    Join Date
    Feb 2013
    Posts
    1,158


    Did you find this post helpful? Yes | No

    Default Re: Is there a wise way to debug a large code?

    DEFINE ADC_BITS 8 ' Set number of bits in result
    DEFINE ADC_CLOCK 3 ' Set clock source (rc = 3)
    DEFINE ADC_SAMPLEUS 50 ' Set sampling time in microseconds

    Here is ADC setup. All PBP defaults.

    Unfortunately, I don't create schematics - I directly draw PCB, since I can read it in same way, as schematics

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,705


    Did you find this post helpful? Yes | No

    Default Re: Is there a wise way to debug a large code?

    Unfortunately, I don't create schematics - I directly draw PCB, since I can read it in same way, as schematics
    that just explains so much
    good luck with your endeavors i'm out
    Warning I'm not a teacher

  7. #7
    Join Date
    Feb 2013
    Posts
    1,158


    Did you find this post helpful? Yes | No

    Default Re: Is there a wise way to debug a large code?

    Well, added 0.1uf capacitor at ADC input, so far, works fine.

Similar Threads

  1. DEBUG DEC DatVar vs DEBUG #DatVar
    By netstranger.nz in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 16th March 2011, 22:26
  2. Replies: 0
    Last Post: - 18th November 2010, 19:50
  3. How does everyone debug their code?
    By HankMcSpank in forum General
    Replies: 30
    Last Post: - 18th June 2009, 07:41
  4. SERIN from a large string
    By earltyso in forum Serial
    Replies: 5
    Last Post: - 2nd May 2008, 23:23
  5. large displays
    By George in forum Off Topic
    Replies: 2
    Last Post: - 18th March 2007, 22:56

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