Programming for Embedded Systems
Programming for Embedded Systems
(OP)
I recently got bit by a bug that had me thinking about coding for embedded systems.
I know some electrical and basic electronics but mostly I'm a programmer with some experience in Python, Java, PHP, Android and iOS. I have been thinking about how they make electronic device like MP3 players, vending machines, ATM machines, slot machines, small weird systems you typically won't find on the market.
I came across this thread: https://www.eng-tips.com/viewthread.cfm?qid=295833... and it gave me some ideas on where to start. They talk of LabView, FlowStone, Windows Embedded (now Windows IoT). I'm reading up on these.
I need more guidance on where I need to focus more and to get good results.
Lets go with an example of building a gaming machine like those in casino, ATM machine or even the code that runs on the satellite decoder boxes. Where exactly would I start and what system should I use to build such on a budget?
Would you recommend a microprocessor like Raspberry Pi PC instead of using microcontroller like Arduino?
Your input is highly welcomed.
I know some electrical and basic electronics but mostly I'm a programmer with some experience in Python, Java, PHP, Android and iOS. I have been thinking about how they make electronic device like MP3 players, vending machines, ATM machines, slot machines, small weird systems you typically won't find on the market.
I came across this thread: https://www.eng-tips.com/viewthread.cfm?qid=295833... and it gave me some ideas on where to start. They talk of LabView, FlowStone, Windows Embedded (now Windows IoT). I'm reading up on these.
I need more guidance on where I need to focus more and to get good results.
Lets go with an example of building a gaming machine like those in casino, ATM machine or even the code that runs on the satellite decoder boxes. Where exactly would I start and what system should I use to build such on a budget?
Would you recommend a microprocessor like Raspberry Pi PC instead of using microcontroller like Arduino?
Your input is highly welcomed.
RE: Programming for Embedded Systems
There is more existing base of C than all the rest combined, in the embedded realm so often you could've used supplied code with many peripherals that you will have to scratch write using any of the latter languages you've mentioned. This means your products/work may have a few extra bugs that were worked out in the C user world already.
Another thing that screws up embedded systems BADLY are programmers who don't consider the boundary layers. Programmers who've written PC, gamer, and 'app' type code frequently fail bitterly in the embedded world. Those type jobs don't often deal with what embedded systems must cope with, that is; slow supply voltage excursions, mechanical shocks, bad data coming in, back-to-back power failures, etc. Industrial embedded programming requires a considerable amount of effort in trying to handle lots of incorrect inputs, failures and comm failures in a robust and recoverable manner, things often ignored by non-embedded programmers.
What I'm saying is if you want to stay in those languages I'd suggest you don't go into embedded controllers as it will likely frustrate you and your customers. Better would be to focus on the more graphical and text handling user interface areas.
Keith Cress
kcress - http://www.flaminsystems.com
RE: Programming for Embedded Systems
Then I got access to a TEK-31 calculator, which had something like 2k memory locations and a precursor to the GPIB; my company used them as instrument controllers way back when. I wrote a program to plot a company slogan in a circle, didn't like the jaggies from 3 decimal digit resolution, and hacked a fourth digit using LM339 quad comparators as DACs, and some extra opamps to add the fourth digit's contribution to
the output from the primary DACs.
Much later I used an 8080 SBC to drive that interface (for an analog plotter) and accept digital plotter commands on serial or parallel interfaces, sort of just for fun, and also because they wouldn't buy me a digital plotter.
Before messing with SBCs, I used the TEK-31 to write a math model of a Coulter Counter(r), including fluid dynamics, wide range preamps,
and classifying electronics, and used the model to better understand our company's products.
Then I started doing stepper motor controls, first with an 8080 SBC in FORTH and assembler, later with an 8741, completely in assembler.
I had a lot of fun with the 8741 (we had a few dozen on hand because of an aborted project), and managed to squeeze up to five programs into one. That doesn't sound like a big deal until you read the specs; 8741 has 32 bytes of RAM and 1 kilobyte of EPROM. High level languages and macro assemblers don't help in an environment that constrained.
My umpteenth boss was a big fan of BASIC, because he thought he could understand it. We did some motor controllers using programmable counters and 8052-BASIC chips, some of which found their way into our test equipment. I wasn't real fond of doing things that indirectly; I'd rather just bitbang four wires to run a stepper directly.
I tried C as the company switched over to it from PL/M and assembler, and ran afoul of the preprocessor so many times in so many ways that I basically gave up on it and went back to mechanical engineering.
... except for an interlude at yet another job where I tried to develop a precision controller in C, because that's what they had and what my predecessor had started with. I ran into yet more C bugs that I hadn't seen before, and was asked to leave after burning up their entire supply of OTP eproms with nothing to show for it but some chips that successfully ran HC11-FORTH. ... which the Big Boss, a former Russian Army colonel, described as a 'toy language' in what turned out to be my exit interview.
Mike Halloran
Pembroke Pines, FL, USA
RE: Programming for Embedded Systems
If I remember correctly, there was a time I found the screen of an ATM machine displaying the task bar that showed the program running and it had a Java icon probably because the programmers failed to replace it in code and someone failed to put the task bar in auto hide mode.
If I wanted to build a slot machine, do I need to learn c++ or can I use a single board computer and program it in languages like Java or C# and just make sure it is the only program that automatically starts once the PC boots up?
RE: Programming for Embedded Systems
... with a mechanical or mostly mechanical display, and lots of flashing lights.
If you want animated hi-res graphics, you will need something a little more expensive and quite a bit more complicated to program.
A very long time ago, Motorola introduced a one bit microcontroller. I think it had a part number like 14xxx.
I doubt you can get the chip anymore, but the app notes could be interesting, particularly the one about making a traffic light controller, which demonstrates how to produce complex behaviors with simple hardware.
I'd suggest starting with some sort of primitive home automation to keep your learning costs down.
Mike Halloran
Pembroke Pines, FL, USA
RE: Programming for Embedded Systems
Some people use C++ so that they can put declarations all over the place, but really, they are just coding in C with a C++ compiler. Some people like Java and C# because they don't have to worry about garbage collection - just lazy programming: create objects all over the place and don't bother tidying up: just like a messy cook.
You can write semi-OO code with C: after all, the early versions of C++ (CFront) were two stage compilers: first stage was C++ to C, then compile the C code. Systems like X-Windows were written semi-OO but in C.
Raspberry Pi is just a very small Linux computer. Not really an embedded system.
The alternative is python - there are some embedded python systems. It is interpreted so no need to compile.
RE: Programming for Embedded Systems
I see you used to work at Coulter. Where I currently work I assist in the manufacture and perform metrology on the base material used in current generation of the flow cell.
Met with Don and Gerry Graham on several occasions, and have heard Don's 'war' stories and adventures several times.
-AK2DM
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"It's the questions that drive us"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RE: Programming for Embedded Systems
These days, "slot machines" are embedded Windows or Linux on microprocessors that are programmed practically the same as any other desktop PC. That's the "new" definition of "embedded programming", but not mine. For me "embedded programming" is bare-metal and/or C coding on microcontrollers. If the slot machine has physical rotating drums, there's a good chance it's using a microcontrollers (and associated firmware) to control the motors, relays, etc. The microprocessor runs an OS which controls a GUI and an LCD, with limited comms between the two processors.
Programming of the two processors is vastly different as one is highly abstracted from the hardware, and the other is very intimate with it. I would recommend looking at a LOT of examples on how hardware is controlled via C to get a feel for how the language is adjusted/used in such scenarios.
Dan - Owner
http://www.Hi-TecDesigns.com
RE: Programming for Embedded Systems
I’ll will look at microprocessors more and see what kind of applications I can build.
The Tinker Board seems to be a the best to start with & then I just need to connect peripheral via USB and a touch screen for input.
I just need to decide if I should invest in learning Windows IoT or just go with Python/Java
RE: Programming for Embedded Systems
I am proud to have known Wallace well enough to insult him with impunity, as you might any friend.
Mike Halloran
Pembroke Pines, FL, USA
RE: Programming for Embedded Systems
RE: Programming for Embedded Systems
Keith Cress
kcress - http://www.flaminsystems.com
RE: Programming for Embedded Systems
RE: Programming for Embedded Systems
Keith Cress
kcress - http://www.flaminsystems.com
RE: Programming for Embedded Systems
TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm
RE: Programming for Embedded Systems
If you are just learning and playing with hardware at the same time, you don't want to be plagued with linking problems, missing libraries, templates, namespaces etc which you sometimes get with C++. Get your hardware interfaces working in C. You can always call C functions from a C++ program but you can't call C++ from a C program. If, at a later date, you wish to change to C#, Java, Python, Fortran or Ada, you can still call the C functions. It is the favoured interface language: almost every language can call C functions.
RE: Programming for Embedded Systems
Basically I just need to lesrn c and I can design the gui in any of the languages I’m familiar with thay has capability to call c functions.
I guess I have to get the Arduino boards to start learning.
RE: Programming for Embedded Systems
Dan - Owner
http://www.Hi-TecDesigns.com