In envisaging a new microcontroller design, it is prudent to follow a design procedure that will take you from the initial problem statement to a programmed microcontroller that can be embedded in application hardware. In this article, we look at key steps to follow when you are designing a new microcontroller-based system.
Contents
- 1 Describe the Problem
- 2 Sketch a Functional Diagram
- 3 Ascertain the Input/output Requirements
- 4 Decide on Suitable Microcontroller Types
- 5 Identify the Required Interface Circuits
- 6 Select a Programming Language
- 7 Sketch the Schematic
- 8 Draw a Program Flowchart
- 9 Write the Code
- 10 Lastly, Build and Test Microcontroller System
Describe the Problem
Explain the desired function of the device, that is, what the intended microcontroller system is supposed to accomplish.
Sketch a Functional Diagram
Sketch a block diagram that demonstrates all of the key components of the design and shows how they are interconnected. Each component can be illustrated as a square with a descriptive label inside or preferably, as a pictorial representation. Utilize single lines to connect the components regardless of the number of wires that may be involved, and incorporate arrowheads to indicate the direction of signal flow.
Ascertain the Input/output Requirements
Identify and list the types of inputs and outputs needed, and what functions are required to be done by the microcontroller. For example, you are required to identify the number of every type of I/O line you may need, including digital inputs, digital outputs, analog-to-digital converters (A/D), digital-analog-converters (D/A), and the serial ports.
Decide on Suitable Microcontroller Types
Depending on types and the number of inputs and outputs that have been identified in step 3, select one or more microcontrollers that have enough on-chip resources. The expected amount of program and data memory required will also guide you on which choices are appropriate. For example, a very complex program with significant data storage requires a microcontroller with sufficient memory capacity.
Identify the Required Interface Circuits
Using the microcontroller input and output circuit specifications to design the appropriate interface circuitry using pull-up resistors, buffers, transistors, relays, and amplifiers where necessary. Much of the information can be found in the Microcontroller documentation i.e. datasheets and through your own research.
Related:
- How to Interface PIC Microcontroller to Input & Output Devices
- Interfacing LEDs & Electromechanical Relays to Microcontrollers
Select a Programming Language
Most microcontroller programmers use C, while others use assembly language. If you are working with PIC microcontrollers, you may also use PICBASIC Pro especially when working with simple programs. Note that, we have other key factors that can influence which programming language to use. For example, if your programming solution requires complicated calculations, algorithms or data structures, then C is the appropriate choice, on the other hand, if you application requires extremely fast execution speed or if the memory capacity is a limiting factor, then assembly language is the better choice.
Related articles:
- An Overview of Assembly Language for Programming Microcontrollers
- PIC Microcontroller Input-Output Ports Programming in C
Sketch the Schematic
Sketch a detailed schematic showing the required components, input and output interface circuitry, and wire connections.
Draw a Program Flowchart
A flowchart is a graphical representation of the required functionality of your software; this is illustrated in the figure below:
The flow control block is used as a destination label for a GOTO branch or a loop e.g. for or while loops. The functional block represents one or more instructions that perform some task. The decision block is used to represent logic decisions.
Write the Code
After creating the program flowchart, implement it in software by writing code to create the desired functionality.
Lastly, Build and Test Microcontroller System
Software development tools like IDE can help in developing the code. Compile your code into machine code and download the resulting hex file (burn the code) to the microcontroller. This can be done using a programming device available for the specific microcontroller you are working with. After downloading the code, assemble the system hardware, including the microcontroller, and interface circuitry. After that, fully test the system for the desired functionality. These last two steps can be done incrementally, as you build the functionality, while carefully testing each addition before continuing. A case in point is handling each input incrementally, and testing the output functionality.
Related articles:
- How a Microcontroller can be used in a Temperature Measurement System
- Peripheral Devices used with Microprocessors
- How to Create a PIC Project using MPLAB X IDE
- Development Boards for PIC Microcontrollers Programming
- Position Control using a Microprocessor-Based System
Leave a Reply