Timer Counters in LPC2000 microcontrollers

LPC2000 microcontrollers have at least two 32 bit timer counters. Let’s take the LPC2148 microcontroller, two general-purpose 32-bit timers that are identical except the peripheral base address. These timers are for general purposes that can perform timer and counter operations. Timers have many features: Programmable 32 bit pre-scaler; Up to four 32 bit capture channels that can take snapshots with interrupt generation ability; Four 32 bit match registers that allow generating interrupt on the match, generate interrupt and stop the timer, generate interrupt and reset the timer; Up to four output pins that can be set LOW/HIGH/TOGGLE on compare match;

Continue reading

General purpose ports in ARM MCU

NGX technologies LPC2148 development board

Microcontrollers aren’t imaginable without interacting with other devices like indicators, input devices, or other off-chip devices. For this, every MCU has I/O pins that are used to interact with the external world. General-purpose I/O ports can be accessed via registers that provide enhanced features or simply via port registers. Port registers are allocated to the ARM bus so that fast possible timing can be achieved. Control of individual bits is possible using a single instruction. All port registers are byte and half-word addressable. After MCU reset, all I/O ports are set to input. Let’s take the LPC2000 series ARM microcontroller LPC2148. It has two 32 bit general purpose I/O ports PORT0 and PORT1. PORT0 has 30 pins for input/output operations, where one is only for output. PORT1 has 16 available pins for GPIO.

Continue reading

Microcontroller Simulators and emulators

Sometimes you haven’t the ability to flash a microcontroller to test program functionality in the development phase. For this, there may be many reasons, like you don’t have a prototype ready or you need to test parts of code, and so on. For this, there are software simulators used that simulates microcontroller work without microcontroller itself. Simulators usually don’t have a connection to the real-world all operations are simulated in software. A microcontroller simulator is a program model that imitates its work. Modern simulators now simulate arithmetic operations and I/O operations and even peripherals like timers, ADC, USART, I2C, and so on. In many cases, it is possible to prepare the whole project using the simulator and then burn compiled code to a real microcontroller. Simulators usually allow: debugging at source code level; follow operation time in slow motion but with real-world values; connect stimulus signals like they are real-world signals. The simulator can be expressed as several blocks interconnected with each other:

Continue reading

Protect you car from rusting using cathode protection

Car owners know that small scratches may cause rusting, which will expand even under painted areas. Fighting rusting is a pretty hard task. There are lots of methods that car keepers are using to prevent rusting. Many are using anti-rust coating, but it has shortcomings – success depends on how good it has been done. The rusted area needs to be cleaned with care and sometimes requires disassembling some pieces of a car. Such an operation requires a decent amount of time and constant control. The car is always in a stressed environment: cold, salt, water, vibrations, stones, and other harsh conditions. There is still a chance of damaging surface coating. For constant prevention from further rusting, there is an electronic device used which requires only one installation.

Continue reading

How does tri-state buffers work

Those who work with microcontrollers probably know about data buses. Only one device(memory, peripherals) connected to the bus can work at one moment. Only one unit can directly connect to the bus beside the CPU, which usually is a host. So decoding circuit determines the desired unit and connects it to the bus. Other devices are effectively disconnected so that they wouldn’t have any effect on bus operations. Tri-state buffers carry them out. Tristate buffers allow isolating circuits from the data bus. This means that circuit is switched to a high impedance state. Usually, we know dual state circuits with two logical levels, “0” and “1”. But there is also widely used tristate logic, where it can switch I/O to a high impedance state. Tristate logic can simply be made by two transistors: Using such a circuit we can have the following output results according to input variations: Q1 Q2 Output OFF OFF High Impedance OFF ON 0V ON OFF +5V Simply speaking when the output pin is in a high impedance state it is physically disconnected from the circuit.

Continue reading

Using Gray code for rotary encoders

Gray code is well known and widely used in angular movement systems where angular positions have to be known. Gray code encoder can be constructed pretty easily by masked wheel where tracks are read with photocells. Did you look at the picture and thought for yourself that gray code is the same binary code. Well, no… the main problem with binary systems was using binary code in tracks; there are many positions where several tracks change state simultaneously. This may result in an error. Actually, in gray code, only one track can change at the same time during rotation. So then, if an error occurs, the resulting error will be only one bit. Gray code is easy to convert to binary this task can be done by any microcontroller using a lookup table:

Continue reading

Nonlinearity and span of transducers

When the developer selects a transducer for their projects, they have to look through various parameters and then select the part that best fits the design needs. This time let’s look at some transducer characteristics that can be found in specifications. Transducer Range First of all, let’s clear out what is a range of a transducer. The range is understood as maximum and minimum input and output signal. For instance, we can take a simple thermal sensor which input range can be from -50 to 120ºC and output range of 0 to 5V. The range can be understood as measured signal range and working environment parameters like working temperature range, power supply voltage range, etc. Full-scale deflection – Span Span is the maximum variation in the input or output. Span can variate due to an error that is mostly linear and can be adjusted. Span error is measured in percents, which shows how much the output value is different from the correct value. Another linear error close to span error is zero offset. This error occurs because of calibration errors or other changes like aging or environmental conditions change. Zero offset error is a constant overall range. It can be…

Continue reading

X-10 interface for home automation projects

Simply speaking X10 protocol allows transmitting data over power lines. X10 uses a PLC(Power Line Carrier) technology. How does this work? The specification says that each time a 60Hz AC signal crosses the zero line,, a 120kHz burst is is transmitted with a duration of 1ms. One crossing burst forms one information bit. Simply speaking if we needs to form “1” you need to burst at the first crossing but not at second and for “0” is reversed pattern – you need to burst at the second cross but none on first.

Continue reading

DIY 4x22W car audio amplifier based on TDA7384

I decided to make a pretty simple but powerful enough audio amplifier. For this, I’ve chosen quad-bridge car audio amplifier IC – TDA7384, which has four input and four output channels with a power capability of 4x35W. If connected to a car battery where the operating voltage is about 13.2V, then each channel can give 22W what is more than enough for me. This amplifier I probably will use to test audio processor TDA7313, which is still in the development phase. I didn’t find much information about this chip on the internet, so I decided to build it and try it independently.

Continue reading

Programming microcontrollers AduC70xx using boot-loader and ARMWSD utility

Firmware for AduC70xx ARM microcontrollers can be uploaded using a built-in boot-loader. To work with boot-loader, Analog Devices offer a small free program, ARMWSD working under the windows system. The program doesn’t require installation. ARMED communicates with AduC70xx via COM-port. Simple programming steps looks like this: Connect target board to PC COM port; Go to Configure->Parts and select AduC part: Then go to Configure->Comms and select serial port and baud rate:

Continue reading