PDA

View Full Version : Programming Language and Syntax and response to my posting code.



paulvive
01-15-2012, 01:38 PM
Back in 1980 when I first started with computers and programming languages it seemed easier because I knew what I wanted the computer to do and I knew what I wanted to see on the computer screen and I was able to learn the syntax that was necessary to do it. There were manuals that you could learn the language and syntax from. There werenít any ďGUIísĒ only DOS to work with.. I donít know the syntax of Pbasic, yet, and I donít know what the Robot or Robotic module is looking for and if I did I wouldnít know how to provide it. IĎm used to reading a manual of whatever I wanted to learn. Learning it, understanding it and being able to use it . Iím having a difficult time with the Pbasic syntax, I donít know it and I havenít found a Book to learn it from. I canít learn it from bits and pieces of programs, although there are parts that I do recognize there is a lot that I donít. Maybe Iím missing the fact that there is a manual for Pbasic as there was for Ancient Basic and visual basic and other languages that I learned from reading a book. If so, I would appreciate knowing where to find it. A lot of guys have been a great help in helping me to get started in Robotics and I really appreciate it. I have to admit, but I donít intend it to be an excuse, but Iím 80 years old and my brain doesnít work as well as it used to but I donít intend to just sit in a rocking chair. I just wanted to say I really appreciate all of you for trying to work with me.

To some of the more recent replies about posting. I swear I used the right brackets, maybe I need glasses better than WalMart.

doggiedoc
01-15-2012, 01:46 PM
If you don't have a copy of the Basic Stamp Syntax and Reference Manual, you can download the book in PDF format free of charge from Parallax. Sounds like that may be just the ticket for you. Also Parallax has a lot of other learning resources available.

Doc


Here is the link to the BASIC Stamp Documentation Downloads page: http://www.parallax.com/tabid/440/Default.aspx

and the PDF of the manual: http://www.parallax.com/Portals/0/Downloads/docs/prod/stamps/web-BSM-v2.2.pdf

doggiedoc
01-15-2012, 01:59 PM
Also, in the Basic Stamp Editor there is online help within the program itself.

In this first screenshot - notice the icon of a book with a yellow question mark on the far right of the tool bar: Clicking that will open the online help for Pbasic syntax:

http://www.tegacayanimalhospital.com/images/postings/toolbar.png


