Problem running debug with a Picaxe 8

When I run debug the debug window appears and on top there is the message "WAITING" and nothing happens. I am using port 2 to drive an LED but during debug the port is connected to the programming cable (serout)The code I'm tunning is as follows:

Code:
#picaxe 08m 
#com 4
setfreq m8
'Ports
Symbol Thr=input3
Symbol Adj=input1
Symbol LED=output0
Symbol Buzz=output4
Symbol Glow=output2
'Variables
Symbol Th=W1
Symbol Ad=W2
Symbol N=W3

Th=0
Ad=0
Low LED
pwmout 2 OFF

	Main:
High LED
pulsin 3,1,Th
pause 10
		
pulsin 1,1,Ad
pause 10
'if N<>5000 then goto Calc
Pause N
N=0
		
	Calc:
If Th=0 or Ad=0 then goto Alarm
If W2<330 then goto Jump1
W2=330
	Jump1:
If Th=0 or Ad=0 then goto Alarm
If Ad=<150 then goto Jump2
Ad=Ad-150
	Jump2:
	debug Ad
Th=Th-Ad
	debug Th
If Th<190 then goto Ignite
pwmout 2 OFF
Low LED
goto Main
....
.......................
 

inglewoodpete

Senior Member
I think the killer could be the very first instruction. "SetFreq m8" doubles the operation of almost everything, including serial data transmission (debug data).

As noted in the command manual, the "Debug" command does not need any parameters: it sends all registers in a single burst. You should see the LED connected to Pin 0 flash as the debug data is transmitted.
 

hippy

Technical Support
Staff member
Try a SETFREQ M4 before the DEBUG and put a SETFREQ M8 after, or simply comment out the SETFREQ M8 while debugging.
 

Technical

Technical Support
Staff member
The debug window that pops up has an option at the bottom to choose the resonator speed - so you can use 'setfreq m8' as long as you adjust the debug window setting accordingly.
 
The debug window that pops up has an option at the bottom to choose the resonator speed - so you can use 'setfreq m8' as long as you adjust the debug window setting accordingly.
When the debug window appears the option in the bottom shows 4Mhz. I changed it to 8Mhz but the "Waiting" message remains and nothing else happens.
 
Last edited:

hippy

Technical Support
Staff member
Try a simple program ...

Code:
Do
  Debug b0
  b0 = b0+1
  Pause 500
Loop
And get that working. Then add a SETFREQ M8 as the first line.

Once you've confirmed that DEBUG does work, it's then a case of working out why nothing happens in the program you wish to debug. It may be that the DEBUG is never being executed or something is interfereing with it; a "LOW 0:pAUSE 50" before the DEBUG may help there.

If you have an 08M you can try that using SERTXD and the Terminal function of the Programming Editor which is often more useful than DEBUG ...

Code:
Do
  SerTxd( "b0=", #b0, CR, LF)
  b0 = b0+1
  Pause 500
Loop
Use 4800 baud, and 9600 baud if you add a SETFREQ M8 as the first line.
 

Technical

Technical Support
Staff member
Your issue is not really the baud rate (although it has to be correct) it is because you are switching the LED (output 0) on and off in your program. As debug is transmitted on the same shared pin any high/lows can stop debug working as the computer gets confused. A solution sometimes is to put low 0: pause 500 before any debug.
 
Top