Basic language micro controller.

nsaspook

Joined Aug 27, 2009
16,330
My introduction to HLL programming began with Fortran and then BASIC in the 1970s.

One of my projects then was to implement an automated sample changer system for nuclear irradiation in a nuclear reactor. The only computer available at the time was a DG Nova minicomputer running BASIC. This proved to be a nightmare having no knowledge of structured programming techniques.

Then I discovered Algol which allowed me to implement proper structured programming structures. This led to Pascal which was the game changer for me.

I did a lot of programming in VB for its ease of GUI development. All my projects today involve Pascal, C, MATLAB or Java.
BASIC is no more.
I really believe that learning structured programming in a Algol based (for me is was Pascal and Modula-2 after Fortran) language is a necessity if you are serious about learning programming. Once you have the Algol type language structure in your minds programming foundation, other languages are much easier to code properly in.

Fortran, much like BASIC, has the power to ruin a potential good programmer for life. Every program they write will have I,J,K as index variables. ;)

Old Fortran.
1742837758076.png

In C.

1742838016590.png
 

ronsimpson

Joined Oct 7, 2019
4,702
My introduction to HLL programming began with Fortran and then BASIC in the 1970s.
Basic stays in my head. Fortran and (others) did not.
Here is a BASIC multi-tasking compiler. tiger basic My home control computer is on one of these. You don't have to use multi- tasking but I found it is nice to run each task as totally independent. This is a real grown up BASIC.

When I started using PIC computers, the real programmers used C and I used PIC BASIC pro. The programmers had to learn to make an LCD driver program while this BASIC has that built in. LCDOUT "text"
I can read voltage on a digital pin (crude but works). ADCIN Pin1
While my "C" friends fought with I2C and how to make the 9th bit work, I wrote to I2C memory in seconds " I2CWRITE DataPin, ClockPin, Control, {Address,}[Value{,Value...}]{,Label} " Some BASICS have a hardware I2C and a software I2C.
I used BASIC because of the built in IO library.

"Real programmers do not use BASIC" and I agree. I just need it to work without breaking my old head. (learning something new)
I just spent three months fighting with "Home Assistant" programming and have a crude program working. Really struggle asking for help. I could have written this in BASIC in days and had it working right. I am really good with the wrong tool and really bad with the right tools.
 

MisterBill2

Joined Jan 23, 2018
27,591
At one job I became very proficient at programming in UVOSE, a variant of the TBOSE language, which was dying at the time. Those were linked and compiled programming languages that ultimately produced instructions to run on 6809 processors controlling electrical testers used for production lie checking of cars, trucks, and vans. About the time I was acknowledged to be very good, that language and the testers became obsoleted by a different, fill in the blanks language (EHUTL) that ran on 33 MHz PCs. Those testers were much slower than the ones that had the 6809 processors clocked at 2 MHZ. The claimed benefit of the new system was that anybody able to read "simple english" would be able to produce programs that would run.

So I abandoned that job and got back into creating real test systems , and which paid about twice as well.
 

nsaspook

Joined Aug 27, 2009
16,330
Basic stays in my head. Fortran and (others) did not.
Here is a BASIC multi-tasking compiler. tiger basic My home control computer is on one of these. You don't have to use multi- tasking but I found it is nice to run each task as totally independent. This is a real grown up BASIC.

When I started using PIC computers, the real programmers used C and I used PIC BASIC pro. The programmers had to learn to make an LCD driver program while this BASIC has that built in. LCDOUT "text"
I can read voltage on a digital pin (crude but works). ADCIN Pin1
While my "C" friends fought with I2C and how to make the 9th bit work, I wrote to I2C memory in seconds " I2CWRITE DataPin, ClockPin, Control, {Address,}[Value{,Value...}]{,Label} " Some BASICS have a hardware I2C and a software I2C.
I used BASIC because of the built in IO library.

"Real programmers do not use BASIC" and I agree. I just need it to work without breaking my old head. (learning something new)
I just spent three months fighting with "Home Assistant" programming and have a crude program working. Really struggle asking for help. I could have written this in BASIC in days and had it working right. I am really good with the wrong tool and really bad with the right tools.
How to you like "Home Assistant" now that the initial learning curve is over? I love it as a frontend and 'glue' for systems integration of several other controller projects.
 

ronsimpson

Joined Oct 7, 2019
4,702
How to you like "Home Assistant" now that the initial learning curve is over?
It is not over. (curve)
I mostly understand Automations. We made a big jump getting Scripts working. I really don't understand Numbers or is it called Variables. In HA I want to use a "number helper" which is a way for a human to enter a number, and have that load a "timer helper". It appears I need to go into YEMAL and change "minutes="10" to "minutes "??????" where ????? is from a Number.

I am taking a break and working on simple things like taxes. lol Thanks for asking.
 

nsaspook

Joined Aug 27, 2009
16,330
It is not over. (curve)
I mostly understand Automations. We made a big jump getting Scripts working. I really don't understand Numbers or is it called Variables. In HA I want to use a "number helper" which is a way for a human to enter a number, and have that load a "timer helper". It appears I need to go into YEMAL and change "minutes="10" to "minutes "??????" where ????? is from a Number.

I am taking a break and working on simple things like taxes. lol Thanks for asking.
YAML is a Markup language mainly used for configuration.
https://spacelift.io/blog/yaml

The programs/plugins that run in HA use it is the same you would define variables and subroutines in BASIC or any other language that uses nested structures on organize data and function into a programming 'object'. You have the functions that execute and the configuration file YAML has the data those functions need to operate on, the data (or links to that data) you need to supply the processing you want.
https://www.home-assistant.io/docs/configuration/yaml/

Many functions have a visual editor to handle the YAML and you can see the raw files in editor mode if needed.
1742863086787.png1742863107827.png