The window should look like this (depending on your version of OS:

http://www.tegacayanimalhospital.com/images/postings/pbasic_help.png



Hope this is helpful!

Doc

paulvive
01-15-2012, 04:47 PM
Thanks. I guess I have a lot more reading to do.
One more question, once I learn and understand Pbasic I still have to know what inputs a particular Module or function needs so I know what to program. Foe example the SAY IT module. Wouldn't I need to know what inputs it needs to operate. Again the difference in writing a program for a computer it doesn't need anything but what I want it to have via my programming whereas a robot needs or looks for specific inputs which your program must provide. If I'm way off track here you won't hurt my feelings by telling me so, right now I feel stupid anyway. Thanks again for your input.

Duane Degn
01-15-2012, 09:10 PM
Paul,

I just want to make sure you have the SayIt documentation from the product page (http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/30080/List/0/SortField/4/ProductID/589/Default.aspx). The document 30080_SayItModulev1.2.pdf (http://www.parallax.com/Portals/0/Downloads/docs/prod/comm/30080_SayItModulev1.2.pdf)has all the SayIt commands listed, starting on page 15. I personally didn't understand the syntax of the SayIt so I "listened in" on the data exchange between the Prop and the SayIt GUI.

This is one exchange I recorded.


Say It: A
PC: lB ' set language to Italian
Say It: o
PC: lA ' set language to English
Say It: o
PC: gQA ' enter new password command
Say It: o
PC: nQAHZEBULUN ' enter password text
Say It: o
PC: eQA
Say It: o
PC: tQA ' train password 1st time
Say It: o
PC: eQA ' cancel train password
Say It: o
PC: eQA ' ?
Say It: o
PC: tQA ' train password 1st time
Say It: o
PC: tQA ' train password 2nd time
Say It: o
PC: dQ ' test password group
Say It: r
PC:
Say It: A ' the password "ZEBULUN" reconized
PC: gBA
Say It: o
PC: nBAIPASSWORD
Say It: o
PC: eBA
Say It: o
PC: tBA ' train "password"(index 0) 1st time (group 1)
Say It: o
PC: tBA
Say It: o
PC: gBB ' "password" reconized
Say It: o
PC: nBBKCALCULATOR
Say It: o
PC: eBB
Say It: o
PC: tBB ' train "calculator" 1st time (group 1)
Say It: o
PC: tBB ' train "calculator" 2nd time (group 1)
Say It: e ' error
PC:
Say It: B
PC:
Say It: B
PC: eBB
Say It: o
PC: eBB
Say It: o
PC: tBB ' train "calculator"(index 1) 1st time (group 1)
Say It: o
PC: tBB ' train "calculator"(index 1) 2nd time (group 1)
Say It: o
PC: gBC
Say It: o
PC: nBCGDIGITS
Say It: o
PC: eBC
Say It: o
PC: tBC
Say It: o
PC: tBC
Say It: o
PC: gBD
Say It: o
PC: nBDEPLUS
Say It: o
PC: eBD
Say It: o
PC: tBD
Say It: o
PC: tBD
Say It: o
PC: gBE
Say It: o
PC: nBEFMINUS
Say It: o
PC: eBE
Say It: o
PC: tBE
Say It: o
PC: tBE
Say It: o
PC: gBF
Say It: o
PC: nBFGEQUALS
Say It: o
PC: eBF
Say It: o
PC: tBF
Say It: o
PC: tBF
Say It: e
PC:
Say It: B
PC:
Say It: B
PC: eBF
Say It: o
PC: eBF
Say It: o
PC: tBF
Say It: o
PC: tBF
Say It: o
PC: gBG
Say It: o
PC: nBGFTIMES
Say It: o
PC: eBG
Say It: o
PC: tBG
Say It: o
PC: tBG
Say It: o
PC: gBH
Say It: o
PC: nBHKDIVIDED_BY
Say It: o
PC: eBH
Say It: o
PC: tBH
Say It: o
PC: tBH
Say It: o
PC: gBI
Say It: o

You can see I added some comments after some of the early commands. It helped be to understand how to use the various commands after seeing the commands the PC issued to the SayIt.

If you look at the replies from the SayIt, there are many "o" replies. Page 18 of the pdf has STS_SUCCESS | "o" | OK or no error status |. The other codes in the above exchange can also be found in the pdf. This helped me undstand the syntax better. Hopefully it will be helpful to you.

One concept that took a while to get into my head was that the SayIt only listens for one group of words at a time. Your program has to tell it which group you want to be active.

I thought Dave Xanatos did a great job explaining this.

Unsoundcode
01-15-2012, 10:18 PM
Hi paulvive, it can be frustrating to the point you think it will never come but then it clicks. The help file in the IDE that doggiedoc pointed out is a great resource and full of examples. Copying simple examples found on these forums will also help. Any questions you have post them here no one is going to deem you stupid for asking a question, we all have questions to ask not matter what level were at.

Keep practicing, over 50% of the PBasic instructions can be run without the need for any hardware whatsoever. Use DEBUGIN to enter values and DEBUG to view results. When it comes time you want to use some kind of hardware device just remember that the BS2 family are 5v devices with limits on their current capacity. Some devices just use on off values of either 5v or 0v respectively, more complex devices still use the Stamps 5v - 0v logic levels but usually there is some kind of communications needed. If its a Parallax device you can be certain example code exists, if its a third party device a good data sheet will help decide if it can be used with the Stamp.

There are not many 80 year old Stampers and I respect you all for keeping sharp.

Jeff T.

Duane Degn
01-15-2012, 10:38 PM
I’m 80 years old

Heck, this makes Leon seem like a spring chicken of only 69 years.