Microcontroller Archives - Electro-Unics https://uelectronics.info/category/microcontroller/ Microelectronics Blog Fri, 30 Jun 2023 14:29:20 +0000 en-US hourly 1 https://wordpress.org/?v=6.0.2 https://uelectronics.info/wp-content/uploads/2022/09/cropped-uajzicuy-32x32.png Microcontroller Archives - Electro-Unics https://uelectronics.info/category/microcontroller/ 32 32 Unlocking the Power of Software Design for Maximum Efficiency https://uelectronics.info/unlocking-the-power-of-software-design-for-maximum-efficiency/ Fri, 30 Jun 2023 11:53:17 +0000 https://uelectronics.info/?p=220 Software design is a critical aspect of software development, playing a key role in creating a structured and functional software system. Effective software design facilitates the development of efficient and reliable software applications while assisting developers in managing the complexity of their projects. In this article, we will explore the concept of software design, its […]

The post Unlocking the Power of Software Design for Maximum Efficiency appeared first on Electro-Unics.

]]>
Software design is a critical aspect of software development, playing a key role in creating a structured and functional software system. Effective software design facilitates the development of efficient and reliable software applications while assisting developers in managing the complexity of their projects.

In this article, we will explore the concept of software design, its benefits, underlying principles, best practices, current trends, and strategies for creating an efficient software design. Additionally, we will discuss the available tools for software design and their application in developing web and mobile applications.

What is Software Design? Software design involves planning the structure and behavior of a software system. It encompasses the analysis of user requirements and the creation of a design that fulfills those requirements. This process includes defining the software’s architecture, components, interfaces, and other essential elements.

The primary goal of software design is to develop a reliable, efficient, and user-friendly software system.

It requires making decisions regarding functionalities, features, and technology implementations within the software system.

Software design can be categorized into two main types:

  • Architectural design: This phase involves designing the overall structure and framework of the software system. It includes decisions regarding components, interfaces, and other system elements.
  • Detailed design: This phase focuses on designing specific components of the software system. It entails creating diagrams, flowcharts, and visual representations that illustrate the detailed design of the software system.

Benefits of Software Design Software design offers numerous advantages for developers and businesses. Some key benefits include:

  • Reduced development costs and time: Well-designed software systems leverage existing components and code, reducing development costs and time. Additionally, they are easier to maintain and extend.
  • Enhanced software reliability: A sound software design contributes to a more reliable software system that is less prone to errors. It also simplifies the testing and debugging processes.
  • Improved maintainability and extensibility: A well-designed software system is easier to maintain and extend. It allows for the seamless addition of new features and modifications.
  • Enhanced user experience: A well-designed software system provides an optimal user experience. It is user-friendly, intuitive, and easy to use and understand.

Software Design Principles Software design principles serve as guidelines for developing efficient and reliable software systems. Here are some essential software design principles:

  • KISS (Keep It Simple, Stupid): Simplicity is key. Software systems should be designed to be as simple as possible to reduce complexity, improve maintainability, and ease extension.
  • DRY (Don’t Repeat Yourself): Avoid code and data repetition in software systems. This minimizes development time and costs while simplifying maintenance and extension.
  • YAGNI (You Ain’t Gonna Need It): Software systems should only include necessary features, reducing complexity and facilitating maintainability and extensibility.
  • Separation of Concerns: Software systems should be designed to separate distinct concerns, reducing complexity and enabling easier maintenance and extension.
  • Modularity: Design software systems with modular components, minimizing complexity and facilitating maintenance and extension.
  • Layered Architecture: Adopt a layered architecture in software design to reduce complexity and improve maintainability and extensibility.

