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.
Bookmarks