How do I use DEBUG ?


Closed Thread
Results 1 to 14 of 14
  1. #1
    Join Date
    Feb 2005
    Location
    Toronto, Canada
    Posts
    46

    Question How do I use DEBUG ?

    hello, odd question, but I was previously a Basic Stamp user before using PIC's and I got used to having the debug command every now and then.

    can I do that with PBP? I read in the manual on pg 54, that it sends out the serial data. and to hyperterminal (which is thankfully still included with xp) but how do I hook it all up? and is there an option to have a DEBUG screen WITHIN PBP? (anyone used the stamp and know what I'm talking about?)

    I'm not really all that interested in using the LCD debug, I'd much rather simply use one pin on my pic and have a pc screen.

    thanks!

  2. #2
    PICMAN's Avatar
    PICMAN Guest


    Did you find this post helpful? Yes | No

    Default

    i believe serout is the comand you refrence,

    from my experiance, almsot every thing i learned on basic stamp i relearned for pic, as i said im only using this bs2 , cause i dont have the $ for all the parts i need for pic, and dont want to blow usefull ports on a pic when i could fry my bs2 ,, which in my opinion is useless.

    but i believe serout is the comand, the pbp manual has numeous minimal configurations,, circut drawings, to run a pic, to have serial conectivity, reset butons, u name it the pbp manual has a drawing,

    im sure steve will tell you more , but since i was here i figured id give ya some where to start reading
    Last edited by PICMAN; - 21st February 2005 at 18:22.

  3. #3
    Join Date
    Feb 2005
    Location
    Toronto, Canada
    Posts
    46


    Did you find this post helpful? Yes | No

    Default

    acctually, there's a command called DEBUG. I'm more interested in that. but thanks picman

  4. #4
    PICMAN's Avatar
    PICMAN Guest


    Did you find this post helpful? Yes | No

    Default

    well ,, again, the pbp manual, has decent explanitions of comands, do you have a copy?

  5. #5
    Join Date
    Feb 2005
    Location
    Toronto, Canada
    Posts
    46


    Did you find this post helpful? Yes | No

    Default

    yes, and I've read it, pg54 as stated, I'm just wondering if anyone has a better setup to getting the info on screen.

    as asked, I'd like to see the DEBUG info in PBP compiler, or in microcode studio if possible.
    this is not covered in the manual.
    Last edited by kenpo; - 21st February 2005 at 18:26. Reason: spelling mistakes :(

  6. #6
    PICMAN's Avatar
    PICMAN Guest


    Did you find this post helpful? Yes | No

    Default

    yeh i just skimmed the whole pbp manual, didnt see debug, ive got a diferent one then you apearantly,

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


    Did you find this post helpful? Yes | No

    Default

    O.k.. DEBUG in PBP is about the same than SEROUT BUT it take less of your code space. If you want to use DEBUG you'll have to define few things before it work properly to send data to your PC without any kind of MAX232 or else inverter chip

    1. set the baudrate
    DEFINE DEBUG_BAUD 2400

    2. set inverted mode
    DEFINE DEBUG_MODE 1

    3. set the DEBUG serial out pin
    DEFINE DEBUG_REG PORTB
    DEFINE DEBUG_BIT 0 'These two line will set your debug out on the PORTB.0

    Once its done you'll be able to send your data in serial to your PC with
    DEBUG #MyVar

    this will send the ascii representation of MyVar value.

    If you want to send with SEROUT on PORTB.0 at 2400 baud inverted
    SEROUT PORTB.0,4,[#Myvar]

    Both of the above will work with a simple 1k in serie with the PIC to the pin2 of your DB9 connector.
    Code:
    TRISB=0
    DEFINE DEBUG_BAUD 2400 
    DEFINE DEBUG_MODE 1
    DEFINE DEBUG_REG PORTB
    DEFINE DEBUG_BIT 0 'These two line will set your debug out on the PORTB.0 
    MyVar var byte
    clear
    start:
         DEBUG "MyVar=",#MyVar,13,10
         pause 500
         if MyVar<255 then 
              MyVar = MyVar + 1
         ELSE
              Myvar = 0     
         ENDIF
         goto start
    You can monitor everything in the MicroCode Studio Serial window or in Hyperterm, RealTerm or else terminal program.
    Last edited by mister_e; - 21st February 2005 at 18:56.
    Steve

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

  8. #8
    Join Date
    Feb 2005
    Location
    Toronto, Canada
    Posts
    46


    Did you find this post helpful? Yes | No

    Default

    WOW! WICKED!! thanks man!

    debug was the final and LAST reason I was hanging onto my Basic Stamp2 for prototyping. time to sell it and say goodbye to it forever!!

    oh, also, just outa curiosity, is there any preferance as to what pin the debug is used on? porta or B?

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


    Did you find this post helpful? Yes | No

    Default

    No. since your selected pin can be an output and it's not an open drain type (like many RA4) it will work without anything else than 1 resistor.
    Steve

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

  10. #10
    Trent's Avatar
    Trent Guest


    Did you find this post helpful? Yes | No

    Default More questions about DEBUG command

    Quote Originally Posted by mister_e View Post
    O.k.. DEBUG in PBP is about the same than SEROUT BUT it take less of your code space. If you want to use DEBUG you'll have to define few things before it work properly to send data to your PC without any kind of MAX232 or else inverter chip

    1. set the baudrate
    DEFINE DEBUG_BAUD 2400

    2. set inverted mode
    DEFINE DEBUG_MODE 1

    3. set the DEBUG serial out pin
    DEFINE DEBUG_REG PORTB
    DEFINE DEBUG_BIT 0 'These two line will set your debug out on the PORTB.0

    Once its done you'll be able to send your data in serial to your PC with
    DEBUG #MyVar

    this will send the ascii representation of MyVar value.

    If you want to send with SEROUT on PORTB.0 at 2400 baud inverted
    SEROUT PORTB.0,4,[#Myvar]

    Both of the above will work with a simple 1k in serie with the PIC to the pin2 of your DB9 connector.
    Code:
    TRISB=0
    DEFINE DEBUG_BAUD 2400 
    DEFINE DEBUG_MODE 1
    DEFINE DEBUG_REG PORTB
    DEFINE DEBUG_BIT 0 'These two line will set your debug out on the PORTB.0 
    MyVar var byte
    clear
    start:
         DEBUG "MyVar=",#MyVar,13,10
         pause 500
         if MyVar<255 then 
              MyVar = MyVar + 1
         ELSE
              Myvar = 0     
         ENDIF
         goto start
    You can monitor everything in the MicroCode Studio Serial window or in Hyperterm, RealTerm or else terminal program.

    What does
    DEBUG "MyVar=",#MyVar,13,10
    do? What is the 13, 10?

    Thanks- Trent

  11. #11
    Join Date
    Mar 2005
    Location
    Iowa, USA
    Posts
    216


    Did you find this post helpful? Yes | No

    Default

    Trent -
    The 13,10 are the decimal equivalents of Carriage Return (CR) and Line Feed (LF) control characters. So each time you send the command to hyperterminal it will be nice and neat on seperate lines.
    Wisdom is knowing what path to take next... Integrity is taking it.
    Ryan Miller

  12. #12


    Did you find this post helpful? Yes | No

    Default

    One question concerning debug command.

    With which BAUD rates can it be used ?

    .

  13. #13
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Dave
    Always wear safety glasses while programming.

  14. #14


    Did you find this post helpful? Yes | No

    Default

    Thank's Dave

    .

Similar Threads

  1. N-Bit_MATH
    By Darrel Taylor in forum Code Examples
    Replies: 38
    Last Post: - 16th December 2010, 14:48
  2. Wireless using debug.
    By polymer52 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th January 2010, 14:53
  3. About USB
    By dias11 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 3rd December 2009, 20:41
  4. debug not working with MPASM assempler
    By santamaria in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 4th March 2009, 07:51
  5. Data EEPROM gets clobbered during programming
    By BrianT in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th July 2008, 02:46

Members who have read this thread : 1

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