Software Design Best Practices Following best practices during software design helps ensure the development of high-quality software systems. Here are some important software design best practices:

  • User-centric design: Design software systems to meet user needs, emphasizing an intuitive and user-friendly interface that is easy to understand and use.
  • Performance-oriented design: Optimize software systems for efficiency and reliability. This includes code optimization and ensuring scalability to handle large amounts of data.
  • Scalable design: Design software systems to scale based on user demands. Enable easy extension and modification to accommodate changing user requirements.
  • Reusability-driven design: Promote code and component reusability to reduce development effort and facilitate modular design structures that can be leveraged in other systems.
  • Maintainable design: Design software systems with maintainability in mind, utilizing version control systems and ensuring ease of maintenance and extension.

Software Design Trends Software design continuously evolves to meet the demands of users and businesses. Here are some prominent software design trends:

  • Modular design: Modular design is gaining popularity, allowing for the reuse and extension of software components across various projects.
  • Microservices architecture: Microservices architecture is becoming increasingly prevalent. It involves breaking down software systems into smaller, independently deployable services.
  • Cloud-native design: Cloud-native design is on the rise, involving the development of software systems specifically for deployment on cloud platforms like Amazon Web Services or Microsoft Azure.
  • API-first design: API-first design is growing in importance, focusing on designing software systems with an API-centric approach to facilitate integration with other systems.
  • Responsive design: Responsive design is gaining traction, emphasizing software systems that adapt to different device sizes and resolutions, ensuring optimal usability across devices.

Creating an Efficient Software Design Creating an efficient software design requires careful consideration of user requirements, system constraints, and software design principles. Here are some tips for creating an efficient software design:

  • Gather user requirements: Start by understanding user needs and goals, creating a design that aligns with their requirements.
  • Understand system constraints: Take into account hardware and software constraints to ensure the software design complies with system limitations.
  • Establish an architecture: Develop an architecture that encompasses components, interfaces, and other essential elements of the software system.
  • Design the components: Design individual components with attention to detail, ensuring they meet user requirements and system constraints.
  • Test the design: Thoroughly test the software system design to ensure it aligns with user requirements and system constraints.

Tools for Software Design Several tools are available to assist with software design. Here are some popular options:

  • UML tools: UML (Unified Modeling Language) tools like Visual Paradigm and Rational Rose enable the creation of UML diagrams for visualizing software system designs.
  • Architecture tools: Architecture tools such as Enterprise Architect and System Architect facilitate the creation of diagrams, models, and visual representations of software system architectures.
  • Prototyping tools: Axure and Balsamiq are examples of prototyping tools that allow the creation of interactive prototypes for testing the user experience and usability of software systems.
  • Code generation tools: CodeSmith and AutoCode are code generation tools that automatically generate code based on software designs. These tools reduce development time, costs, and enhance maintenance and extension capabilities.

Software Design for Mobile Applications Designing software for mobile applications requires specific considerations. Here are some tips for mobile application software design:

  • Focus on performance: Optimize mobile applications for efficiency and reliability, including code optimization and handling large data volumes effectively.
  • Design for touch: Develop user interfaces specifically for touchscreens, ensuring ease of use and interaction by incorporating larger buttons and touch-friendly elements.
  • Design for multiple devices: Design mobile applications to function seamlessly on different devices. Account for various screen sizes, resolutions, and operating systems.
  • Design for offline use: Create mobile applications that can be used offline, allowing data storage on the device and enabling continued use without an internet connection.
  • Design for security: Prioritize security in mobile application design, implementing secure authentication methods and ensuring protection against vulnerabilities.

Software Design for Web Applications Designing software for web applications necessitates specific considerations. Here are some tips for web application software design:

  • Design for scalability: Develop web applications with scalability in mind, leveraging technologies such as containers and serverless computing. Enable easy extension and modification.
  • Design for performance: Optimize web applications for efficiency and reliability, including code optimization and ensuring seamless handling of significant data loads.
  • Design for security: Place emphasis on security in web application design, implementing robust authentication methods and safeguarding against potential attacks.
  • Design for accessibility: Ensure web applications are accessible to all users, adhering to accessibility standards and considering usability for individuals with disabilities.
  • Design for compatibility: Design web applications to be compatible with various browsers and devices. Ensure responsiveness to different screen sizes and resolutions.

