DCCWiki, a community DCC encyclopedia.
Jump to: navigation, search

Summary: A microcontroller or MCU is an integrated circuit which is custom designed for specific applications, such as a television or microwave oven. Due to their low cost, they are everywhere.

Microcontrollers are the foundation of modern consumer electronics. Automobiles went from having five or six controlling various functions, to 30 or more today. It replaced many functions which were previous mechanically actuated, such as fuel induction, cruise control and transmission shifting. Plus all the advanced features many cars now have, such as touch screen entertainment and navigation systems.

In most applications the microcontroller replaced mechanical items such as switches and timers.

A common application of the MCU is as a Digital Signal Processor (DSP). The best description is "a computer on a chip."

One of the first command control applications of a microcontroller was the Hornby Zero1 developed during the 1970s.

Digital Command Control uses microcontrollers as the foundation for command stations, throttles, multifunction and accessory decoders, and other devices.

Microcontroller Construction

The die from an Intel 8742, an 8-bit microcontroller that includes a CPU running at 12 MHz, 128 bytes of RAM, 2048 bytes of EPROM, and I/O in the same chip.

Since a microcontroller is essentially a "computer on a chip", it has the following components integrated onto one Integrated Circuit during manufacture:

  • Processor or CPU
    • This is the central processing unit which handles the arithmetic, logical and I/O (input/output) operations
  • Memory
    • There are two types of memory incorporated into the microcontroller:
      • Program Memory: This stores the firmware. It is non-volatile, meaning it isn't lost when power is disconnected. The instructions which operate the device are stored here. DCC decoders have a hybrid type, where the memory space is divided between the firmware that runs the decoder and the user space where the CVs are stored. The firmware is created during manufacture and cannot be altered in most decoders, as it is stored in Read Only Memory (ROM). Some decoders allow the user to upgrade the firmware or load new sound files to customize the decoder. During a reset the firmware reloads the factory defaults in the user's memory space, overwriting any CV changes.
      • Data Memory: This is where temporary variables are stored, which are created when the device is in operation. This stores various parameters, such as lighting functions, etc.
  • I/O Support: The IC also contains the logic needed to interface the device to other components on the PCB, such as the sound system, lighting, and motor drive. It also interfaces with the circuits which provide the digital date from the DCC packets on the track.
    • The IC may or may not contain an DAC (digital to analog) converter which allows the microcontroller to output sound to an amplifier.
    • It many also have a serial port, for SUSI interfaces.

Microcontroller Features

Microcontrollers can be simple 4-bit devices or more capable 8-bit versions. Sophisticated multifunction decoders may use 16- or 32-bit MCUs, as these allow for better sound fidelity.

They provide everything needed in a small package at a low cost, making it suitable for DCC applications, such as command stations and decoders.

What is the Difference between an MCU and CPU

  • The MCU is a standalone device, as it needs few external components to operate
  • A CPU requires a number of support ICs to provide I/O, memory control, and other functions a computer has. A CPU is designed to optimize its computing power for maximum speed
  • CPUs require external memory, in the form of RAM and ROM, for their operation
  • An MCU is the heart and brains of an embedded system
  • The CPU is the central component of a computer system.

Further Reading