Viewing the Picaxe results on the PC

donrecardo

Senior Member
Hi
I am a newbie to picaxe but am pleased to say I just built a magic switchboard that worked first go , so things must have started making some sense.
I hope that this isnt too silly a question and I guess the answer may be in the manuals somewhere but like most newbies I am eager to see things happen on the picaxe and so rather than read the whole manual, I have up till now only read the bits in the manual I have needed to get the job done .

I dont have a serial LCD and cant get one till later this month ( techsupplies and Rapid are both waiting for new stocks to arrive) so I cant output results from the picaxe so that I can read them , (e.g. from a ds18b20 or real time clock etc).

Is it possible to see whats happening inside the picaxe from within the programming editor using debug or some other such command and if so how do I go about it ?

It would be nice to be able to read the values on ADC inputs , or the temperature on my dS18B20 by sending it from the picaxe back up the usb programming lead.
Is this possible , or do I have to wait till the serial LCD are once again available

Regards
Don
 

George Sephton

Senior Member
Just add debug to your code, assuming your code loops, everytime debug is sent the values on screen will be update, the PICAXE has to be connected to your computer and it will show all of the values of the variables.
 

Dippy

Moderator
Have a look at the Sertxd command in the BASIC Manual.
it gives an example too.

Then run up the terminal in the Programming Editor and bingo! Your values appear on your screen. (Assuming you've connected the cable, switched PICAXE on and got the right baud rate :) )

Blimey, they were In Like Flint!!
 

donrecardo

Senior Member
Thanks all for the very quick replies

George, does it matter where in the code I put Debug and is it just " debug or is it Debug B0 or Debug B1 etc )

Eclectic
Now I know where to look in the manual I will look at sertxd thanks

Dippy
Have a look at the Sertxd command in the BASIC Manual.
it gives an example too.

Then run up the terminal in the Programming Editor and bingo! Your values appear on your screen. (Assuming you've connected the cable, switched PICAXE on and got the right baud rate :) )

Blimey, they were In Like Flint!!
How do I know which is the right baud rate to use ? Obviously both the terminal and picaxe need the same baud rate but does it matter which I choose
BTW. incase it makes a difference I will be running the code on a 28X1
Don
 
Last edited:

Dippy

Moderator
Don, check the Manual, it says:-
"Serial output via the serout programming pin (baud 4800, 8 data, no parity, 1
stop)."

Then if you fire up the programming Editor > PICAXE>Terminal (or press F8) then up pops the terminal window.
Just make sure the 4800 option is selected - I think it's the default value.

Time for you to read the Manual now....

PS. I sometimes forget to read Manual too :)
 

donrecardo

Senior Member
Hi Dippy

Sorry about that, I replied to your post before going to the manual to read over what you had spoke about , I hadnt yet opened up the terminal either.

Since then I read about SERTXD and of course all became obvious
it does of course say its fixed at 4800,n,8,1 and on opening the terminal in programme editor I saw the option to set it also to 4800

I put in the example in the manual
main:
for b1 = 0 to 63 ‘ start a loop
sertxd(“The value of b1 is ”,#b1,13,10)
pause 1000
next b1 ‘ next loop

It ran fine, and shows me just how easy it is now for me to view what I want from the picaxe .
I knew that in the line starting with SERTXD that what was inside the quotes would get printed as is ( the value of B1 is )and #B1 would print the value held in B1 but was befuddled as to why there was also 13,10 in the data to be output.
Am I right in guessing these are carraige return and line feed commands?
Don
 

George Sephton

Senior Member
Just for refernce as it seems you are going to use sertxd, just write debug and it should pull up a windown on your screen when you download the program if not it's in a menu somewhere and it should just give you values when it starts.
 

donrecardo

Senior Member
Time for you to read the Manual now....

PS. I sometimes forget to read Manual too :)

I dont actually forget to read the manual but with picaxe chips being so new to me, reading manuals are an interruption to my playing with the chips

Imagine if instead of playing hands on with the chip that I read through all the manuals only to then find its not possible to do what ever it was I had wanted to do . What a waste that would feel like :mad:

I will read all the manuals , I promiss , but let me play for a while , at least till the novelty wears off :eek:

Don
 

donrecardo

Senior Member
Thanks for the tip about the constants CR and LF