Conclusion Software design is an integral part of software development, guiding the planning of software system structure and behavior. A well-designed software system enhances efficiency and reliability. This article explored software design concepts, benefits, principles, best practices, current trends, and strategies for creating an efficient software design. Additionally, it highlighted the available tools for software design and their applicability to web and mobile application development. By following the tips and best practices outlined, you can unlock the power of software design for maximum efficiency in meeting the needs of users and businesses. If you’re seeking assistance in creating an efficient and reliable software design, feel free to contact us at [CTA] to learn more.


The post Unlocking the Power of Software Design for Maximum Efficiency appeared first on Electro-Unics.

]]>
Microcontroller families https://uelectronics.info/microcontroller-families/ Fri, 22 Apr 2022 13:07:00 +0000 https://uelectronics.info/?p=132 The MC kernel refers to the set of specific instructions, the cyclic operation of the processor, the organization of both program and database memory

The post Microcontroller families appeared first on Electro-Unics.

]]>
The MC kernel refers to the set of specific instructions, the cyclic operation of the processor, the organization of both program and database memory, the interrupt system and a basic set of peripheral devices (PU).

Representatives of one family differ from each other by the size of program and database memory, as well as by the variety of PU.

Unite all the MCs in the family the same binary programming code.

The families are divided into:

MSC-51, made by Intel. Monocrystal MC based on Harvard architecture. The main representative of this family is the 80C51 which is based on CMOS technology. Although these controllers were developed back in the 1980’s, they are still widely used. And today many companies such as Siemens, Philips and others produce their controllers with similar architecture.
PIC (Microchip). Harvard architecture MC. It is based on the architecture with reduced instruction set, built-in command and data memory, low power consumption. This family includes more than 500 different MCUs (8-, 16-, 32-bit) with different periphery, memory and other characteristics.
AVR (Atmel). The high-speed controllers are designed on their own architecture. The basis of the controller is a Harvard RISC processor with independent access to program and database memory (Flash ROM). Each of the 32 general-purpose registers can operate as a register-accumulator and aggregate 16-bit instructions. The high performance of 1 MIPS per MHz clock frequency is enabled by an instruction ordering that executes one instruction while preparing for the next. To support its products Atmel provides a free and high-quality development environment Atmel
ARM (ARM Limited) are designed on their own architecture. The family includes 32-bit and 64-bit MCUs. ARM Limited only develops cores and their tools and sells production licenses to other companies. These processors consume little power, so they are widely used in the production of cell phones, game consoles, routers, etc. Companies that have purchased licenses include: STMicroelectronics, Samsung, Sony Ericsson, etc.
STM (STMicroelectronics). 8-bit controllers (STM8) belong to the category of high-reliability, low-power products. This family also includes controllers STM32F4 and STM Their basis is 32-bit Cortex. These controllers have a perfectly balanced architecture and have a great development perspective.

These are not all families of microcontrollers. Here we are just talking about the main ones.

Types of microcontroller packages
There are no external differences between the MCs and other microcontrollers. Crystals are placed in packages with a certain number of outputs. All MC’s are available in only 3 types of packages:

The DIP package has two rows of pins. The distance between them is 2.54 mm. The pins are inserted inside the holes on the contact pads.
The SOIC package. This is suitable for installations that require the pins to be resoldered to the pad. The pin spacing is 1.27 mm.
QFP (TQFP) packages. The pins are located on all sides. The distance between them is 3 times less than in DIP. The enclosure is square in shape. Intended for surface soldering only.
QFN housings. The smallest compared to the previous ones. The contacts come out 6 times more often than in DIP. The QFN is very popular in industrial production, as it allows to reduce the size of produced devices.
QFP package

Each of the packages has its own application points. The first 3 can be used by hobbyists.

The post Microcontroller families appeared first on Electro-Unics.

]]>
The microcontroller is https://uelectronics.info/the-microcontroller-is/ Sat, 16 Apr 2022 13:49:00 +0000 https://uelectronics.info/?p=33 A microcontroller is a special microchip designed to control various electronic devices.

The post The microcontroller is appeared first on Electro-Unics.

]]>
A microcontroller is a special microchip designed to control various electronic devices. Microcontrollers first appeared in the same year as general-purpose microprocessors.

Microcontroller designers came up with a clever idea – to combine processor, memory, ROM and peripherals inside one housing that looked like an ordinary microchip. Ever since, microcontrollers have far outnumbered processors every year, and the demand for them has never diminished.

Dozens of companies produce microcontrollers, and not only modern 32-bit microcontrollers, but also 16-bit and even 8-bit microcontrollers (such as the i8051 and others). Within each family, you can often find almost identical models, differing in CPU speed and memory size.

The fact is that microcontrollers are mostly used in embedded systems, in toys, in machine tools, in mass home appliances, in home automation – where not the power of the processor is needed, but rather a balance between price and sufficient functionality.

That’s why the oldest types of microcontrollers are still around – they can do everything from automatically open doors and turn on lawn irrigation to integrate into a smart home system. But there are more powerful microcontrollers, capable of hundreds of millions of operations per second and packed to the teeth with peripherals. They have relevant tasks, too. Thus the developer first evaluates the task, and then chooses a suitable hardware for it.

Today there are over 200 microcontroller modifications compatible with i8051, produced by two dozen companies and a lot of microcontrollers of other types. Microchip Technology’s 8-bit PIC microcontrollers and Atmel’s AVR, TI’s 16-bit MSP430 and ARM’s 32-bit microcontrollers, which ARM Limited develops and sells licenses to other companies to produce them.

A microcontroller is characterized by a large number of parameters because it is a complex program-controlled device and an electronic device (microcircuit) at the same time. The prefix “micro” in the name of the microcontroller means that it is made by microelectronic technology.

During operation, the microcontroller reads commands from the memory or input port and executes them. What each command means is determined by the command system of the microcontroller. The command system is embedded in the architecture of the microcontroller and the execution of the command code is expressed in the execution of certain microoperations by the internal elements of the chip.

Microcontrollers allow flexible control of various electronic and electrical devices. Some microcontroller models are so powerful that they can directly switch relays (e.g. on Christmas tree lights).

The microcontrollers usually do not work alone, but are soldered into a circuit where screens, keyboard inputs, various sensors, etc. are connected in addition to it.

Microcontroller software can appeal to those who love to “chase bits” because typically microcontroller memory is between 2 and 128 KB. If it is less then it is assembler or Forth, if it is possible then it is Basic or Pascal but mostly it is C. Before the final programming of the microcontroller, it is tested in emulators – software or hardware.

The post The microcontroller is appeared first on Electro-Unics.

]]>
Principle of microcontrollers https://uelectronics.info/principle-of-microcontrollers/ Thu, 20 May 2021 13:52:00 +0000 https://uelectronics.info/?p=37 Principle of microcontrollers

The post Principle of microcontrollers appeared first on Electro-Unics.

]]>
The AVR microcontrollers of the Tiny family are characterized by one or two timers. They are Timer0 and Timer1. Usually one of the timers has a simplified set of functions (Timer0) and the second one has an extended set of functions (Timer1). If there is only one timer in a MC, then it has an extended set of functions in most cases.
This timer has an extended set of functions. In the ATtiny 26 microcontroller it is an 8-bit timer like Timer0. The list of functions this node can perform:

Time interval counting.
Generating an interrupt on counter overflow.
Hardware generation Pulse Width Modulated Signal (PWM) (2 channels).
Comparison of the counter with the preset values OCR1A, OCR1B registers, and generating interrupts in case of a match.
Possibility of clocking from system clock generator (fc) (synchronous mode), as well as from internal 64 MHz FALC circuit (fpck). (Asynchronous mode). Structurally, the processor is designed as a single chip (sometimes several).

The chip consists of a plastic or ceramic package, which contains a miniature semiconductor substrate inside (Figure 1). On this substrate all electronic circuits of the microprocessor are “drawn” by a laser. The inputs and outputs of the circuit on the substrate are connected to the metal pins located on the sides or bottom of the chip body.

Consider the simplest method – the counter counts in normal mode – cyclically due to overflow. Interrupts are also involved by comparing, say, the register OCR1A. In the overflow interrupt we will turn on the OUT output by feeding log.1 to it. In the Timer1CompA comparison interrupt we will turn the output off by feeding log.0 to it.

So, we will get a sequence of pulses that go with the same period (equal to the counter overflow period, which can be calculated as 256 / ft), where ft is the clocking frequency of the timer. The pulse length will be proportional to the value in the OCR1A register, the larger the value, the later the output will turn off, the longer the pulse will be and the smaller the pause.

Actually the method described is actually software PWM shaping, Timer1 contains a hardware PWM modulator that turns the outputs on and off itself under the conditions described. Interrupt signals are also generated, but usually when operating in PWM mode interrupts from the timer are not used and are prohibited in the control register settings.

To enable the hardware PWM modulator there is a corresponding flag in the control registers. When switching to PWM mode the timer operation is slightly different from the standard mode. Here, by default, the timer does not count to overflow, but to the value that is written in the OCR1C register. When TCNT1 and OCR1C are equal, the counter is reset to 0. This allows accurate pulse frequency setting, it depends not only on the clocking frequency, but also on OCR1C value.

Having two comparison registers OCR1A and OCR1B makes it possible to have two PWM modulator channels (but with the same frequency). So you can easily control two loads of the same type, for example, to change the brightness of two LED lamps independently.

Note that the value of registers OCR1A and OCR1B can range from 0 to OCR1C. Of course, nobody forbids to write there a value greater than OCR1C, but in this case we will have a constant level signal on the output, but not a pulse sequence, because the value of TCNT1 will never reach the condition of equality with the comparison register, according to the signal on the output will not change.

The PWM modulator in the ATTiny 26 has direct outputs OC1A, OC1B as well as inverse outputs OC1A, OC1B. At that the levels on the inverse outputs in PWM mode do not change simultaneously with the change of levels of direct outputs. The transition from 0 to 1 of the inverse pulse occurs one period later than the transition from 1 to 0 on the direct output, and the reverse transition from 1 to 0 on the inverse output occurs earlier by one period than the transition from 0 to 1 on the direct output. The switching of direct and inverse outputs, as well as the order of signal change on them, can be changed by means of control registers. The standard formation of the PWM signal by the timer ATTiny 26 is shown in the figure: It should be noted that the value in the registers OCR1A and OCR1B change when the counter is zeroed. This is hardware implemented with so-called buffer registers, that is, the program can change the value at any time, but writing it to the comparison registers will happen at the moment when the counter goes through 0, until then they are stored in a buffer.

The post Principle of microcontrollers appeared first on Electro-Unics.

]]>
How a microcontroller works https://uelectronics.info/how-a-microcontroller-works/ Tue, 09 Mar 2021 13:55:00 +0000 https://uelectronics.info/?p=40 An arithmetic-logic device (processor), which performs calculations and logical operations;
Memory (RAM)

The post How a microcontroller works appeared first on Electro-Unics.

]]>
In a microcontroller are:

An arithmetic-logic device (processor), which performs calculations and logical operations;
Memory (RAM)
Program memory (Flash), which is analogous to PC hard drive, it stores the program firmware;
Nonvolatile memory (EEPROM), where the program can store data that will not disappear when power is turned off. The program memory is also non-volatile but can not be used for storing program data during operation (in principle it is possible but not done due to limited number of write/erase cycles (10000 for AVR)).
The I/O ports which are used for communication with the “outside world”. If the PC ports are standardized and each have their own purpose, then they are just pins which can be configured programmatically depending on the wishes of the developer of the device on the MCU.
Other peripherals such as an analog-to-digital converter (actually measures the voltage value at the input, outputting the result in digital form), an analog comparator (compares analog signal voltages and outputs a value greater than / less than 1 or 0), timers that are used to measure time intervals, delays, and other functions.
Many MCUs also have UART (serial port), JTAG (protocol for debugging the program inside the controller), USB and other interfaces built in.

What Microcontrollers Purpose
And now let’s talk about the application area of the MC. You can’t think of anything here:

Use to replace complex logic circuits. If there is no requirement for speed, because still the program will calculate your logic function may introduce a delay much greater than a circuit built on elements of discrete logic (microcircuits series K155, K176 and similar).
One example is, for example, a circuit that implements a dynamic display on seven-segment LEDs.

The operation of sensors as well as drives and lighting control is done with a microcontroller C8051. And it, in turn, is connected to a PC, tablet or other device with a complete operating system.
Application in various robotic devices, including drones;
For example, the quadcopter is guided by the “Crius MultiWii SE” board, which is built on the AVR ATMEGA328P microcontroller. It processes signals from tilt angle, acceleration, pressure, magnetic field (compass) sensors, and allows for flight stabilization

Control units for household appliances (washing machine, food processors, microwave ovens, etc.), audio equipment (regulation from remote control e / y). are also often used as control devices in voltage stabilizers. For example, relay regulators are basically built on a microcontroller which, by measuring the voltage presented to the ADC input, draws a conclusion as to how the transformer windings should be turned on so that the output is about 220.

Various programmers and other devices, act as interface converters from the PC to other devices. For example, a K-Line adapter for diagnostics of injection engines.

The post How a microcontroller works appeared first on Electro-Unics.

]]>
What you need to program a microcontroller https://uelectronics.info/what-you-need-to-program-a-microcontroller/ Thu, 17 Dec 2020 13:11:00 +0000 https://uelectronics.info/?p=135 In order for the microcontroller to be able to perform the necessary functions and solve certain tasks, it must be programmed.

The post What you need to program a microcontroller appeared first on Electro-Unics.

]]>
In order for the microcontroller to be able to perform the necessary functions and solve certain tasks, it must be programmed.

The programming path goes through several steps:

Before you can start writing program code, you must decide on the end goal.
An algorithm for the operation of the program is drawn up.
The actual writing of the program code. The codes are written in C or Assembler.
Compiling the program, i.e. converting it into binary or hexadecimal 1 and 0. This is the only way for the computer to understand it.
The compiled code is written into the memory of the controller.
The firmware is programmed into the Microcontroller. There are two types of connection: via COM or USB. The easiest and cheapest is the USBASP programmer.
The testing and debugging of MC’s on a real device.

Radio amateurs sometimes do without prescribing the algorithm of the program on paper. They keep it in their head.

Programming Languages
Programming languages for MCs do not differ much from classic computer languages. The main difference is that MCs focus on working with peripherals. The architecture of the MC requires bit-oriented instructions. That’s why special languages were created for controllers:

Assembler. The lowest level of the language. Programs written in it are very long and difficult to understand. But nevertheless it is the best way to show the full power of the controllers and get the best performance and compact code. It is mostly suitable for small 8-bit MCUs.
C/C++. Higher level language. A program written in it is more understandable for a human. Nowadays there are a lot of program means and libraries allowing writing code in this language. Its compilers can be found on almost any model of MCU. For today it is the main language for programming controllers.
It is even easier to understand and design. But it is not used much for MC programming.

It is an old programming language. Nowadays it is almost not used.
The choice of programming language depends on the tasks to be solved and the required code quality. If you need a compact code, the Assembler will do, for the solution of more global problems the choice will be limited only to C / C + +.

The post What you need to program a microcontroller appeared first on Electro-Unics.

]]>