I must be kidding, right? No, I’m not. I’m just suggesting that we take another look at the old programming language known as BASIC. The language has a great deal going for it, particularly that it’s easy to learn and use. Now we’ve replaced it with more complicated languages.
Anyway, over the past several years, I’ve been playing around with a variety of microcontrollers, virtually all of which use C or some variation thereof. I’ve managed to learn C and write some simple programs, but I hate it. I keep thinking back to when I used a lot of BASIC. It did what I wanted and was relatively easy to use.
Granted, BASIC isn’t a great language. It’s essentially an interpreted language and often not fast enough for some applications. But a compiler version of BASIC usually fixes that. The language works and does what it’s supposed to do.
I learned BASIC back in the early days of personal computers – it’s pretty much all we had. Many of us picked up BASIC early because it was similar in some ways to FORTRAN that many of us learned in college on mainframes. We wrote short programs and long programs and the PC business really took off. I think BASIC made it happen faster because it was easy to learn and use, so many adopted it. Dozens, maybe even hundreds, of books were written about it.
Other languages emerged to replace BASIC. Remember Pascal? It came and went in a few years. Then C arrived from the UNIX people and everyone seemed to gravitate to it. C thus became the de facto programming language of today. Virtually anyone programming microcontrollers learned and adopted C, and most colleges teach it. The mandate is “you will learn C no matter what.” I did, too, but I didn’t like it.
A few years back, the company Parallax introduced the BASIC Stamp, a PIC-based microcontroller with an embedded BASIC interpreter (Figure 1). Parallax offered the BASIC Stamp – a small, cheap, and simple single board micro – with its own flavor of BASIC optimized for embedded projects. I got hooked on these and did many useful projects. The Stamp kept BASIC alive for some more years before it faded again.
|Figure 1.||The BASIC Stamp microcontroller of Parallax company.|
Microsoft contributed to BASICs existence with its Visual BASIC. The company still offers a whole line of BASIC products. Visual BASIC was taught in college when I was a professor. Then it faded away. Most of those who had to do some programming jumped right to C, and today it still seems to be dominant.
During a recent move I rediscovered a box full of BASIC Stamp stuff. I got it out and started playing with it all over again. Made a few new projects after refreshing myself on the BASIC commands and procedures. It was fun.
About that same time, I discovered PICAXE. This is a single-chip PIC microcontroller programmed internally with a BASIC interpreter (Figure 2). You program in BASIC on a PC and then download the program to the 8-pin PIC DIP. This approach lets you do small projects with a single-chip micro. Like the Stamp, the PICAXE allows you to create embedded projects fast and easy with minimal complexity and cost. It would take me two to four times longer using C.
|Figure 2.||The BASIC Stamp microcontroller of Parallax company.|
Oh yes, I would be remiss if I didn’t mention the once-popular Intel 8052. Basically, it’s a version of the widely used 8051 embedded controllers. The 8052 had an internal BASIC interpreter (Figure 3). I did use it in one project. I don’t think it’s still available.
|Figure 3.||Intel 8052 microcontroller with internal BASIC interpreter. (Photo from
the site http://www.retro-lab.nl)
My whole point here is that BASIC is still around and particularly useful. For those still learning programming, treat yourself to a simplified language and have fun learning to use it. If you’ve been putting off learning coding, BASIC is a great place to start. Most of what you learn from BASIC programming will apply to C or another language.
One detour was my Arduino adventure. As you probably know, its language is essentially the same as C or C++ with all of the usual semi-colons and curly brackets. I never did get competent enough to make the popular Arduino fun to use.
I suppose most languages are still available to anyone who wants them. For example, what ever happened to FORTH? Or one of my other favorites is LISP. I did some LISP programming back in the early AI movement days. LISP is a screwy language, but you can do amazing things with it.
I guess I should mention Java. As widespread as it is, I never did learn it. I did learn HTML at one time, but never used it much. I know that I keep coming back to BASIC because I was successful with it at one time and I know now how to get things done using it on an embedded controller.
I’m not a professional programmer, and I realize I’m not going to change anyone’s mind with this commendation of BASIC. Real programmers and engineers probably hate BASIC and denigrate it whenever they can, even though I bet more than half of them learned programming from BASIC in their early years.
If not BASIC, what?
Someone asked me “if BASIC was no longer available and I detest C, what language would I use?” My choice is ASSEMBLER. Yes, assembly language. I like it as I can see or at least imagine what’s going on inside the chip. It’s closer to the hardware than anything else.
I first learned assembler on the original Intel 8080 and later did a great deal of work with the Motorola/Freescale 68HC11. More recently, I used the assembler on a TI MSP430 project. If I must program an MCU, I prefer assembler even though sometimes it takes me a bit longer. I know, most of you think I’m nuts for liking something more complex like assembler. By the way, have you ever tried it?
So, for now, I am still diddling around with BASIC and assembler projects. However, I do have an open mind. Perhaps I will eventually give up all of this retro stuff after reading a recent survey.
What’s the Most Popular Language Now?
Every so often, the IEEE’s Spectrum magazine does a rather detailed survey of what IEEE members like to program with. It ranks 55 different languages. At the top of the list are Java and C in second and third place. Number one is Python. Surprise? Yes, Python is the new favorite of programmers and engineers by a wide margin. And it’s now a popular college course – it’s a good language for learning programming, much like BASIC. I haven’t tried it yet, but programmers seem to love it because lots of single-board computers now support it in embedded applications with some good libraries. Maybe we should try it.