Like I said before that advantage of knowing structured programming is that you can see how most well designed software operate without knowing all of the specific details (you need to know the mundane things like the keywords, syntax and coding standards) because there is a common way to design all good software, no matter the language.

If you need help, let me know.
 
Last edited:

nsaspook

Joined Aug 27, 2009
16,330
Good stuff. The thing is that, after a while, you don't need the crutch (IMO that's why they teach it in classes before you can run as a programmer, it's needed to get you up to speed as you start crawling) of flow-charts to write code. You intuitively write structured code once the problems have been stated (mentally) in a manner compatible with computer programming. I then use programs like doxygen to document what's been written into nice pretty pages. It's not top-down or bottom up. It's the ability to see it all at the same time, with the needed original structure to fix issues and add functionality on top of existing structures.

Building software becomes like building hardware. You know what's needed and you know how to do it.
 
Last edited:

boostbuck

Joined Oct 5, 2017
1,045
"It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration." -- Edsger W. Dijkstra
The argument against BASIC as 'an unstructured language that teaches bad habits', per Dijkstra, applies to the original basic language which is now so obsolete as to be irrelevant. Any modern version of BASIC offers a structured environment practically as good as any alternative language. Its limited syntactical flexibility is an advantage to learners.

Good programming is a discipline practiced by few, and I have seen garbage code in all of the many languages I have encountered.
 

ErnieM

Joined Apr 24, 2011
8,415
Are there any micro controllers I can program in basic?
Check out the The Parallax Corporation. These guys make a series of microcontroller modules that are programmable in Basic over a USB, These are simpler to use than a bare micro with a Basic complier; while they are very good you still need to take care of some low level things to even get a LED to blink.

While on the pricey side the Basic Stamp modules give you an easy way to get going, then later you can get into less expensive micros.

I had a good time their "What's a Microcontroller" package many years back, so many I bought it from Radio Shack.

Also, there is a forum here specialized for these questions.
 

nsaspook

Joined Aug 27, 2009
16,330
If you have a 8080 machine you can run basic on it. I programmed in ASM on my DIY 8080 machine, like any sane person would.
https://forum.allaboutcircuits.com/threads/dumpster-dives.38077/post-246108
machine8080.jpg
https://images.gatesnotes.com/12514...82ea11482e/Original-Microsoft-Source-Code.pdf
https://www.gatesnotes.com/meet-bil...T.mc_id=20250331100000_Microsoft-50th_MED-MED

"Before there was Office or Windows 95 or Xbox or AI, there was Altair BASIC," Bill Gates writes on his Gates Notes website. "In 1975, Paul Allen and I created Microsoft because we believed in our vision of a computer on every desk and in every home. Five decades later, Microsoft continues to innovate new ways to make life easier and work more productive. Making it 50 years is a huge accomplishment, and we couldn't have done it without incredible leaders like Steve Ballmer and Satya Nadella, along with the many people who have worked at Microsoft over the years."

Today, Gates says that the 50th anniversary of Microsoft is "bittersweet," and that it feels like yesterday when he and Allen "hunched over the PDP-10 in Harvard's computer lab, writing the code that would become the first product of our new company." That code, he says, remains "the coolest code I've ever written to this day ... I still get a kick out of seeing it, even all these years later."
 
Last edited:

MisterBill2

Joined Jan 23, 2018
27,591
My understanding of the story is a bit different.
And certainly profits will be much larger if the budget is spent on marketing instead of producing bug-free code.
 

nsaspook

Joined Aug 27, 2009
16,330
My understanding of the story is a bit different.
And certainly profits will be much larger if the budget is spent on marketing instead of producing bug-free code.
"Also, there's a buffer overflow on page 18, an authentication bypass on page 37, RCE on page 41, a remotely exploitable DoS on page 50, a ..."

BASIC was capable for hobbies but serious programmers were using ASM and serious business ran COBOL.
https://altairclone.com/downlo... [altairclone.com]

The Altair was slow, the MS BASIC implementation was slow, the BASIC algorithms were slow. If you wanted anything close to real time response to external hardware, it needed to coded in ASM and then maybe called in BASIC.
 

Jon Chandler

Joined Jun 12, 2008
1,598
Swordfish Basic for PIC18F chips is highly recommended by yours truly. It is a fast compiled language, similar to VB6. It's got support for the latest PIC18F devices and many modules are available to support various functions.

The "special edition" is a trial version with very generous limits and no expiration to the point where many users never upgrade to the paid version.
I recently learned that the developer of Swordfish Basic has decided to make the FULL VERSION of Swordfish Basic available at no charge. This is the full complete version which is being maintained and updated for new PIC18F parts as they come out.
 

Jon Chandler

Joined Jun 12, 2008
1,598
If it's free, then you are the product.
He has generously made it available to the public. No ads, no sales pitches. No gotchas. No "phoning home." This has been his passion and he's sharing an extremely good compiler.

So you are so cynical about something you know nothing about.
 

nsaspook

Joined Aug 27, 2009
16,330
He has generously made it available to the public. No ads, no sales pitches. No gotchas. No "phoning home." This has been his passion and he's sharing an extremely good compiler.

So you are so cynical about something you know nothing about.
Yes, I am for damn good reasons. The amount of spyware, ransomware and personal stealing services in free products should make everyone cynical unless proven wrong like you did to me. Good for him making it free but he is the exception to the rule today. I would say exactly the same thing to anyone today giving things away. Trusting is earned, not an assumption.

There are restrictions that you can only get it from their site. That means they can track ip addresses and search web based information from those IP addresses on each individual downloader.

So yes, there are restrictions and information is captured. Don't know what they do with it but let's hope it is for the common good.
 
Last edited:
Top