Data Transfer From the Propeller to a PC file Using RobotBASIC
SamMishal
Posts: 468
Hi All,
·
I have seen on this forum time and again people who enquire about how to effect data transfer
from the Propeller to the PC and to save the data to a file.
·
If you are a programmer you should be able to write a program on the PC to do this.
·
HOWEVER, most people are put off by the complexity of C++ or Java or· or or
·
WELL.....there is a SIMPLER and VERY EFFECTIVE language that you can use to do the
data transfer THE WAY YOU WANT IT....and not have to be limited by whatever tool
you may find out there that might approximate your needs.
·
If you can program in SPIN or PBasic then you should find that RobotBASIC· (www.RobotBASIC.com) is up to your
skill level and up to the task you want to do.
·
As an illustration of the solution I have here a SPIN program and a RobotBASIC program.
The Spin program will send data of all sorts (string, and decimals) to the RobotBASIC program.
·
The RB program will receive the data and save to a file. You can then read this file as a text
file or you can put it in Excel.
·
HOWEVER....if you require to do MORE CALCULATIONS on the data you do not really need to
take to EXCEL since RB is a FULL FLEDGED programming language and you can further manipulate the
data using ITS math and other functions.
·
The programs are just to ILLUSTRATE what can be done. The·numeric data·is transferred as decimal
text. You can also send the numbers as binary data if that is more up to what you want to do.
See this document for more on how to do this http://www.robotbasic.org/resources/RobotBASIC_To_PropellerChip_Comms.pdf
·
Also see this posting for more actions that RB can do...it is an interesting application (15th post down from top)
http://forums.parallax.com/showthread.php?p=845764
·
Remember, this is an example. YOU can do what YOU want...just program it in SPIN and in RB and the sky
is the limit. You have full freedom to do what YOU want with just a few lines of code.
Here is the Spin program....put it in the EEPROM (see the zip for the program file)·
·
Here is the RobotBASIC Program....also it is attached as standalone EXE that you can run without having to download the
RB IDE (also the source code is in the zip file).
Post Edited (SamMishal) : 10/7/2009 10:14:52 AM GMT
·
I have seen on this forum time and again people who enquire about how to effect data transfer
from the Propeller to the PC and to save the data to a file.
·
If you are a programmer you should be able to write a program on the PC to do this.
·
HOWEVER, most people are put off by the complexity of C++ or Java or· or or
·
WELL.....there is a SIMPLER and VERY EFFECTIVE language that you can use to do the
data transfer THE WAY YOU WANT IT....and not have to be limited by whatever tool
you may find out there that might approximate your needs.
·
If you can program in SPIN or PBasic then you should find that RobotBASIC· (www.RobotBASIC.com) is up to your
skill level and up to the task you want to do.
·
As an illustration of the solution I have here a SPIN program and a RobotBASIC program.
The Spin program will send data of all sorts (string, and decimals) to the RobotBASIC program.
·
The RB program will receive the data and save to a file. You can then read this file as a text
file or you can put it in Excel.
·
HOWEVER....if you require to do MORE CALCULATIONS on the data you do not really need to
take to EXCEL since RB is a FULL FLEDGED programming language and you can further manipulate the
data using ITS math and other functions.
·
The programs are just to ILLUSTRATE what can be done. The·numeric data·is transferred as decimal
text. You can also send the numbers as binary data if that is more up to what you want to do.
See this document for more on how to do this http://www.robotbasic.org/resources/RobotBASIC_To_PropellerChip_Comms.pdf
·
Also see this posting for more actions that RB can do...it is an interesting application (15th post down from top)
http://forums.parallax.com/showthread.php?p=845764
·
Remember, this is an example. YOU can do what YOU want...just program it in SPIN and in RB and the sky
is the limit. You have full freedom to do what YOU want with just a few lines of code.
Here is the Spin program....put it in the EEPROM (see the zip for the program file)·
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 OBJ D : "FullDuplexSerialPlus" PUB Main|x D.Start(31,30,0,115200) x :=0 repeat D.rx 'wait for Go ahead from RobotBASIC just one character if x == 15 d.Str(string(34,"END OF DATA",34,13)) '34 is the ascii code for " quit D.Str(string(34,"String data",34)) 'send a string 34 is ascii code for " D.Tx(",") 'then a comma D.Str(@Text) 'then a string from a variable D.Tx(",") 'then a comma D.Dec(x) 'then a number D.Tx(",") 'then a comma D.Dec(x*2) 'then another number (calculated) D.Tx(",") 'then a comma D.Dec(Value) 'then another number (from data area) D.Tx(13) 'then end of line x++ Dat Text Byte 34,"String Variable",34,0 '34 is ascii code for " Value word 240
·
Here is the RobotBASIC Program....also it is attached as standalone EXE that you can run without having to download the
RB IDE (also the source code is in the zip file).
Main: GoSub Message FName = ".\Test.cvs" //change this to anything you want '.\' means current directory h=FileCreate(FName) setcommport 10,br115200 delay 1000 //wait for propeller to be ready repeat //keep receiving lines until end of data comes in serout " " //signal the propeller to send the line st = "" repeat //input incoming bytes until there is a char(13) i.e. end of line serin s st = st+s until instring(st,char(13)) FileprintT h,st,char(10), //put the data in the file add char(10) for line feed print st //also on the screen to see it until instring(st,"END OF DATA") x = FileClose(h) end //----------------------------------------------------------------- Message: data IM;"This program will interact with a Propeller program as explained" data IM;"in the posting on the Forum.","" data IM;"You need to have the Propeller up and running with the program in EEPROM" data IM;"and then press OK to continue running. Press Cancel to abort the action.","" data IM;"The program will signal the Propeller to send its data and will wait for" data IM;"to arrive a line at a time (signaling before each line).","" data IM;"The line is then saved to a file as specified in the variable FName.","" data IM;"The data is also displayed on the Screen.","" data IM;"You can also read the file in a text editor or in Excel as a CVS format" data IM;"which means it is a Comma delimited data with TEXT surrounded with a pair of "".","" data IM;"Make sure the Propeller is running and Press OK to go on. Cancel will abort." if !MsgBox(IM," ") then Terminate Return //-----------------------------------------------------------------
Post Edited (SamMishal) : 10/7/2009 10:14:52 AM GMT
Comments
I take it robotbasic has a much smaller footprint on a PC?
And that executables are self contained?
Addit: scratch that. Yes, they are. I downloaded your attachment and ran it and it runs instantly and needed no installation. Sweet!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.smarthome.viviti.com/build
What an extraordinary little program. No installation needed. Runs instantly. Just two files, the .exe and the help file (in .rtf). Total space needed is just over 2mb.
So, lets throw something at it:
It runs straight away. Not one syntax error (I wasn't expecting that). Saves as a 162 byte program. (Bytes! Not kilo or mega bytes) So I compiled it. That took about 0.1 seconds and produced a single 1.5mb file that runs instantly.
What is the catch? There has to be a catch! This is brilliant!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.smarthome.viviti.com/build
Post Edited (Dr_Acula) : 10/7/2009 11:50:11 AM GMT
I'm not a BASIC user and perhaps never will be but RobotBASIC works perfectly on Linux under Wine. On Debian just download the executable to the Desktop, a double click on it and BINGO there it is running.
Just tried a few of the demos, all work so far, including 3d graphics. No idea if the serial port works under Linux/Wine yet though.
So it may get some use here after all.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheers,
Simon
www.norfolkhelicopterclub.com
Announcement: To cut costs in the current economic climate, we have switched-off the light at the end of the tunnel.
Ray
model or·Event-driven model.
It runs on any Windows version from Windows 95 to Vista 64...not tried on windows 7 yet. (why 7 ???)
It also can run on Macs and Linux using emulators like Wine and Virtual PC.
It is an INTERPRETER and a COMPILER. It produces a standalone EXE out of your Code that you have run and
tried out using the VERY SAME interpreter IDE.
The program can be run from a thumb drive without ANY INSTALLATION, none of this screwing around with the Registry and setting
up directories and and and .
It does not require LOADS of daily updates of .NET support and monitoring of your system by MS.
Just run it from any where you want ......you can even run it from our website without downloading it and
saving it.
You can play some games (animated and not animated) without any downloading just run from the site
from this page http://www.robotbasic.org/11.html·go there and try some of the games...Lunar Lander my
favorite and second is MishMash...
It also has an integrated Robot Simulator and an inbuilt protocol for controlling a suitably programmed REAL Robot
using the very same simulator programs over a wireless serial link (Bluetooth or Zigbee etc,). See this two part video
http://www.youtube.com/watch?v=i5JT4WdMofQ&feature=channel_page
http://www.youtube.com/watch?v=vftgmZQCheA&feature=channel_page
Also see this video that shows how easy it is to program a simulated robot to follow the contour of an object
http://www.youtube.com/watch?v=27Gt3IgdcMc&feature=channel_page
Also see these for the ANIMATION abilities of RB
http://www.youtube.com/watch?v=EULYbnAxJu0&feature=channel_page
http://www.youtube.com/watch?v=mCHS7-WligU&feature=channel_page
Also as an engineer·that can use a TOOL to achieve results you can see what can be done with RB
http://www.youtube.com/watch?v=GV55FM1DJy4&feature=channel_page
Also if you are interested in Robotic Arms see these two videos
http://www.youtube.com/watch?v=AukHmkZqmys&feature=channel_page
http://www.youtube.com/watch?v=Q94WKdn3uF8&feature=channel_page
RobotBASIC also has a suite of IMAGE CAPTURE and image manipulation commands and function to
do VISION applications. See this video
http://www.youtube.com/watch?v=LwvspYFXJMM&feature=channel_page
There are also THREE BOOKS about RobotBASIC
Advanced:
http://www.amazon.com/Robot-Programmers-Bonanza-John-Blankenship/dp/0071547975/ref=pd_bxgy_b_img_b
Intermediate:
http://www.amazon.com/Robots-Classroom-RobotBASIC-Hardware-Required/dp/1438233728/ref=sr_1_3?ie=UTF8&s=books&qid=1253752020&sr=1-3
Beginners
http://www.amazon.com/RobotBASIC-Projects-Beginners-exploration-simulation/dp/1438233434/ref=pd_bxgy_b_img_b
Also there has been·8 articles so far (3 more to come) in Servo Magazine (to come in N&V too). Here is one
http://www.servomagazine.com/media-files/971/A_Robotic_Puppet-SV200811.pdf
The latest version of RobotBASIC can also send and receive data·using the·TCP and UDP protocols over the Internet or LAN/WAN
and can also send an email using SMTP. See this PDF for what can be done
http://www.robotbasic.org/resources/RobotBASIC_Networking.pdf
Also see this demo program that was used to CHAT between two computers from Australia and USA and at the same time control
the inbuilt simulated robot
http://www.robotbasic.org/resources/TCP_Robot.zip
RobotBASIC is very capable and handy TOOL. If you are an engineer you should be able to utilize any tool to achieve
goals with no nonsense and fuss over what you prefer to use. If a tool achieves what you want to accomplish easily
and effectively then you should use it. If I like my hammer so much that I try to unscrew a screw with it just because I
prefer it over a screw driver then I am a little bit·screwy (pun intended).
Regards
Samuel
Post Edited (SamMishal) : 10/8/2009 12:53:12 AM GMT
Thanks for the vote of confidence.......there is no catch at all....just do not expect C++ performance.
But as you can see from all the demo programs and the videos and article and books, you can do A LOT
with ease and convenience that many have forgotten these days.
How great would it be to carry around on a Thumb Drive a tool that can allow you to PROGRAM applications
and accomplish things. Try to do that with ANY THING out there these days.
RobotBASIC can be as simple or as complex as you need it to be. Some of the MATRIX operations and
ARRAYS abilities as well as Image manipulation commands would take you days to do in most other languages.
RobotBASIC is also a great educational language that can be used to motivate and excite young ones about
engineering. See this document that discusses this very point
http://www.robotbasic.org/resources/RobotBASIC_AnEffectiveEducationalTool.pdf
This is perhaps the most important aspect of RB. Its ability to make young ones come back to engineering
in an interesting and motivational forum without overwhelming and frightening them.
Thanks
Samuel
Post Edited (SamMishal) : 10/8/2009 12:55:52 AM GMT
Thanks for the good word.·I really do hope that you would use it. As an engineer you have a TOOL BOX of tools and
you use the tool most suitable for the task at hand. No?
Well, you can think of RB as another tool in your box.
As an example of a NEED that has been met by RB's tool like abilities see this·posting (15th down)
http://forums.parallax.com/showthread.php?p=845764
In this scenario it would have taken me days to program the same thing in C++ or Java or even Python. With RB
it took me 3 hours. So here is a tool that can do the job. I used it. Regardless of my preference for other tools
that are GREAT but for the job at hand they are an OVERKILL or even BURDENSOME.
Horses for courses as I am fond of saying.
The communications program shown·in this posting·took me 32 minutes and that was including the SPIN program and
trying out the CVS file with Excel.
Thanks
Samuel
Post Edited (SamMishal) : 10/8/2009 12:59:32 AM GMT
humanoido
Yes please!
Or is it just that humanoido wants to get to 100 languages [noparse]:)[/noparse]
I think Bean and others were working on Basic for the prop. Haven't heard anything for a while, which I take to be a Good Thing, as it means lots of coding is happening.
I'm stuck at work at the moment but am looking forward to getting home and testing out a few things on Robotbasic.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.smarthome.viviti.com/build
Horses for courses…….I advocate the use of RobotBASIC on the PC because it is
1-····· Easy to use and easy to learn
2-····· Capable
3-····· Even a beginner can achieve great stuff with it
4-····· Well coupled to the platform it’s meant to run on
5-····· Provides access to the hardware in an easy and intuitive way
6-····· Has certain advantages over other available languages
Well……there is a language that already has these features and MORE available for the Propeller….SPIN….
If anyone asked me what is the BEST HLL language to use for the Propeller I would answer without any hesitation or caveats ….SPIN…..
Besides, there are people who have produced or are in the process of producing a BASIC for the Propeller. I do not think there is a need to reinvent the wheel so many times over especially when this reinvented wheel is not going to have any advantages whatsoever over the already well Spinning wheel...SPIN….
I do not see any point for me to spend the time and effort required for adapting RobotBASIC to run on the Propeller especially when all is done the result would be INFERIOR to·the Propeller's beautiful native language·and would provide no advantages whatsoever over....SPIN....
Regards
Samuel
A computer language, including BASIC and its dialects, is like a wheel. As far as "reinventing the wheel," it's a good thing and represents not only an inevitable step of progress but adds to a necessary repertoire, a cache of languages containing variety and spice of life. Each wheel has a specific function and purpose and added value meaning. For example, we have wheels that are easy to use, some with many purposes and some with only one purpose, some that fit many cars and some that fit only some cars, some are easy to drive and get good handling and increased gas mileage, while others are more complicated to handle - some wheels are greatly improved while some are made to fit in tight spaces. Some can serve many different road conditions while others are good for only mud, snow, rain, or a sunny day. Some are studded and will get you to where you want to go. There are those that are easy to change. ...Quiet wheels and loud wheels, smooth and soft wheels or hard and stiff wheels - there are tiny wheels and big wheels, fast race wheels and wheels with long life or those short lived, fancy wheels and spartan wheels, reinforced ply wheels, tubeless wheels... There is a wheel for every purpose and every car platform. In summary, as ROBOTBASIC has its own desirable unique flavor in a BASIC language, it is undoubtedly a worthwhile project for someone to create a version that runs on the Propeller chip.
humanoido
What if a SPIN emulator running under Windows could serve as the PC software development platform as well ?
I agree with the earlier comment that the best high-level language for the Propeller is in fact SPIN. Why not provide a free software development platform for the PC which follows the existing SPIN syntax closely but with the addition of GUI buttons, etc. and floating point operations ? In this manner, someone new to the Propeller would not have to learn both Robotbasic and Propeller spin syntax. This would be critical for young people involved in robot clubs at school learning about programming for the first time (like my 9-year-old son). What is learned using the emulator on the PC (at home after school) could be ( with little modification) transferred to the Propeller robotics environment at the next club meeting. It is this easy of transference which would be of greatest value (as compared to Robotbasic).
A SPIN interpreter for Windows would introduce an "object oriented" programming style which is Robotbasic's key weakness. With the object-oriented nature of SPIN, a wide collection of objects contributed by members of this forum could serve as 'extensions' to the basic language. These community-grown objects would hide complexity from the beginning programmer. The OBEX concept provides a powerful educational tool.
Perhaps the SPIN interpreter could be configured for either STRICT Propeller Compliance (when used as an emulator) or WINDOWS-MODE (when used to develop a GUI interface/control panel/data logger interface for the PC). I personally still use the old Visual Basic 6.0 development environment because of the easy with which a user interface can be rapidly constructed. It would be significant if someone could overcome the hurdles of putting together a development environment where text boxes, buttons, and picture boxes (which can be dragged and resized) could be integrated with a clean quasi-object-oriented language like SPIN with floating-point math addition.
I'm certain my thoughts are full of holes .... would welcome feedback....
Ted: “You can do that….747, A320, Gulf Stream etc.”
Tom: “Ah…but I love my Hummer so much…it has all I need for the road….I think I should fit wings
········· on it and a rocket engine and that way I can go to London much faster and I can do it inside
········· my beloved Hummer….what do you think?"
Ted: “But you do not need to do all this…if you need to go to London now….you can do it now…”
Tom: “But all those means with which I can get to London lack something or another, my modified
·········· Hummer will rectify all those shortcomings and be faster etc. etc.”
Ted: “Oh well …..”
·A year later Ted sees Tom in Home Depot:
Ted: “Hi Tom did you ever get to London…I went there a few times this year and thought about you?”
Tom: “Oh no I am still modifying my Hummer…It seems that they do not make rocket engines that
·········· are fast enough….so I am making my own rocket engine…..that is why I am here now”
Ted: “Oh well….I am on my way to Paris in a few hours...I will have to rush....good luck with your Flying Hummer
· ······· By the way....do you have a Pilot's license?”
Tom: "Oh no...not yet....I will get that once I finish my project......"
Ted shakes his head with amazement and trods off to Paris with·the albeit·less than ideal means that are available NOW
for him to achieve his GOAL.
Post Edited (SamMishal) : 10/9/2009 4:13:04 PM GMT
I remember somebody wrote a lean-GUI for the propeller where you can define menus and windows.
Text based GUI for VGA_HiRes_Text Driver (revised)
It should be easy to port this from SPIN to robot-basic
Of course this is not the same as a GUI like the one that is supportet f.e. by delphi where you just drag and drop buttons and Textedit-fields etc.
It's a first step to there. What do the developpers of robotbasic think about adding a GUI ?
On the other hand if the GUI is added it gets more and more complicated to write applications and the exefiles will become bigger too.
You will need several files or special sections in one file that define all the GUI-stuff.
and you will need
a) code a GUI-elements handler (like in C)
b) event-orientated code to handle all the GUI-element-events like click on button enter focus loose focus etc. etc.
So I think if robotbasic should keep its easy to use style it should stay textbased
If somebody gets advanced in programming robotbasic he can switch over to something else
Does somebody know about a RAD-programming language that is portable like robotbasic ?
I mean just a few files on a USB-stick start IDE.exe drag and drop GUI elements
best regards
Stefan
RobotBASIC·IS FULLY GUI.....by looking at ANY of the videos I posted the links to in the above post you would see that.
GUI = Graphical User Interface............
RobotBASIC has 2d and 3d graphics. It has Edit Boxes, Push Buttons, Spinners, Memo boxes, Drop Down lists,
Sliders, Radio Buttons, Check Boxes etc. etc. Joystick Input, Mouse Input, Keyboard Input, Webcam Input
Internet I/O, Serial I/O, Parallel Port I/O, Image Manipulation Commands, and and and and and....
See this video and tell me how more GUI do you want to get
http://www.youtube.com/profile?user=john30340#p/u/21/GV55FM1DJy4
Also see the 3D-Graphics
http://www.youtube.com/profile?user=john30340#p/u/19/VCZTkabhfyQ
Also, you can use an Event-Driven model or the sequential model of programming.
Also RobotBASIC has the ability to do Input and Print......So the programmer can progress in RB from the
SIMPLE
to the INTERMEDIATE
to the ADVANCED.... And all within the GUI fully Windows environment.
So you can write a program that goes like this
Or you can write a program like this
Run The EXE in the attached Zip file and see how GUI version runs.
This is a power of RB. You can use it in the simple quick way....so a BEGINNER can do something QUICK
and also you can do the more sophisticated way so that a more ADVANCED user can do MORE.
How many languages can you whip out and try a formula for instance with.......lets say you wanted to
test an ALGORITHM quickly.......without having to go through all the hassles of setting up a GUI user interface
just to enter a few numbers and to display a result or two.....
As an example of this kind of thing....here is a program I did in a few minutes to try out how a DTMF signal
generator would work in INTEGER math just like you would do on the Propeller.
and here is a sample screen output....
hey that's really great. I got a wrong picture about Robotbasic as somebody wrote something like
"would like to have a GUI...."
What have I learned from that ? Judge only what you have seen yourself
robot-basic seems to be one of this rare software-jewels that were only found once in five years
to be OT
my personal software jewels are
dtsearch the fastet fulltext search-engine I know
1Griff meaning one grip or one click
create a customized menu to open an explorer in a sub-sub-sub-sub-sub-dir xy by just one click
KatCeDe
create a database about all files of a dvd (even every single file in a ZIP or RAR or whatever archive even if the archives are nested
UltraEdit the absolute outstanding Texteditor who leaves everything else miles behind
instant filename search
reads in my whole harddisk with 370.000 files in 30 seconds
every search on any file done in 0.2 to 2 seconds
best regards
Stefan
-dan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Arguing with myself--sometimes me, myself, and I don't always agree.
(Former) Caterpillar product support technician
as a tool among your tools.
Samuel
·
·
THANKS VERY VERY much for this.........I wanted to try RB on Win 7 and was waiting for it to settle down
so that I would try·RB with it on a system.
·
It is GREAT to know that·RB runs on W7 too....so now I can safely say that it runs on every Win OS from 95 upwards.
·
·
The program you posted REMINDED me that in addition to the Procedural and Structured programming style
RB also supports the OLD BASIC style........I don't know of ANY dialect of BASIC that can do that.
·
So you can use RobotBASIC to STILL run old BASIC programs (with a bit of syntax change) from OLD MAGAZINES
or old SCHOOL BOOKS etc.
·
You do have to do minor syntax changes...but not...structural changes. But most importantly is that
RB can still support old programs from things like Engineering books and magazines.
·
Does anyone remember the old magazine articles and books and math books and engineering books that
showed some algorithms for doing things using BASIC...............
·
How many languages can still support these programs....RB can with very minor syntax changes
for things like a function name but not STRUCTURE of the program....you can in most cases
just type the program as is and most of the time it would run in RB.....try it with some
old magazine. If you are on old fart like me you should have some still lying around.
·
·
Samuel
·
The following code shows the VARIOUS ways RobotBASIC can be used to do the SAME THING
Post Edited (SamMishal) : 10/12/2009 12:34:05 PM GMT
I have noticed that many people on this forum love RETRO technology. Also in response to the stroll down memory lane
that Icepuck induced (see above) I went through some old stuff I had.
I found the manual for the old Sharp PC121 pocket "PC" calculator I used to own eons ago. I still have the device
but it is the manual I was interested in (see pictures below).
I took a sample program from the manual (see image below) and I typed it with very few changes into RobotBASIC.
The program is for finding the roots of an equation using the Newton Raphson iteration method.
As you can see from the code below it WORKS in RobotBASIC as is (with very few syntax changes).
I also show another version of the program below it with the more modern BASIC style. However, that is still not
very good as far as programming is concerned, so I also enclose a better version of the program that is more readable
and understandable.
HOWEVER......doing this exercise started me thinking........ MANY people these days find it VERY difficult to understand
or design ASSEMBLY programs............
I think the reason for this is that people have not been exposed to GOTO-Style programming. People are used to the
structured style of programs with Function Calls and already done for them Stacking and they are shielded from what
REALLY goes on at the machine level.
I think if people were to be exposed to the old style of programming using GOTO (JMP in assembly) and GoSub (CALL in assembly)
and had to do their own Variable stacking and parameter stacking then they would be much more able to understand and design
ASSEMBLY programs...........
So in this too RobotBASIC can be helpful.....you can use RB in the strict Goto-style and expose students to the nuances
of assembly-style machine level programming but without having to use an assembler and the whole development cycle required
to test and run assembly programs....RB is an interpreter and they can get immediate feed back and results etc.
JUST A THOUGHT.........
Here are the three programs (notice how RobotBASIC·supports·such disparate styles ...·how many·languages can do this???):
This one is the exact translation from the original (see picture below)...notice the minor syntax changes
·This one is a SLIGHTLY more modern with a repeat-until loop
This one is MUCH better and more readable....however see my thought above about ASSEMBLY programming
How compatible is Robotbasic with the old MS-DOS QBASIC or QB BASIC ?
We have significant code written in QBASIC for running some established physics lab experiments. Over the last decade we have been able (surprisingly) to maintain communication to lab instruments (with GPIB interfaces, serial, etc) using the old language.
I like the generous data i/o options afforded by RobotBasic, and will likely use it to provide a free GUI interface to GPIB-controlled instruments (communicating with the Propeller equipped with a GPIB controller object ! ) in the near future.
But how much trouble will it be to convert this old code to full RobotBasic compatibility ? Have you developed a short document which highlights these key differences ? A list of differences would make quick work of the conversion effort.
Sorry I have not responded earlier....I was away and also very busy with finsihing off a New version of RobotBASIC to be out SOON.
RobotBASIC is very much compatible with GW-BASIC (remember??). I am NOT very familiar with QBASIC. However, I read about it in response
to your request and from what I see, it is an extension of GW-BASIC.
I found a few programs on the web written in QBasic and I have translated them to RobotBASIC for you to have a look and compare the two
(see below) and judge for yourself.
If you send me one of the programs I would be very happy to TRANSLATE it for you....I do not have a GPIB interface but I can translate the
program and you can try it on your system.
What OS are you running this stuff under...DOS?
· Thanks for taking the time to look into RB and I hope you would find it up to your requirements. I am very happy to help out
with the conversion if you wish.
· There are MANY LITTLE differences. For example QBASIC uses %,$,& etc to indicate variable TYPES. RobotBASIC does not REQUIRE this and does not
allow for the use of these symbols with variable names since they are used as OPERATORS.
So as an indication of the effort, you would have to go through the programs and REMOVE all these symbols from the ends of variable names.
Also there are little ANNOYING things that would not cause a SYNTAX ERROR ...but....would cause a run error. For example QBASIC use
END IF (notice the space) while RB uses ENDIF (notice no space)....But RB also uses END and thus will see the END IF as an END and will end the
program. So you have to go through the program and change all END IF to ENDIF.
Also QBasic uses do-until· RB uses repeat-until. So differences like this HAVE to be addressed.·Some things are a matter of Using Serach-Replace,
but others would need·some effort to translate (e.g. File I/O see sample code below).
In any case here are a few SAMPLE codes that you can have a look at to see syntax differences.
Regards
Samuel
Post Edited (SamMishal) : 10/19/2009 8:24:43 AM GMT
or design ASSEMBLY programs..."
Interesting.
When I first learned programming in a technical school we were taught BASIC and assembly language. It was not a real assembly language but an assembler for a pseudo machine. We could not use real assembler on mainframe we logged into for the class.
After that I heard a lot of nonsense about how BASIC is the "leading cause of brain-damage in proto-hackers." encyclopedia2.thefreedictionary.com/BASIC+language due to it's lack of structure, use of GOTO etc. And how structured languages are better.
At the time I tended to agree. I'd rather use C, Pascal, Algol, Ada etc etc than BASIC.
BUT what you are saying is totally the opposite of that commonly accepted "wisdom". That structured programming takes one away from the reality of the machine and cripples ones mind to assembly language programming. Gets worse when all you learn is objected orientedness in C++ or God forbid Java.
Given that some of the smartest and most productive programmers for the past few decades got their intro to computing via early 8-bit micros with BASIC and assembler. It seems you are right. BASIC does not induce brain damage but is actually beneficial[noparse]:)[/noparse]
I guess it's like the driver of an auto shift car has less concept of what a gearbox does than the driver of a stick shift. Who in turn is in the dark unless he has ridden a 5 speed bicycle where one can FEEL what the gear ratios do.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
no matter how it might challenge the accepted main line of thinking or his own current thinking.........
Most people who are pushed out on the hapless world of programming these days are not really programmers. They can use a particular tool
to appear to be programming....
Programming is all about THINKING UP ALGORITHMS, not about coding....Let me put it this way........Anyone can use A word processor·to write
............but not everyone is a WRITER........... Programming is about implementing algorithms no matter HOW.......
As an example......think of the ubiquitous PUSH BUTTON......most programmers these days can utilize a push button
and write event-drivers for it and THINK THAT they can program a push button.
BUT.......how many programmers can program a push button if their language does not have one??????
How many programmers can actually MAKE a push button or at least·can APPRECIATE what it takes to make one...or can understand
what is required to make one.....??????????·How many programmers understand the concept of debouncing a button in code.
As you say most Great Programmers have learnt·to THINK OF WAYS to OVERCOME the limitations and·GET THE MOST OUT of whatever
tool they have at hand.
How many programmers understand that C++ is just C with some work already done for you and some·restrictions imposed on you by the compiler....
and that C is just Assembly with some work already done for you and some restrictions imposed on you.....etc.
Good analogy...............
Post Edited (SamMishal) : 10/23/2009 8:06:05 PM GMT
To put it another way, I'm thinking like the people who wrote this program. Or vice-versa. And that makes the programming experience so much more enjoyable as you can get on with writing the code rather than fighting with the language.
Humanoido is trying to get 100 languages on the Propeller, and he is getting very close. I've contributed a few of those, and this has me thinking. How many languages are there that could run both on a PC and on a Propeller? With no changes to the syntax?
Maybe there is one, but the answer is eluding me at the moment (it is Midnight here. Dr_Acula prefers to work at night...)
I wonder if Robotbasic could become that language? Imagine
And you run that on a PC. Then you run it on a Propeller on one of the standard Parallax boards, and behind the scenes it drops in the vga driver code and the clock speed code etc etc and 10 'hello"'s appear on a vga screen when you run the program.
Hmm - I need to go back and look at what Bean is up to...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.smarthome.viviti.com/build
Think of PSEUDO-CODE....if you are teaching novices to do some programming you would (and should) use pseudo-code to develop some algorithmic thinking and design. Now when it comes time to IMPLEMENTING the pseudo code you need a language that is as close as possible to the pseudo-code so that again the learner does not have to be overwhelmed with meaningless (to him/her) complexity.
Consider this Pseudo-Code
Implemented in RobotBASIC it looks like this: (consider the almost 1 to 1 correlation)
The above RUNS as is.... IMMEDIATELY.....no additional syntax needed in ANY WAY.........
The code in C++ looks like the following: (consider the·poor correlation to the pseudo code)
ALSO.......The RobotBASIC program is a GUI one and runs in a WINDOW and is a full Windows program, while· The C++ program above is a CONSOLE program----i.e. DOS program that runs·in a DOS-STYLE console......if you wanted to do it as a Windows program you will·be doing things WAY beyond any beginner level programming and the correlation to the pseudo-code is UTTERLY LOST.........
ALSO...... when later you want to progress to higher levels and more sophisticated programming, RobotBASIC can do it in SURMOUNTABLE STEPS that the learner can achieve progressively.
Consider this program in RB that is at a slightly higher level with Pop-Up Dialogues to do the same as above:
BUT....ALSO....even for a non-beginner......if you want to try out an Algorithm·QUICKLY......you can do it in a SMALL FRACTION of the time in RobotBASIC as you would in C++ and you can do all sorts of GRAPHICS not just text stuff.
Even with Python or Perl you do not have as much versatility either....RobotBASIC is a good tool in many ways....
I think of it as my Programming Swiss Army Knife......I never travel without one....so many tools (albeit not as good as individual ones) put together in a HANDY small package that I·can whip out and do what I want QUICKLY.... (you can carry RobotBASIC on a Flash Drive as small as a SAK).
Sam
Post Edited (SamMishal) : 10/23/2009 8:07:13 PM GMT
From a beginners teaching perspective I guess I'd agree. But the C++ version will compile unmodified on pretty much every platform currently available. It's horses for courses.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
lt's not particularly silly, is it?
Comparing C++ to RobotBasic stiffens your point as it is "leading" the conversation in your favor.
If you picked the less cryptic standard C method (also available in C++), you have a weaker argument.
I'm sure your work brings joy to many of the uninformed masses; in that respect I wish you continued success.
But as you agree....RB is a good TRAINING horse...but just as·with a training horse it can also be used
by experienced riders for a quick ride around the corner and for a nice stroll in the outback.....you may not
win any shows with it but you can definitely·use it·for a nice ride.....
Samuel
Post Edited (SamMishal) : 10/22/2009 12:28:19 AM GMT