I just replaced the 13,10 with CR,LF in the previous program and it still worked fine and as you said CR and LF is far easier to remember

Don
 
problem with sertxd

I think this is the right thread to post these 3 questions, but this only my second post....

I have an AXE110 datalogging board with a PICAXE18-X, 24LC16B EEPROM (and although not relevant here DS1307 RTC) which I am using to help me undertand the PICAXE. I need to make it do things which the programming Wizard will not let me do (e.g., take data at sub-second intervals) so I need to understand how to program the PICAXE. I am now having problems getting data back to my PC.

1) simple one: do I need to declare CR, LF with a 'SYMBOL' command, or are they predefined ? Where does it list predefined symbols in the manual ?

[I know it says "The CR and LF constants are pre-defined values (13 and 10)..." but this sentence is a throw-away buried in the recesses of maual one, not in a clear list of predefined symbols and other labels in manual 2.]

('picaxe_manual2 > Variables-system' does not list these but it won't me declare CR or LF, I have to name them something else and assign the values 10 and 13 to them)

2) How do I start the terminal and then start executing the code in the PICAXE, so I do not miss the first few data items ? It seems that it (the Program Editor) won't let me run my code (that is, PICAXE > Program) with the terminal window open. It says in the manual ('picaxe_manual1 > Tutorial 8 - Using Serial Terminal with Sertxd' that you can set the PE to open the termimal when data is received by going to 'View>Options>Options menu', but I don't see the final Options...

3) Finally, when I do start my code [included for the sake of completeness, not having solved Qs 1) or 2), and based on, I admit, the code generated by the Wizard]
Code:
main:
	symbol counter = b1
	symbol Value = b0
	symbol read_back = b2
	symbol address = w3 ;(b7:b6)
	symbol RET = 13    ; (carriage) return
	symbol LFEED = 10  ; line feed
	symbol COMMA = 44  ; comma
	
	i2cslave %10100000, i2cslow, i2cbyte ; iniialize EEPROM
	low 5 ; write enable eeprom
	address = 0

	FOR counter = 0 TO 100
		debug
		Value = 2*counter + 1
		address = counter
		writei2c address,(Value)
		pause 10
		readi2c address,(read_back)
		pause 10
		sertxd("Address: ",#address," Value stored:",
#read_back,cr,lf)
		gosub LEDgreen
		pause 1000
		gosub LEDoff
		pause 1000
	NEXT counter

	
end ;end program
;
;*** SUBROUTINES ***

	LEDgreen:	low 2
			high 3
		return

	LEDred:	low 3
			high 2
		return			

			
	LEDoff:	low 2
			low 3
		return
running, why do I get the spurious rubbish (an example of one line of it, followed by what I do expect to see - "Address: 7 Value stored:15")

ððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððZ¬Address: 7 Value stored:15

and how do I avoid it ?

AB
12.June.2011
 

MartinM57

Moderator
1) CR and LF are predefined constants with the values you expect. The manual is not clear about them - it has been commented on before.

2) #terminal baudrate at the top of the code. Sometimes it helps to put a, say pause 500, at the start of the program to let the PC catch up

3) look like it might be the debug output appearing on the terminal. I'd stick to one form of debugging only - debug or sertxd's
 

eclectic

Moderator
Snipped
2. How do I start the terminal and then start executing the code in the PICAXE, so I do not miss the first few data items ?
snipped
At the very start of your program, (before main)
try something like

Code:
for b0=1 to 10
Sertxd ("   ----------------------------------------------- ")
next

main
It "primes" sertxd, which does take a little while to "start up"

e
 
Thanks Martin,

Doing as you suggest has solved the problems I described. Now to uncover more gaps in my knowledge :)

I think the solutions weren't obvious - how did you find them ? I guess that's why you're a 'senior member' !

AB
12.June.2011
 

westaust55

Moderator
[I know it says "The CR and LF constants are pre-defined values (13 and 10)..." but this sentence is a throw-away buried in the recesses of maual one, not in a clear list of predefined symbols and other labels in manual 2.]
As well as page the mentioned page 79 (Tutorial 8) in PICAXE manual 1 (V7.5) , the only other reference are in manual 2 (V7.5) :
- examples on pages 148 and 149 the Reserved keywords list in Manual 2
- Appendix 2 - Additional (non-command) reserved words - as cr and lf ) (without further explanation)
 
Top