![]() |
Forum Index : Microcontroller and PC projects : CMM2: Standalone C Programs?
![]() ![]() |
|||||
Author | Message | ||||
Tinine Guru ![]() Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
This is so true. For a lot of people, the problem with BASIC is that the B = Beginners. It ain't going away folks! I agree with Pete when it comes to Python. ![]() There are many high-end (read:$,$$$) machine controllers, featuring on-board programming and which language do they use? BASIC. One in particular boasts that their fastest system executes 25,000 commands/sec "ten times faster than our previous model". That's slower than the 40MHz MX170 running MMBASIC. ![]() As I type, I am once again sitting next to a CNC tube bending machine, my third MMBASIC project (Explore E-100). Huge panic job because they have customers waiting for parts. The old control died completely after 30 years (I also built that DOS-PC system). I have had interfacing challenges which meant constructing boards etc. and now I am at the power-up stage. Code needs considerable changes due to many special features. With MMBASIC I only have to think of what I need and type it. ![]() Craig |
||||
RetroJoe![]() Senior Member ![]() Joined: 06/08/2020 Location: CanadaPosts: 290 |
Sounds like a dream job - send videos !! The CMM2’s interactive REPL is very much a big part of its appeal (BTW, it’s the same reason many people find Python appealing :) I believe there were two legitimate knocks against BASIC early on: most (interpreter) implementations were painfully slow for anything but simple applications, and the mandatory line numbers lead to multiple “coding horrors” - it was indeed hard to write structured, modular code, even if you wanted to. Modern implementations of BASIC solve both those problems, but I would be very surprised if BASIC, despite being an ideal teaching language, enjoyed a mainstream renaissance in academia. But, who knows - maybe the CMM2 is the perfect platform to reintroduce BASIC to a new generation of kids. It nails the first challenge dead-on - it’s fun to use. And, once you learn BASIC, you can learn any procedural language - as was stated upthead, it efficiently covers all of the “basics”. Cheers, and I’m serious about the videos - I love CNC stuff :) Enjoy Every Sandwich / Joe P. |
||||
Tinine Guru ![]() Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
Modern implementations of BASIC solve both those problems, but I would be very surprised if BASIC, despite being an ideal teaching language, enjoyed a mainstream renaissance in academia. I built my first CNC Tube Bender control back in 1986 and I used QuickBASIC (PDS version). That product with its threaded p-code interpreter and interactive IDE was ahead of it's time and blew away every other language in terms of productivity. Thanks to an open-source 3rd-party add-on library, I took an interest in MASM. I simply used existing routines as templates and modified the functionality to suit my needs. I came across a print spooling routine that ran in the background. It intercepted the RTC interrupt vector, increased the interrupt rate from the standard 18.2Hz to something close to 1KHz and compensated accordingly to keep the PC's clock running correctly.I modified this code to handle my time-critical functions (I/O + 5 Servo axes) and it shared variables with the main QuickBASIC program which were therefore updating ~1KHz. The cool thing was that I could suspend/single-step the Basic program, in the IDE and the interrupt routine would still run in the background. Fast-forward a couple of years and I had to recruit help to take over the software development while I ran the company. I hired two big-ticket boffins but they both insisted that they would have to re-write the code in Watcom C. I had no problem with this. A couple of months went by and no C code was forthcoming and this was due to the fact that they'd gotten to play with my QB+MASM stuff and decided that it was too good to drop. Neither of these guys went back to c programming. ![]() |
||||
RetroJoe![]() Senior Member ![]() Joined: 06/08/2020 Location: CanadaPosts: 290 |
Craig, very interesting technical challenges, and nice to hear the positive outcomes. Computers were invented to solve problems, not create them. I believe you’ll appreciate this timeless blog on rewriting code. Also recommend you click through to the Joel Spolsky blog on the same topic. I’ve learned a lot from both these guys over the years - their “back catalog” of blogs are worth exploring, even if some of the examples are dated. Right, wrong or indifferent, BASIC has been snubbed by “professional” developers (even powerful and practical implementations like VBA), and, in my experience, trying to rationally discuss the merits of different languages (or processors, or frameworks, or databases, or operating systems...) often turns into a Manichean “pure good versus pure evil” religious debate. Computer folks are nothing if not opinionated ! There are literally hundreds of ways you could have architected your CNC solution, but running a production business tends to clarify your cost/benefit analysis, including the good old “less is more” and “time is money” aphorisms. On that note, still hoping to see some video of your Maximite controlling big, dangerous machines :) Enjoy Every Sandwich / Joe P. |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
Further back, Pascal was "the best" according to many and there was much C-bashing. Later, Delphi was "it". C has survived and prospered. Where are Pascal & Delphi? This sort of almost religious intolerance just goes on and on. Meanwhile lots of other people just use what works for them to get the job done :) MMBasic lets people get their jobs done... John |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
Horrors. Thank goodness I've never found that to be true. John |
||||
Tinine Guru ![]() Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
If MMBasic needed a slogan, this could be the one. It's one thing to have the luxury of a salary and to be given lots of time to figure something out but it's another thing when doing a job at a fixed price and there's a possibility of losing your proverbial posterior. There are simple solutions out there; here are my "secret weapons" 1) Micromite for system management 2) Parallax Propeller for real-time determinism (no interrupt hell) 3) RFO-BASIC (interpreter) for the Android-based HMI I am by no means a programming wizard but clients believe that I am and the job gets done ![]() |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
I 2nd that quote from John S!!!! It has a nice sound to it, cos it is true. I've played with BASIC Stamps, PICAXE, Arduino and(naturally) the MMBASIC based units. I have now pretty much everything I do running on MMBASIC based hardware, for pretty much exactly the reason in John S's quote. I DO still have ONE major system still running on 18X PICAXE chips, but that is the sole survivor of the porting to MMBASIC, simply cos it is not worth the effort to port this system to MMBASIC when it is working fine as-is under PICAXE. The base controller for that system has been ported to MM+ though, so we have both PICAXE nodes, and a MMBASIC main controller in the one system, so the best of both platforms perhaps! ![]() I found BASIC stamps difficult to work with, and they were very expensive modules, so they were quickly dropped. Arduino has a huge following, but as the code is all written in C, and C and I have a very difficult relationship, they were also quickly dropped. I have nothing but admiration for those who can write C like Geoff and Peter, but I simply don't have the time to learn it, when I need a reasonably fast turnaround time for product development. PICAXE were(and still are) excellent for true entry-level and classroom programming study etc, and while they can do some clever things, they have serious limitations in a commercial product being only 8-bit, relatively slow and with very limited memory. I also got sick of having to download/debug/download every time you wanted to fix a bug, but pretty much all MCU's did it that way at the time. Then MMBASIC came along, and I have never looked back, really. I instantly fell in love with the built-in editor, cos it made bug squishing much faster, as I could debug right on the actual chip itself, without anything other then a terminal. If the code showed something wrong, I can CTRL-C stop the code, and examine variables and strings right there on the console, which is beautiful for rapidly finding and fixing bugs. Once I had fixed the bug(s), I could then just upload the code back to the PC, and carry on working from there. It is just a personal preference thing, really, but boy do I love that built in editor, that I affectionately call 'The Bug Squisher'. ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
HellbentHorse Regular Member ![]() Joined: 08/07/2020 Location: AustraliaPosts: 55 |
I have never understood the level of arguments and religious like following of some programming languages. At the end of the day, there will always be pros and cons to each, but they are all just a tool to be used. Use the best tool for the job and get on with things! In saying that, knowing how to use those tools is the real challenge. To use a metaphor, I've met plenty of people that can walk into a hardware store and tell me the names of all the tools, but if I turned around and asked them to build me a house with them they wouldn't know where to begin. |
||||
Tinine Guru ![]() Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
Sure but if these things are not debated (argued), how does one know if they picked the best tool for the job? And then there are employees out there who insist on using the language-du-jour for no other reason than to improve their own skills (and therefore, their marketability) at the expense of their employer and end-up missing deadlines. |
||||
HellbentHorse Regular Member ![]() Joined: 08/07/2020 Location: AustraliaPosts: 55 |
I guess what I was getting at is the nonsensical arguing akin to the language zealots. Constructive criticism and discussion is always welcome of course! |
||||
NPHighview![]() Senior Member ![]() Joined: 02/09/2020 Location: United StatesPosts: 203 |
Hi, folks - a newbie (to the forum) here. I learned to program in HP-Basic in the 1970's, on HP minicomputers, then the 98xx-series of desktop calculators. Loved it! Then, a job at Bell Labs and ~20 years of professional C programming, followed by a stint doing PL-SQL, then a few years of functional programming (Haskell & F#). Once I retired, I brushed up on Arduino, and now am playing with mmBasic while awaiting receipt of the Colour Maximite 2 during the pandemic. When I need to do something tiny (a coin cell, an 8-pin chip, three resistors, and an RGB LED), there's nothing quite like burning my C-like Arduino program into an Atmel microcontroller (yes, it required wire-wrapping a programming board - no big deal). The cmm2 is incredibly appealing as an "instant gratification" programming environment, as were the HP desktop calculators. mmBasic strongly resembles HP-Basic in that good structure is encouraged, options can be set, and access to the real world is direct and very tangible. As a long-time C programmer, the Option Base wars don't bother me. A brief anecdote: I once wrote a rule-based expert system for a big pharma company. I estimated that if I'd done it in "C" it would have been somewhere in the 100,000 lines of code range. One of the requirements was that my code, if not actually mathematically provably correct, had to be simple enough that an FDA inspector could review it in one sitting and be satisfied that it was functioning correctly. It took me six months, but I wrote it in Haskell, and it all fit on one side of one page of 8 1/2x11 paper - about 50 lines - with comments. Most of the time spent was on getting to the real mathematical essence of the problem, and distilling the solution down to the most elegant, comprehensible expression possible. Haskell handles recursion incredibly elegantly. My first two mmBasic programs were to recursively calculate the Fibonacci sequence and the Ackermann function. mmBasic worked great for both! Maybe not the 3-line implementations possible with Haskell, but really quite economical, and quite quick as well. And a Conway Game of Life implementation runs 64x128 fields very happily at 5 generations a second in DOS mmBasic, with minimal optimization. I'm looking forward to putting my new mmBasic skills to work once the cmm2 gets here in a week or so. Live in the Future. It's Just Starting Now! |
||||
Paul_L Guru ![]() Joined: 03/03/2016 Location: United StatesPosts: 769 |
@NPHighview --- WELCOME!!! Well, finally, someone from Bell Labs! Where did you work, West St., Murray Hill, Holmdale, Deal Test Site, Freehold, Lincroft, Long Branch, Middletown, Neptune, Princeton, Piscataway, Red Bank, Chester, Whippany, Napperville, Lisle, Indianapolis Indiana, Columbus Ohio, North Andover Massachusetts, Allentown Pennsylvania, Reading Pennsylvania, Breinigsville, Pennsylvania or Burlington, North Carolina? Whew ... I think I got most of their significant locations. They had as many as 115,000 people working there at one time! Few people realize how much Bell Labs contributed to the current knowledge. Nine Nobel Prizes leading to the development of radio astronomy, the transistor, the laser, the photovoltaic cell, the charge-coupled device (CCD), information theory, the Unix operating system, and the programming languages B, C, and C++. It's a shame that Washington broke up "Grandma Bell". I did some work for them in the early 1960s in Allentown. They were having problems keeping the dialing frequencies produced by the Princess phone's R/C oscillator stable. They were developing the idea of depositing the 12 selectible resistors directly on small PC boards and needed to measure the resistance of all 12 resistors on 10,000 test boards using four terminal measurements with an uncertainty of 10 ppm and a resolution of 1 ppm, and they wanted to measure each resistor once an hour! I figured out how to do it using a constant current supply and a modifier Kelvin-Varley voltage devider in a potentiometric bridge configuration. THAT WAS FUN!!! Are you located on the east coast? I hang out 75 miles north of NYC midway between the IBM mainframe plant in Poughkeepsie and the microprocessor fab in East Fishkill. I suspect that I am older than you. I'm older than dirt. Have fun here. Paul in NY. Edited 2020-09-13 17:11 by Paul_L |
||||
mkopack73 Senior Member ![]() Joined: 03/07/2020 Location: United StatesPosts: 261 |
Couldn't agree with you more! UGh.. This bit me in the ass years ago back when python was still pretty young. We were using it for a portion of a project. I had all this code working just fine, I get another person to add in some functions to do some calculation had had been working on. I get the code back from SVN and suddenly NOTHING works! Everything visually looked right. WTF??? Took me days to realize that he used an editor that used spaces, I used one that used tabs. WORST THING EVER with Python. And really, what did they save? Hitting { } ??? Otherwise, the language itself is pretty nice, especially when working with lists or dictionaries and performing operations across the entire data structure. It's standard library is also very extensive (much like Java's). Edited 2020-09-14 00:02 by mkopack73 |
||||
NPHighview![]() Senior Member ![]() Joined: 02/09/2020 Location: United StatesPosts: 203 |
Hi, Paul - Thanks for the warm welcome. I was at Columbus Branch, where I worked on the maintenance backbone for an automated directory assistance response system while my fiance (now wife of 40 years) was in veterinary school at Ohio State. After she got her PhD a few years later (she's a "paradox"), we started moving west mainly for her jobs. Most of my career was in high-reliability software (telephony, medical devices, pharma). I'm still doing a little consulting in software IP. We're now in Ventura County, in southern California, where the skys are orange and wildfires sweep through our neighborhood every five years or so. One thing that causes is beautiful blooms of wildflowers that follow the fires; my glyph is a photo of one type that's particularly prevalent in our area. Thanks again! - Steve Live in the Future. It's Just Starting Now! |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |