Microcontroller

DCCWiki, a community DCC encyclopedia.

Summary: A microcontroller is a compact integrated circuit designed to govern a specific operation in an embedded system. A typical microcontroller includes a processor, memory and input/output (I/O) peripherals on a single chip.

Microcontroller

A microcontroller or MCU is an IC which is custom designed for a specific application, such as a television or microwave oven. Due to their low cost, they are found everywhere.

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 applications of a microcontroller was with the Hornby Zero 1 command control system developed during the 1970s.

Microcontroller Construction

Since a microcontroller is essentially a "computer on a chip", it has the following components integrated onto one IC.

  • 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

They can be simple bit devices or more capable 8 bit versions. More sophisticated decoders may use a 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.