Editor 6 and Terminal Window ???

SolidWorksMagi

Senior Member
Hi,

When I send a little program down to the PICAXE 28X2 to simply send data back to the PC via the programming/download cable the terminal window doesn't open and if I manually open the terminal window it says the serial port is in use ??? What's wrong?

; 28X2+TerminalWindowTests.bas

#picaxe 28X2 ; Define the Processor Type
#terminal 9600

let b1 = 65
do
sertxd("The data is ",#b1,13,10)
pause 1000
loop
end
 
Last edited:

inglewoodpete

Senior Member
I have not had the same problem but I'm using Version 6.0.9.1 of the PICAXE Editor. What version are you using? And what operating system does your host computer use?

Try adding a pause at the start of your program to allow the terminal window time to open:
Code:
[color=Green]; 28X2+TerminalWindowTests.bas[/color]

[color=Navy]#picaxe [/color][color=Black]28X2 [/color][color=Green]; Define the Processor Type[/color]
[color=Navy]#terminal 9600[/color]

[color=Blue]Pause [/color][color=Navy]1000              [/color][color=Green]'<<<<<<<<<<<<<<<[/color]
[color=Blue]symbol [/color][color=Purple]b1[/color]

[color=Blue]let [/color][color=Purple]b1 [/color][color=DarkCyan]= [/color][color=Navy]65[/color]
[color=Blue]do
   sertxd([/color][color=Red]"The data is "[/color][color=Black],#[/color][color=Purple]b1[/color][color=Black],[/color][color=Navy]13[/color][color=Black],[/color][color=Navy]10[/color][color=Blue])
   pause [/color][color=Navy]1000[/color]
[color=Blue]loop
end [/color]
 

SolidWorksMagi

Senior Member
Hi,

I am using version 6.0.9.3 in Windows 10.

I just added the pause 1000 and it works for the shorter program. Weird!

But when I added even a pause 3000 in a much larger program I don't get the Terminal window. Something is really wrong with the editor.
 

lbenson

Senior Member
... when I added even a pause 3000 in a much larger program I don't get the Terminal window
You haven't used SETFREQ to set a higher frequency before the pause, have you? If you have, then you need to adjust the pause to account for the increased speed. For instance, if you have used "SETFREQ m16", then you would need "PAUSE 8000" to have a two-second pause (which is what I typically use before any SERTXD).

If you continue to have problems, post your code.
 

SolidWorksMagi

Senior Member
Hi,

There is no SETFREQ ... I am using the basic PICAXE 28X2 module the code is in the very first post for the SERTXD problem, however, the actual sertxd I'm using is to send a bunch of data to the Terminal window on the PC from a camera module. For some reason the larger program doesn't open the Terminal window while the cut down versions of the program do still using the same header and variables etc...

#picaxe 28X2 ; Define the Processor Type
#terminal 9600
pause 1000

Symbol RX_PIN = C.3
Symbol RX_BAUD = T9600

symbol i = b0
symbol range = b15

do
SerIn RX_PIN, RX_BAUD, ($AA), b1, b3,b2, b5,b4, b7,b6, b9,b8, b11,b10, b13,b12

sertxd("The data is ",#b1,13,10)
pause 1000
loop
end
 

lbenson

Senior Member
Are you sure you are getting to your SERTXD? (That is, past the blocking SERIN qualifier of $AA?) Sure that your incoming serial is 9600 baud and idles high? Can you see the serial on a terminal on your PC (e.g., with putty)?

Try changing "pause 1000" to "pause 2000" and follow that immediately with 'sertxd("Starting",cr,lf)'.

You may do well to have a timeout on your SERIN.
 

SolidWorksMagi

Senior Member
Hi,

Interesting, when I added the 'sertxd("Starting",cr,lf)' after the #terminal 9600 in the larger program, then the terminal window opened.

Now I still need to do some more work with the camera, but I'm hoping this resolves the problem for this and future programs. Thanks!


#picaxe 28X2 ; Define the Processor Type
#terminal 9600
pause 3000
sertxd("Starting",cr,lf)

Symbol RX_PIN = C.3
Symbol RX_BAUD = T9600

symbol i = b0
symbol range = b15

do
SerIn RX_PIN, RX_BAUD, ($AA), b1, b3,b2, b5,b4, b7,b6, b9,b8, b11,b10, b13,b12

gosub routines4a
loop

routines4a:
really big program
return
end
 

lbenson

Senior Member
Note that it's unlikely that adding SERTXD at the beginning of your program solved any problems--it just revealed that the problem isn't where you thought it was. I'd still put another SERTXD immediately after your SERIN to make sure that you are actually receiving what you think you are.
 

hippy

Technical Support
Staff member
Not really sure what is going on. The serial terminal opens immediately after download if it is going to be opened, not when the first data is sent from the PICAXE. It should open even if no data is ever sent.

The serial terminal only appearing when the first SERTXD is executed would however be expected when simulating rather than downloading.

It could be there was some DEBUG command in the larger program which opened the debugging link after download, and in that case it won't auto-launch the Terminal.

Manually opening the Terminal does report the port is already being used for debugging, shows the Terminal window anyway, but doesn't show any data because the port isn't actually opened for the Terminal. Attempting to open the port within Terminal will again produce the port already being used for debugging message.

It is done this way so one can debug the PICAXE but also watch serial data on another port.
 
Top