How to describe embedded software design using diagrams and pseudo-code

When designing embedded hardware, you probably want to visually express what embedded software will be performing and how different functions depend on each other. How to make software documentation simple, clear, and informative. If you are a developer, you may want to explain your ideas understandably without loads of code text. Depending on what level of information has to be provided, you may choose any of the following. Data Flow Diagram Data flow diagrams are used to see the processes and what data is transferred between different functions. This way, each process or function is expressed as a block (or any other shape), while lines show what information passes between processes. As you can see in the example figure simple data flow diagram is presented. Without program code, it is easy to read how the program operates:

Continue reading

Microwire compared to SPI and I2C

Microwire is a three-wire serial interface used by National Semiconductor in its COPS processor family. The three signals are SI (serial input), SO (serial output), and SK (serial clock). SI and SO are input to and output from the processor, respectively. The processor clocks data to the peripheral on SO and receives data on SI. Data in both directions is captured on the rising clock edge. Peripheral devices that transfer data in only one direction (such as display drivers that are only written, never read) may implement only one data line, SO, or SI. Microwire is an older protocol than SPI, and it has some differences from it. Original Microwire has fixed clock polarity and clock phase. At the same time, SPI can be configured to any clock polarity and phase. Unlike I2C, the Microwire protocol has no device addressing built into the serial bitstream. Microwire peripherals require a separate chip select input, one per device. This allows data to be transferred more quickly since address information is not needed. However, it requires more port bits since one chip select, using one port bit, is needed per peripheral. Each Microwire peripheral has a unique protocol based on the application. The…

Continue reading

AVR reads button state and indicates on LED

This is a simple demo program of reading button state, lighting LEDs, sending information via USART. 8 buttons are connected to Atmega16 port A, 8 LEDs to port B via current limiting resistors. While none of the buttons aren’t pressed, there is a running light on LEDs performed, but when any of the buttons are pressed, LEDs display the current 8 bit counter value in binary format. The same value is sent via USART – you can see a number in the terminal is connected. The program is very simple:

Continue reading

Measuring of electrical energy consumption

Electromechanical energy counters were popular for more than 50 years. Today, you can find them only in older houses or in low-budget appliances because today, electronic energy counters are taking their place. And there are many reasons to do so. For instance, measurement accuracy, flexibility, multi-rate support, memory, statistics, remote reading and control, automatic register, and so on. These features can be built into one small chip, which will serve with high reliability and low price. Let’s see how energy (active power) consumption is measured. Active power which is required in the form of alternate current (AC) can be calculated as average power over one period:

Continue reading

DIY USB to RS232 adapter

Sometimes you need to connect some device to a COM port, but the computer doesn’t have one, especially a laptop. There are two ways – go and buy a USB to COM adapter or build one. So if you decided to build a USB to COM(RS232) adapter, there is one solution. This adapter is straightforward to build as there is a single-chip USB to UART bridge (CP2102). This chip from Silicon Labs supports USB2.0 full speed. Internal Resistors are required for the USB interface, integrated clock, internal 1024 -byte EEPROM for Vendor ID, Product ID serial number, power descriptor, and other information. SP2102 USART part support almost all standard features of RS232 communication including handshaking, Databits (5, 6, 7, and 8); 1 or 2 stop bits; odd, even, mark, space, and no parities; baud rate from 300bps to 1Mbits.

Continue reading

Oscilloscope probes for accurate signal measurements

Oscilloscope Probes Measuring signals with oscilloscopes may be a challenging task especially high-frequency ones. Without proper oscilloscope probes, correct measurement of high-speed time-domain signals wouldn’t be possible. For high-speed measurement, you should consider signal parameters like amplitude, source impedance, rise time and bandwidth. There is a wide variety of probes available – passive, active, current-measurement, optical, high voltage, and differential. But let’s narrow the discussion to probes used to measure signals with wide bandwidth and short rise times. There are also many variations on what probe is proper. As probes are potential load to measured circuits, it is important to know their sensitivity to resistive, capacitive, or inductive loading. Incorrectly chosen probes (like high capacitance) can distort the fast-rising signal. Some circuits may not tolerate probes at all (high-speed amplifiers).

Continue reading

AVR based TDA7313 Audio processor control

TDA7313 audio processor has been used for more than ten years because of its simplicity, functionality, and proper parameters like low distortion and low noise. Chip is based on BIPOLAR/CMOS technology and can be used in various applications, including car radios, Hi-FI, simple mixers. TDA7313 chip has three external stereo inputs that allow multiplexing three incoming sound sources. It has a volume control with steps of 1.25dB, Treble and BASS control, Loudness function. Each of the four outputs has a distinct control that allows balancing outputs. A chip can be controlled via an I2C (TWI) interface. Description of Audio processor This project’s idea was to construct an independent audio processor that can be embedded in any sound system with the ability to control settings with a simple button interface with a menu preview in LCD. The intent was to cover all audio-processor functionality within the LCD menu.

Continue reading

Simulate KS0108 graphical LCD with Proteus simulator

Today it is common practice to use various circuit and microcontroller simulators for developing programs. Using simulators, you have several benefits comparing to real prototype boards. You don’t have to connect any hardware to test a piece of code; also, you don’t have to be in the same place when working. You can have simulator software on your Laptop and work where ever you want. Of course, you can see more parameters within the simulator like register values, memory, signals in a convenient form. So controlling graphical LCD on simulator software like Proteus is an easy task.

Continue reading

Reliable soldering with fluxes

Reliable soldering can be achieved by soldering clean surfaces. Usually, surfaces are cleaned with abrasives and solvents, but after the surface is cleaned surface immediately oxides, especially when heated. During oxidation, the surface is covered by thin oxide film, which prevents solder from contacting metal. This is why flux is used in the soldering process. To remove/deoxidize, surface flux must be applied during soldering. Flux chemically removes surface oxide when heated and makes a good metal to solder contact. There are several categories of soldering fluxes: Acid Flux (or commonly known fluxes: Zinc chloride, hydrochloric, ammoniac); Organic Flux; Rosin Flux. Each flux has its own specifics and may be used for different soldering technologies.

Continue reading