PropBASIC
Discovery
Posts: 606
in Propeller 1
Hi,
I just finished several projects that use BS2 and Propeller micro controllers. I enjoy writing programs in BASIC so I focused on coming up to speed on PropBASIC 0.1.14.
I downloaded Propelleride with PropBASIC and installed the ide correctly on my laptop with Windows 10 operating system. I also downloaded the PropBASIC 0.1.14 instructions manual. The Propeller Activity Board is connect to the USB port com3.
On page 2 of the manual is a very simple program that should blink an LED on pin 16. The program is as follows:
DEVICE P8X32A
LED PIN 16 OUTPUT
PROGRAM Start
Start:
TOGGLE LED
PAUSE 1000
GOTO Start
After performing a BUILD on the code...the compiler gave errors on each line of code... "expected end-of-line or "["". At the top of the window in bold face the result of the compile was SUCCESSFUL...which it was not since the program was not running.
The description of each line of code is so simple...it is hard to imagine what is wrong.
What is wrong so that I can begin writing PropBASIC programs for my next set of projects? I could use your help.
Sincerely,
Discovery
I just finished several projects that use BS2 and Propeller micro controllers. I enjoy writing programs in BASIC so I focused on coming up to speed on PropBASIC 0.1.14.
I downloaded Propelleride with PropBASIC and installed the ide correctly on my laptop with Windows 10 operating system. I also downloaded the PropBASIC 0.1.14 instructions manual. The Propeller Activity Board is connect to the USB port com3.
On page 2 of the manual is a very simple program that should blink an LED on pin 16. The program is as follows:
DEVICE P8X32A
LED PIN 16 OUTPUT
PROGRAM Start
Start:
TOGGLE LED
PAUSE 1000
GOTO Start
After performing a BUILD on the code...the compiler gave errors on each line of code... "expected end-of-line or "["". At the top of the window in bold face the result of the compile was SUCCESSFUL...which it was not since the program was not running.
The description of each line of code is so simple...it is hard to imagine what is wrong.
What is wrong so that I can begin writing PropBASIC programs for my next set of projects? I could use your help.
Sincerely,
Discovery
Comments
Did you set the compiler option in propellerIde to use propbasic?
Also... did you save the source code with .pbas file suffix? (Instead of .spin)
No, the source code was saved as .spin. I will make the change and try again.
Thanks,
Discovery
The code compiles but I do not see pin 16 flashing on and off at a 1 second period.
I wanted to send some printed information to the computer screen for debugging but I don't see anyway to do that based on the instructions provided in the PropBASIC manual. In BS2 code there was a DEBUG command.
Sincerely,
Discovery
When I run the compiler...it outputs (0) warnings and (0) errors but when the program is run, the entire screen flashes and the last line is in RED and says ERROR: Download timed out.
I could use some help here.
Sincerely,
Discovery
I just downloaded PropellerIDE 0.38.5, pasted the blink program into the editor, Save As blink.pbas, clicked on the green RUN arrow and the program compiled and loaded. It is sitting in front of me blinking at 1 second intervals. Changed the Pause line to 500, hit run and now the LED blinks twice as fast.
The PropBASIC Manual under Help indicates the PropBASIC version is 0.01.43.
Version 0.38.5.amd64 for Windows 10
Installed, pasted in your code snippet (with LED changed to pin 26) and saved as Test.pbas
Connected a Propeller FLiP to the USB port and pressed Run. LED blinks as expected.
So that confirms your code works. I won't have access to an Activity Board until the morning, but in the meantime, is it sure you have the power switch on to at least position 1 ?
And did you notice if the WX LED near the USB socket is lit? Maybe try adding a jumper wire from the SEL socket to GND or 3.3V (one of those will select WX, and the other will switch it off). You want it turned off for USB programming. You'll find that SEL socket to the right of the metal crystal can.
If you don't have the WX LED, then maybe you have an older Activity Board that requires power at the DC Jack. You could try that anyway. Your ERROR: Download timed out message would suggest a communications issue with the Activity Board, and that is most likely an FTDI driver issue, USB cable bad connection, or lack of power at the Activity Board.
I'll check in tomorrow in case this doesn't get you going. Best of luck.
Next question...How does one display data to the computer screen using the basic program instructions? DEBUG works fine on the BS2. I see no instructions for doing the same in PropBASIC.
Sincerely,
Discovery
Sincerely,
Discovery
Program works with AB-WX, with or without the Wi-Fi plugged in.
I haven't used PropBASIC in a long time, so this code may need adjusting for the latest version of the compiler. Attached is a library that does formatted serial output (it's basically a translation of the transmit routines from FullDuplexSerial). Some of this is a little advanced because I know how to exploit the architecture of PropBASIC (while at Parallax I worked with Bean on SX/B) and I'm comfortable with PASM.
Then...is PropBASIC essentially dead?
Discovery
I would not say it is dead. It has worked well for a few years, but don't look for any upgrades soon. It's like Basic Stamp and SX/B , they where written, published and can be used in the current state.
For me, Spin wins. I live, breathe, and think in Spin; all of my Propeller consulting is done in Spin. That said, there are others who do amazing things in PropBASIC, C, Forth, and now Blockly. That's the great thing about the Propeller: you get multiple cores and the language of your choice to solve problems.
I must utilize parts of other's programs to learn how to place code in the EEPROM and how to get data into and out of COGs. Since few people recall much about PropBASIC, that fact will make my effort very hard.
On the other hand, there are other languages that are available to run on the Propeller and that is a good thing for people like Jon who work at the nuts and bolts of code.
I am wondering if there is a store house of existing PropBASIC software programs that are available for me to utilize as I push ahead in implementing BASIC-on-a-Propeller.
Sincerely,
Discovery
https://forums.parallax.com/discussion/160865/propbasic-library-examples
If you search propbasic in the forum search box there are some more threads with useful info.
Tom
I am also a fan of Viewport (no-longer supported), which is also compatible with PropBasic. With Viewport, you can simply "watch" a variable and it will show up on the terminal screen.
Thank you for the information...I will get on it. Hopefully, I can get a download of the Viewport code.
My PropBASIC class just began.
Sincerely,
Discovery
Sorry I didn't see this thread sooner, but it looks like you have solved the initial problem.
I am the developer of PropBasic and I use it everyday.
If you have any further questions feel free to ask on the forums and I will help as much as I can.
There has been some fixes to PropBasic and I'll have to post a new version since it looks like at least some people as still using it.
Bean
I will download the new version when it is ready. Thank you.
Sincerely,
Discovery
Since you use PropBASIC practically every day...by what means do you DEBUG your code? Have you written DEBUG, PRINT, and WRITE statements for PropBASIC?
Sincerely,
Discovery
Here is code pulled from my current project...
I hope this helps,
Bean
Still... back in the days of SX/B I created a lot of small commercial products for EFX-TEK using it; then we switched everything to the Propeller. Our most popular controller is the HC-8+; perhaps I should create a PropBASIC template for it (I have several Spin templates that our customers use).
It's a lot to ask, I know, but I wish PropBASIC had it's own, dedicated edit/compile tool.
@Bean: Have you ever looked at the Xojo compiler? It's x-platform and may have all the right tools to create a nice, stand-along PropBASIC IDE/compiler.
@Bean: Have you ever done white-paper on translating a Spin+PASM object to PropBASIC. I have several library files from many years ago, but things may have changed in recent years -- I'm not sure if any of them will still work.
Others: Is anyone using their favorite editor and CLI to compile/load programs?
Discovery
My observations-
I ONLY use PropBasic to program the prop.
I use Geany as an ide- works great- theres instructions somewhere on how to make it work. Theres no colour coding for the text- not a problem for me.
I have dozens of little proggies for all sorts of modules.
I've had hundreds of hours of fun thanks to PropBasic.
I find the error reporting can be confusing- but close examination of the code usually shows the problem- eventually- though it can be frustrating.
You HAVE to break statements that have multiple 'actions' into separate actions i.e.-
x=z+y-3 becomes
x=z+y
x=x-3
Probasic is sufficiently different to say qbasic or freebasic (which I also use a lot) to have to 'get used' to it. In this regard I start a new project by re-naming an old project and then commenting out all the code except for the boiler plate stuff like-
DEVICE P8X32A, XTAL1, PLL16X
FREQ 80_000_000
etc.
and then using that as a syntax reference and reminder how to do things.
When you get a program running take a look at the created spin file - there you will see just how it encoded into assembler- I'ver learned enough assembler from that to tweak it for special cases.
Vga output is as easy as adding LOAD "VGA.lib" under boiler plate and using the provided functions. (and of course adding vga connector and d/a resistors- plenty of info on that.)
AND although you are limited normally as to how big a program will fit into a cog (as its all assembler) there is an LMM mode which is great for the large but less time critical stuff.
I love it to pieces and would be happy to pay for it.
When the prop2 comes out, I will definately get a P2 module, BUT, if there is no PropBasic for it, it may not get used too much.
I don't publish my code for fear of embarrassment and mockery from the language wars pseudo intellectuals.
Dave
I use Notepad++, for many languages, and that can be setup to Launch a batch file, and it has many highlighters.
The inbuilt Visual Basic highlighter looks usable.
This is one for version 2.5 of the BASIC Stamp PBASIC language : http://notepad-plus.sourceforge.net/commun/userDefinedLang/PBASIC25_v1_1.xml
Looks like someone already has a PropBASIC one here https://forums.parallax.com/discussion/comment/936037/#Comment_936037 - but no links ?
This thread also looks useful
https://forums.parallax.com/discussion/149659/propbasic-how-to-use-propbasic-in-simpleide
and also this
https://forums.parallax.com/discussion/164708/new-release-propelleride-propbasic-fun-times/p2
ISTR there was a pathway to compile PropBASIC output, that did not need BSTC ?
I wish you would. When learning a new programming language, I find it very useful to read other folks programs and figure out what they are doing and how they do it. For example I have found Jon's programs very useful for seeing advanced methods of Spin programming, many of which I would never have thought of.
Tom