serial terminal - how to write to it to see debug results?
rikki
Posts: 53
Hello,
I am a beginner, making very little progress.
I have a Propeller Mini and a Spinerette.
I am working in Propeller Tool.
I have spent time in the book "Programming and Customizing The Multicore Propeller".
I have opened and reviewed many examples fom the OBEX as well as the library packaged with the Propeller Tool, and I have searched this forum.
I see in the book examples that seem to be print statements to the serial terminal.
For example I see the instruction pst.
I find no explanation of pst in the book, nor in the Propeller Manual in the Prop Tool HELP, nor the quick reference sheet.
It isn't listed in the book's index or table of contents.
I see in the book statements such as pst.Str(String(" some text ")) , but if I include such a statement in my exploratory code, I get a compile error :
/home/rick/PropellerLibrary/rs/stateMachine.spin(72:5) : error : Expected an instruction or variable
Line:
pst: "output 16 is ON"
Offending Item: pst
As a total beginner, how do I include print statements to display debug info as I work?
A google search finds this link:
http://learn.parallax.com/support/reference/using-parallax-serial-terminal
The Serial Terminal, but this page explains only how to invoke the terminal, with no explanation at all how to write to it.
Thanks in advance for your attention and time.
I am a beginner, making very little progress.
I have a Propeller Mini and a Spinerette.
I am working in Propeller Tool.
I have spent time in the book "Programming and Customizing The Multicore Propeller".
I have opened and reviewed many examples fom the OBEX as well as the library packaged with the Propeller Tool, and I have searched this forum.
I see in the book examples that seem to be print statements to the serial terminal.
For example I see the instruction pst.
I find no explanation of pst in the book, nor in the Propeller Manual in the Prop Tool HELP, nor the quick reference sheet.
It isn't listed in the book's index or table of contents.
I see in the book statements such as pst.Str(String(" some text ")) , but if I include such a statement in my exploratory code, I get a compile error :
/home/rick/PropellerLibrary/rs/stateMachine.spin(72:5) : error : Expected an instruction or variable
Line:
pst: "output 16 is ON"
Offending Item: pst
As a total beginner, how do I include print statements to display debug info as I work?
A google search finds this link:
http://learn.parallax.com/support/reference/using-parallax-serial-terminal
The Serial Terminal, but this page explains only how to invoke the terminal, with no explanation at all how to write to it.
Thanks in advance for your attention and time.
Comments
To print to the serial port you need to format your line like this, really you should have just replaced some text with output 16 is ON You forgot the parenthesis and the String formatter, you also added a colon : which shouldn't be there.
the pst "instruction" isn't actually an instruction, its a label for a file located in the propeller tool's code database.
in this situation you have a OBJ area that has a line similar to this:
This is actually a reference to the file FullDuplexSerial.spin located here: C:\Program Files (x86)\Parallax Inc\Propeller Tool v1.3.2\Library\
Propeller tool automatically searches that pathway for any objects specified in the OBJ block, even though you only provide the filename without the .obj or pathway.
You can view the Propeller library by clicking File-->Open From-->Propeller Library
That prompts you to choose a file from the library that was installed with propeller tool.
If you choose FullDuplexSerial.spin you can view the code that pst.str invokes.
Oh BTW, make sure you include this code at the very top of your program, it "initializes" the serial port. Many here do not have a copy of the book you are referencing so we cannot see the code you are running, which is why I suggest pasting your code here.
Thank you for your help.
It's beginning to become clear to me now.
I should have realized that "pst" is a reference to a separate source file.
I have not yet began to follow the compiler's personality and messages very well.
the code following returns an error:
/home/rick/PropellerLibrary/rs/testcode.spin(16:18) : error : Expected ","
Line:
pst.Start(115_200)
Offending Item: )
OBJ
pst : "FullDuplexSerial"
VAR
long state,nextstate
PUB states
' initialize the serial terminal
pst.Start(115_200)
'view results
if state == 0 AND ina[16]
pst.str(string("output 16 is ON"))
I think a sub-forum named "The Kiddie Pool" is called for, to receive questions from we clueless uninitiated types.
There is a later version, 4.89 but is has issues.
Edit: Forgot to mention that it allows you to watch variables and has many more cool features.
Indeed! Thank you for that sir!
It's a .zip file... not Windows I trust? If so has anyone tried it in Wine?
Tell me please about PropBasic if you have a minute or two..
.
Windows only, I have never used Wine, sorry.
I regard PropBASIC as a Macro-PASM or a PASM-RAD (Rapid Application Development) tool.
I am not fluent in PASM but I need my cog code to execute at full speed (20MIPS @80MHz).
PropBASIC has a very easy to read/write BASIC syntax and translates directly to PASM code.
You can further optimize the generated PASM code, by hand, although this has never been necessary for me.
You have the option to mix cog-code (20MIPS) with LMM code (4-5MIPS), also.
ViewPort supports PropBASIC as well as SPIN and there is some example PropBASIC code included in the .zip file that you downloaded from my DropBox.
I believe that regular SPIN code executes at somewhere between 0.3 and 0.5 MIPS.
I mistakenly told you the wrong initialization code.
I forgot to include the pins.
Heres the syntax: start(rxpin, txpin, mode, baudrate)
So your code would probably be:
A bit late on getting back to ya, wonder if you got past this.
I have used "{" and "}" but you need to replace them with "[" and "]" to work!!
{code}
paste your code here
{/code}
Alternately, you can use PropTool File/Archive... to put all your code and objects into a zip file and attach that to your post.