PDA

View Full Version : How do I use DEBUG ?



kenpo
- 21st February 2005, 19:10
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!

PICMAN
- 21st February 2005, 19:16
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

kenpo
- 21st February 2005, 19:19
acctually, there's a command called DEBUG. I'm more interested in that. but thanks picman :)

PICMAN
- 21st February 2005, 19:23
well ,, again, the pbp manual, has decent explanitions of comands, do you have a copy?

kenpo
- 21st February 2005, 19:25
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.

PICMAN
- 21st February 2005, 19:29
yeh i just skimmed the whole pbp manual, didnt see debug, ive got a diferent one then you apearantly,

mister_e
- 21st February 2005, 19:54
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.


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.

kenpo
- 21st February 2005, 20:05
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?

mister_e
- 21st February 2005, 20:14
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.

Trent
- 5th January 2008, 16:40
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.


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

rhino
- 5th January 2008, 19:02
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.

ruijc
- 9th January 2008, 13:09
One question concerning debug command.

With which BAUD rates can it be used ?

.

mackrackit
- 9th January 2008, 15:07
http://www.picbasic.co.uk/forum/showthread.php?t=5892&highlight=debug+baud

ruijc
- 9th January 2008, 15:54
Thank's Dave

.