Flash programming of AT89 microcontrollers using ISP adapter

Microcontrollers family AT89C has a parallel programming interface of flash memory. To write information, we need to supply programming voltage +12V, and for controlling, almost all pins of ports are used. This is why parallel programming is done in special devices – programmers. Microcontrollers AT89S, besides parallel programming ability, have ISP programming ability. Using the Serial programming interface doesn’t need +12V of programming voltage because the inside interface is voltage converter included.

Continue reading

Embedded C program libraries and linking

What is a compilation of programs? Maybe it is more or less clear? But what is program linking? I am sure many beginners heard of this but done exactly know what it is. In a few words, I can say that linker creates an output file from relocatable objects. The compiler is not one big program. It usually consists of up to a dozen smaller programs. Some programs, so-called program driver, control these programs. This driver can be a makefile and make.exe program. The whole compiler pieces are the preprocessor, the syntactic and semantic checker, code generator, the assembler, the optimizer, the linker, and make program. Lets see a common example of the compiling procedure: These programs are split into pieces for easier design and maintenance as each is a specialized program on its own. In many cases, the same program can be used for different programming languages. One disadvantage of running different tools will take a longer time than running one bigger program because there is a need to send information between programs.

Continue reading

Sensing Sound Wave with microcontroller

A sound wave can be sensed by using a sound sensor. If you are designing a robot, sometimes it is useful to enable sensing of sound. Then you can program your robot to follow your voice commands. In some cases, sound wave sensors are used as collision sensors. A sound wave sensor is a microphone. The microphone is a device that converts sound pressure into electric signals. Let’s see how sound waves can be sensed. As we already know, the sound is a complex signal which consists of multiple different frequency waves. One sound wave can be represented as sin or cos signal: When many of such waves are summed (s called harmonics), we can represent any analog signal- any shape and any frequency.

Continue reading

IrDA interface for an embedded systems

IrDA is a transmission standard commonly used in computers and peripherals like mobile phones. The primary purpose of IrDA is to provide device-to-device communication over short distances. IrDA solves the problem of usage cables, which may differ from machine to machine. With IrDA, no wires are required, so this is easy to connect the same device to multiple device types like your mobile phone to laptops, other mobile phones, or PDA’s. IrDa standard requires close communication of devices. This is low power transmission. It is essential because regulations are guarding the maximum level of IR radiation that can be emitted. It is also reasonable to assume that the two devices to communicate will be physically pointed toward each other before use. And only two devices can communicate at the same time. So IrDA doesn’t have to deal with collisions. And the main thing that IrDa is simple, cheap, and requires low-cost parts. The IrDA standard specification states that supported data rates can be between 2400bps and 115.2kbps over 1-meter distances. Later standard has expanded to support 1.152 and 4 Mbps. The transmitter beam angle is from 15 to 30 degrees, and the receiver has A viewing angle of 15 degrees.…

Continue reading

Clockless CPU design

Clockless CPUs are so-called asynchronous CPUs where are not clock generator needed, which clocks every synchronous operation. Asynchronous processors give results, not after a defined number of clocks, but after it finishes operations. This is a key to effective energy usage, and asynchronous processors generate less noise than synchronous. Asynchronous processors have couple advantages against synchronous: Components can run at different speeds inside a clockless CPU, while clocked CPU components are tied to a clock generator. Clockless CPU operation stages don’t depend on clocks and can be finished faster than normal, and there is no time gap between stages as there is no need to wait for the next clock cycle. For instance, it can show the operation results rather than waiting for the next clock cycle like it is in a synchronous CPU.

Continue reading

Embedded RTOS System

RTOS ( Real-Time Operating system) is a programming environment that interfaces hardware and desired tasks. RTOS usually has a built-in set of services (interfaces and functions) that allow interaction between tasks and hardware. Because most low-level functions are performed by RTOS, the realization of programs becomes much easier. What is the difference between Embedded RTOS System and a regular OS (Operating System)? The main difference is that RTOS performs tasks according to reaction time on one or another event. Many microcontrollers have the ability to support one or another Real-Time Operating System.

Continue reading

Testing Your Embedded System

AVR_DDS_saw_tooth

Every time you are making some circuit or more complex system, you always do some testing to ensure that your electronic creation is working properly and exposing it to publicity. Let’s say you are constructing some robots. Then a typical list of the testing task may be as follows: Stability tests using various working modes and critical supply voltages (like 4,75 and 5,25V); Start-up testing purpose is to check system readiness to accept commands after power-up; Checking correctness of executed commands; Checking correctness of sensors; Sometimes you will need to prepare good documentation where every node reliability is calculated. Also, testing methods of each node may be included in the documentation. Of course, many devices may work in a wider range of supply voltages, but there are always some electronic components that need more than 5% stability.

Continue reading

Microcontroller Brown-out detection

Mostly all microcontrollers have built-in Brown-out Detection (BOD) circuit, which monitors the supply voltage level during operation. BOD circuit is nothing more than the comparator, which compares supply voltage to a fixed trigger level. If the microcontroller doesn’t have an On-Chip Brown-Out detector, then there can be an external circuit used : In the image above, there is a discrete brown-out detector circuit. There are particular IC where additional delay circuitry and hysteresis used to normalize supply voltage may take some time in a real word. Such ICs are cheaper than one built from discrete components.

Continue reading

How to measure signal period using microcontrollers

Measuring the signal period is a common problem in embedded systems. This can be measuring the time between two events or measuring signal frequency f=1/T and so on. Measuring the time interval or period is based on comparing event time t with discrete-time usually produced by a timer. This usually is done by filling the event time t with discrete-time intervals t. According to this, the discrete-time signal period has to be much shorter than event time: t<< t. Then counting these short time intervals, we can determine the event time.

Continue reading

Why to move from ASM to C

ASM language is a low-level programming language. It takes tons of time to develop embedded programs. Now even 8-bit microcontrollers aren’t as small as they were earlier. The program memories are climbing to a megabyte(s). Program structure becoming more complicated because of the bigger functionality demand. This is why it is better to use higher-level programming languages like C. By using C language, you are not overwhelmed by details. You don’t always have to think about hardware logic to be able to program its restricted tasks. It is better to give this work to the C compiler, which helps you avoid bugs at the silicon level.

Continue reading