PDA

View Full Version : Using Variables with Debug



krohtech
- 15th December 2007, 17:49
Hello All,

I know this is a very basic question.

I am trying to setup a pic to PC connection for the purpose if checking out variables when using analog components. I have built a cable using Melanie’s PIC to PC post.

http://www.picbasic.co.uk/forum/showthread.php?t=573&highlight=parsing

PortB.1 - RX cable via 1K5 Resistor to PC pin 3 on 9-Pin D Connector
PortB.2 - TX cable via 1K5 Resistor to PC pin 2 on 9-Pin D Connector
Vss to PC pin 5 on 9-pin D Connector

I can send text out using DEBUG just fine but cannot figure out the syntax for sending the contents of a variable using the DEBUG command.

Thanks in advance

Darrel Taylor
- 15th December 2007, 20:09
There are a lot of different ways to send variables, depends on what you need to do.
<pre>DEBUG B0 ; Binary Data<br>DEBUG DEC B0 ; ASCII Decimal format<br>DEBUG BIN B0 ; ASCII Binary <br>DEBUG HEX B0 ; ASCII Hexadecimal</pre>Then there are all the variations of the above like ... IDEC, SDEC DEC3, IDEC5, etc.

The ASCII functions will work with either Bytes or Words, but if you want to send a WORD in "Binary Data" format, you have do each byte seperately<pre>DEBUG W0.byte0, W0.byte1</pre>hth,

krohtech
- 17th December 2007, 02:47
Thanks, All I needed wasc the DEC.