Debug Instruction In Final Code?

IRQ

New Member
I currently have a couple debug instructions in my code for development purposes. Would there be any problem with me just leaving those in there forever even in a situation where I do not have a serial port connected? Is there any handshaking on data being broadcast out of the PicAxe from a debug instruction?

In other words... Even if "nobody is listening", will the PICaxe still just broadcast that data to an empty room with no problems caused? Or will that outbound data eventually fill up a buffer somewhere and potentially cause an issue?

I'm assuming there's no handshaking and it will just be broadcast to an empty room with no problems, but I figured I should check.
 

lbenson

Senior Member
There's no problem other than that debug can upset things in time-critical situations. If you haven't experienced this, you should be ok.
 

hippy

Ex-Staff (retired)
The DEBUG command always sends data, but, as you suspected, that data simply goes out to nowhere, there's no handshaking, the data isn't buffered, and won't stop anything working if there's nothing to receive that data.

DEBUG commands do send out quite a lot of data which takes some time to send, but if their presence is not problematic there is little reason to remove them. In some cases it may be removing DEBUG commands which can cause adverse effects if they had played a part in any timing of a program.
 

erco

Senior Member
+1 to all comments so far, just wanted to add that the same goes for SERTXD commands. Both commands are useful while developing code, but they do slow program execution down a lot. I usually comment them out for the final version to run it at top speed. But if your code works fine with DEBUG and/or SERTXD commands, it's perfectly fine to leave them in.

Per someone else's suggestion here, it's handy/wise to include one-time SERTXD commands at the start of your program to list the version# and date, just so you can see it on screen if you choose to plug in. Can be helpful in the future if you lose track of your program or version number. For example...

Code:
#picaxe 20m2
#no_data

pause  255

sertxd("Death Ray",13,10)
sertxd("Version 2.1",13,10)
sertxd("March 9 2018",13,10)

'b.0 reverse high
'b.1 fwd high pwm
'etc...
 
Top