The programmed instructions determine the set of actions that is to be accomplished automatically by the system. The program specifies what the automated system should do and how its various components must function in order to accomplish the desired result.
Program the vending machine's actual software from scratch using Java.
Most of what you're talking about are embedded systems where C is a luxury that may not be available. The software often isn't separate programs running under an OS like you'd have on a desktop or phone, especially if the chip the designers chose to use is described as a "microcontroller".
Most of the time the software is written in C or assembly. C requires a compiler to be written for that platform (and might produce bloated or inefficient asm if it doesn't optimize well), but a simple assembler only has to turn text into machine code one line at a time and is easy to write. (And if a vendor wants anyone to buy their microcontrollers, they'll make sure at least an assembler exists for it to make development attractive, often also a C compiler although sometimes non-optimizing.)
Your coffee pot and most simple systems like that don't carry an operating system. They simply load from a start address in memory and you put your code there. Often these systems have their "code" burned into EEPROMS that act as the hard drive of the system. Or depending on the type of EEPROM / flash, code may be able to run directly from flash without having to get loaded into RAM first. (The device may not be able to write to its own flash memory; that's done with external tools. The edit/compile/run cycle may include reprogramming the flash of actual hardware, if not testing in a simulator.)
Coca-cola machines, routers, etc. typically use a realtime OS like QNX, EMBOS, or sometimes RTlinux if you're lucky. Most of these are proprietary OS you license for lots of money, but they have C compilers, drivers to work with hardware, etc.
http://www.qnx.com/
http://www.segger.com/cms/embos.html
http://www.microsoft.com/windowsembedded/en-us/campaigns/compact7/default.aspx?WT.srch=1&WT.mc_ID=SEARCH
RTLinux
They use microcontrollers, the 8051 is the classic one. These are 8-bit or 16-bit cores, they rarely have an operating system. The programmer writes the code to initialize the onboard peripherals and implement the interrupt handlers. Languages used are assembly and C. Tough debugging jobs require an in-circuit emulator.
There's lots of growing room beyond this, with 32-bit embedded cores (ARM is the 100 pound gorilla) that boot an embedded version of Linux and/or the Java JVM.
These are embedded systems, and would be programmed using a very low-level language such as C or assembly. In general such a system will run without an operating system, although some newer "everyday machines" such as blue-ray DVD players and wireless routers do run their code on top of a unix-based operating system.
Along the lines of what others have said, many modern embedded systems also run a flavor of windows. It depends up on the application. Also, there is a trend in many spaces to run on a more powerful platform with an operating system, to handle cases such as Blue-ray players needing to run Java, and other instances where the end user desires more functionality.
Let's think about the processor in your desktop. All it does is run machine instructions, and by itself, isn't really concerned about "operating systems" or "programs".
You turn your computer on, the processor points to the first instruction, and it starts executing.
On your desktop, it starts executing the "operating system". But there is no reason that you couldn't have the processor executing any set of instructions you chose. (This may not be very useful, since you'd still want to output results to the screen, and that functionality resides in the OS.) At the same time, if your machine instructions consisted of the right opcodes so that the processor would output the correct sequence of signals to paint a picture on the monitor, all the better. No OS needed.
Desktops do so much stuff that we generally require the abstraction of an OS. But at its core, all the processor does is execute instructions.
Same for the processor in Coke machines and Coffee machines. All it does is execute instructions.
Well, writing machine instructions bit-by-bit is tedious. So, just as with desktops, we typically write code in C, which is then compiled into machine code. That machine code is loaded onto the embedded processor and it runs.
Embedded systems do so little that they don't need full-on OSes. A microcontroller might have 8 or 16 pins on the chip - compared to scores of pins in your regular CPU socket.
So the workflow is write some code (say, in C), compile it on your desktop machine. That compiler generates machine code for the embedded chip. Then that code is loaded onto the microprocessor (and you need special hardware to do this.) Then you power the chip and it starts executing instructions. Simple!
Many devices which perform a specific function do not contain any "code". They perform their functions via the properties of their electronic components. More advanced systems, which can perform many different functions or need to be easily upgradable, will contain a microcontroller and some sort of "operating system". Since these still have some limits to their functionality, the operating system will be simple and specially designed. Getting even more advanced, the device will contain something similar to a computer. It will have a more complicated operating system which can communicate with different parts of the system. Finally, you reach devices such as smart phones, which contain a full operating system which can run user level code and have much more user input than simpler devices. However, even modern processors are essentially very large electrical circuits. Every instruction the CPU recognizes will cause a different circuit to be used to perform that function.
Here are some Wikipedia pages you may be interested in:
http://en.wikipedia.org/wiki/Electrical_engineering
http://en.wikipedia.org/wiki/Integrated_circuits
http://en.wikipedia.org/wiki/Electronic_engineering
http://en.wikipedia.org/wiki/Computer_engineering
http://en.wikipedia.org/wiki/Microcontroller
That's a very broad question and it depends a lot on the machine. I can only guess that the majority of these vending machines are controlled by microcontrollers (8051, PIC, ARM7, to name some of the most used) and rarely have an OS and if has any, it would be some kind of RTOS, such as FreeRTOS.
More complex machines, such as DVD/BluRay players or mobile phones run on top of sofisticated platforms, such as OMAP4. Usually a Unix OS runs on them.
Low-end microcontrollers found in everyday appliances typically do not run an operating system. They are chosen for low cost, and the main factors driving that cost are the number of pins on the chip (from a dozen to a couple hundred) and the amount of memory inside (from a couple kilobytes to a megabyte ROM, from a few bytes to a hundred kilobytes RAM).
As feature creep works its magic, it does happen that a microwave may need to multitask. In this case, the programmer recalls their operating systems course and implements message-passing, task scheduling, asynchronous I/O, etc as necessary!
Of course, for the sake of expedience, simplicity, code size, etc, features tend to be done in a rudimentary way. Often it depends how you analyze the program, to find generalized OS functionality within task-specific code. But it's a long way from a hard-coded task scheduler to an operating system, and when you have only a few kilobytes to work with, an off-the-shelf OS is not the solution.
Take a look at DigiKey, a popular electronic parts selection site, to learn about low-end MCUs. Here is their info on a very cheap MCU with an LCD controller, such as might be found in a coffee machine. It's easy enough to get the programming manual and everything.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With