How does everyone debug their code?


Closed Thread
Results 1 to 31 of 31

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Posts
    653

    Default How does everyone debug their code?

    I'm just wondering how everyone else 'traps'/debugs to make sure their code is doing what's expected.

    I come from the days, when using VMS DCL, it was possible to use a command 'set verify'....as the program ran through its routive it was possible to monitor it's progress. Now with a PIC being 'standalone' that's not possible initially - so how does everyone do it?

    For example, with a simple ADC program, it's fairly easy to get an LED to light up if a certain conditon is met...but that's going to grow old very quickly, if you have to put in a routive & each & every time! (also it's not that flexible - for example what if the condition isn't met...why not, what went wrong etc)

    Ideally, I'd like to see PIC output on my PC screen as the PIC program runs through it's program. Therefore I'm thinking hyperterm & getting my PIC to talk to the PC's COM port.

    I therefore googled about a bit & found surprisingly little 'definitive' info. For example, some sites said that it's not necessary to changle the levels from TTL to RS232 (??) etc. Also decent readable PIC-> RS232 COM ports circuits seem a little thin on the ground (I bought a MAX232 chip a few months ago, but would now like to use it)

    So this got me thinking...perhaps there's any easier way of debugging? (I've had a quick try with PIC emulatorw...perhaps I'm just getting a little old, but I might has well been reading the service manual for the Hubble Space telescope)

    Is getting the PIC to talk to the PC the way to go?

    I'm using a PIC16F690.

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    There is several way indeed. Some use Proteus, some MPLAB sim, some use Serial communication (and/or ICD like Pickit 2 or MicroCode ICD), or still some LEDs or a LCD.

    What's the best method? Hard to tell, for me a blend mix of everything above (less Proteus as I don't trust it) do a really good job. And then, it really depend where I am in the development stage and how big the "bug" is.

    An ICD tells you exactly what happen in your code in real life, and more, it give you ALL internal register status, down side, they're usually a bit slow.

    HTH
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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


    Did you find this post helpful? Yes | No

    Wink

    Hi,

    Steve is right ... ICD2 or 3 really are great tools, Consider Pickit too.

    16F690 not supported for debug ???

    FALSE !!! for 30 Euros at Farnell, you get the 16F690-ICD Debug adapter ...

    µChip ref AC 162061.

    Then just

    1) plug
    2) play
    3) Enjoy ...

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

  4. #4
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    You're kidding!

    In their wisdom the authors of PBP gave you a DEBUG command which can be directed out to any spare available PIC pin...

    Add a penny Resistor and you're communicating with your PC.

    Can it get any simpler?

  5. #5
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    You're kidding!

    In their wisdom the authors of PBP gave you a DEBUG command which can be directed out to any spare available PIC pin...

    Add a penny Resistor and you're communicating with your PC.

    Can it get any simpler?
    This sounds *just* the job...have you some linkage I can consume please?

  6. #6
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    The linkage is to your PBP Manual... use the really complex schematic provided in the DEBUG section.

Similar Threads

  1. N-Bit_MATH
    By Darrel Taylor in forum Code Examples
    Replies: 38
    Last Post: - 16th December 2010, 14:48
  2. debug not working with MPASM assempler
    By santamaria in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 4th March 2009, 07:51
  3. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  4. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  5. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26

Members who have read this thread : 2

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