Category Archives: Tips and Tricks


Code optimization tricks for AVR microcontrollers

Using high-level language compilers such as C greatly improves the development efficiency of microcontroller-based products. But when programs are written in C and compiled by a C compiler, the code efficiency is generally lower compared to an Assembly language program. However, good knowledge of microcontroller architecture and C coding helps the developers to optimize the code for reduced size and enhanced performance. For example, if we use a “do { } while ( )” loop, an increment or a decrement loop index generates different code size. Usually we write our loops counting from zero to the maximum value (increment), but

Read more

Three-Phase Electronic Watt-Hour Meter Using the MSP430F677x

The TI’s MSP430F677x devices belong to the powerful 16-bit MSP430F6xx platform, which brings in many new features and provides flexibility to support robust poly-phase metrology solutions. These devices find their application in energy measurement and have the necessary architecture to support them. This application report describes the implementation of a three-phase electronic electricity meter using the MSP430F677x metering processor. The key parameters calculated during energy measurements are: RMS current and voltage, active and reactive power and energies, power factor, and frequency. A 32-bit x 32-bit hardware multiplier on this chip further accelerates the math intensive operations during the energy computation. The

Read more

Understanding ADC parameters for accurate analog-to-digital conversions

Analog-to-digital-conversion (ADC) is required in Embedded Systems to deal with various analog world parameters such as current, pressure, motion, temperature, etc. An ADC is an electronic system or a module that has analog input, reference voltage input and digital outputs. The ADC convert the analog input signal to a digital output value that represents the size of the analog input comparing to the reference voltage. It basically samples the input analog voltage and produces an output digital code for each sample taken. This application note from Atmel describes the fundamental concepts of ADC and the associated parameters that determine the performance and accuracy of the ADC’s

Read more

Designing a RC snubber circuit

In applications including power electronics, reverse recovery effects are very common and can induce unnecessary high-frequency oscillations in the circuit. This application document from NXP semiconductors describes the design of a simple “RC snubber circuit” for suppressing the oscillations. The technique requires the extraction of the circuit parasitic capacitance and inductance, and has been illustrated well with an example in the document.  

Read more

Temperature sensor accuracy improvement using a PIC MCU

The accuracy of most of the current IC temperature sensors is about ±1°C at room temperature. However, at hot and cold temperatures, the uncertainty increases exponentially, resulting in a parabolic-shaped error curve. This application note describes a technique to enhance the accuracy of the sensor by modeling the error curve and use it to compensate for the sensor drift at a wide range of operating temperature. A PIC MCU is used to compute the equation for the curve and apply it to the sensor output to provide a more accurate temperature reading.

Read more
« Older Entries Recent Entries »