Turn-key PCB assembly services in prototype quantities or low-volume to mid-volume production runs
Turn-key PCB assembly services in prototype quantities or low-volume to mid-volume production runs

RTC example on ARM7 LPC2148 using WinARM

Finally got my LPC2148 RTC working on my development board. arm7 base development board for lpc2148 I am quite new to ARM microcontrollers, so I managed to make a few tests using them by driving some peripherals and writing some test routines. The first code I tried was a simple LED blink program first lpc2148 arm7 microcontroller test led blink This one is running microcontrollers’ real-time clock (RTC) and generating interrupts every second. When Interrupt occurs, the microcontroller sends a particular message to UART that I could see via the Terminal program. The main program: And zipped project files:RTC clock example on ERM7 LPC2148 using WinARM

Continue reading

Increase microcontroller code efficiency

C compilers are getting more advanced, but there is always a trade-off between speed and code size. Compiled code can be faster or smaller, but not both. So you have to choose which part is more important speed or code size. The Increase in microcontroller code efficiency can be done in many ways. Don’t trust compiler optimization features, as they might not be as effective as you expect. It is better to grab some profiler and inspect what parts of your code take the most time and size. It is better to follow some techniques that may reduce code execution time and increase microcontroller code efficiency:

Continue reading

Interfacing LCD to Atmega using two wires

This is not a new idea of interfacing LCD using two wires, but it can help in many situations when there are not enough microcontroller pins. This example is based on the Hitachi 44780 Alphanumerical LCD. This circuit I provide represents an idea, but I think it should also work if soldered. We know that to make LCD working, you need at least 6 (in 4-bit mode) wires to control. But what if you need as many pins as possible from your avr and still want to see results on LCD. Then you need to use a serial LCD or make one. In this example, you need to convert serial data coming to LCD using a shift register. I suggest using the 74HC164. You need only two wires to push data to shift register and then give them to LCD using the “E” strobe signal. How serial LCD operates? Atmega’s PC1 pin clocks shift register, and PC0 is the data line. Before you write to the shift register, clean it by sending “0” in eight clock cycles. You can erase the register with an additional wire controlling register reset, but there would be 3 lines used. After the register is…

Continue reading

Power sources for AVR

Power sources for AVR microcontrollers are a crucial part. Every circuit has to be powered from some source like a battery or AC adapter 110V/220V. Using batteries is a more convenient way to power the microcontroller projects as the circuits are simpler and constructed devices become portable. There are many types of batteries in shapes and sizes or capacities. So when choosing a battery you should consider many factors: Capacity is a critical parameter measured in mA/h. This parameter defines how long your microcontroller project will be working before recharging or replacing batteries. The rule is simple – as bigger battery capacity, as long your circuit will be working. Still, on the other hand, your project may become more expensive or even heavier because of bigger batteries. The second parameter is the battery Voltage. If the battery’s voltage is too small for your circuit, you’ll have to connect several batteries in series. Another is the Expiry date. You don’t want your battery energy leakage or become obsolete because of this. Working temperature. If your project is working in more extreme temperatures – heat or cold, you should consider this. And the last parameter would be chape, size, and weight. If…

Continue reading

Atmega EEPROM memory writing

All mega family microcontrollers have internal EEPROM memory. They can have from 512bytes to 4kBytes. EEPROM memory has its own physical space and is linearly organized. ITo access EEPROM memory in mega, there are three registers used: Address register, Data register, and Control register. Address register EEAR (EEPROM Address Register) comprises two 8 bit registers, EEARH:EEARL. In this register, the EEPROM cell address has to be loaded. Data register EEDR (EEPROM Data Register). When writing to EEPROM, the data is loaded to this register. When getting data from EEPROM – you read data from this register. Control register EECR (EEPROM Control Register) is used to control access to EEPROM memory. EERIE – EEPROM Ready Interrupt Enable. This bit generates an interrupt after the write cycle is finished. If the bit is set to ‘1’ and “I” bit in SREG, then EEPROM Ready interrupt is enabled. If the bit is set to ‘0’ – then the interrupt is disabled. EEMWE – EEPROM Master Write Enable. The EEMWE bit determines whether setting EEWE to one causes the EEPROM to be written. When EEMWE is set, setting EEWE within four clock cycles will write data to the EEPROM at the selected address. If…

Continue reading

Consider PWM signal

When using a microcontroller and want to drive motor control or controlled intensity, you can use DAC to generate an analog output voltage. But there is an easier way of doing this. You can use a digital output to reach the same results. This technique is known as PWM -Pulse Width Modulation. In this picture, you can see a 50% duty cycle square waveform. The width of ‘0’ is equal to the ‘1’ level. This means if the signal amplitude is 5V, then the average voltage over one cycle is 2.5V. It is as though of hawing constant 2.5V voltage.

Continue reading

Simplest 128 atmega programmer

Atmega 128 is like other AVR microcontrollers. They are ISP – is in-system programmable. Earlier I wrote an article about an AVR ISP programmer where 74HC244 buffer is used. Using buffer is safer for your AVR. But what if you need 128 atmega programmers without any parts? Then you can connect your microcontroller directly to the LPT port or use protection resistors (220R) just in case. of course circuit works without resistors, but you put your LPT port at risk. Just connect GND, SCK, MISO, MOSI, and RESET to adequate LPT pins, and you can program atmega’s flash memory without removing it from a socket. Programming software can be PonyProg

Continue reading

Recognizing skin cancer symptoms using model based imaging

When a quality skin model is constructed – recognizing skin cancer symptoms can be more comfortable as many factors indicate the threat of skin cancer. Of course, this can’t give 100% results, as there are many shortcomings connected with skin lesion variety and interpretation errors. But some guides may help. Three main factors can indicate the risk of skin cancer. Recognizing skin cancer symptoms can be based on them. They are: Melanin presence in the papillary dermis; The thickness of papillary dermis; Blood behaviour around the lesion and inside it. The first important factor is the melanin present in the dermis. This is the main factor in recognizing skin cancer symptoms. If melanin spread in the papillary dermis or even dermis, this is a significant probability of being skin cancer symptoms, but not always. Several subfactors in this issue, like melanin spreading figure, depth, and melanin density within this shape. If there are more irregularities in the spreading area, there are more risks. Another factor in recognizing skin cancer symptoms is papillary layer thickness. In not going into deep too much there can be said, that the thinner this layer, the more significant risk.

Continue reading

First LPC2148 ARM7 microcontroller test – led blink

home made LPC2148 development board

This is simply a led blinking routine using my development board. The compiler I used was WINARM. I like this compiler because it’s free, and adaptation is easy while the same functionality is in WINAVR. This simple test blinks pin 16 of port 0. This I used when I first got to know ARM microcontroller. Here is the main code: All project files and compiled hex file is in LPC2148.zip.

Continue reading

TWI (I2C) interface on AVR

Two-wire serial interfaces are included in the following AVR microcontroller families: ATmega8x, ATmega16x, ATmega163x, ATmega32x, ATmega323x, ATmega64x, and ATmega128x. TWI interface is a “Philips” standard I2C. Using the TWI interface, you can connect up to 128 devices using only two wires: clock (SCL) and data (SDA). Only two pull-up resistors on each line are needed for this interface to work properly. The I2C interface circuit is an open collector. This means if one of all devices has a low-level signal on a line, then it is ‘0’, and if all devices have a high impedance state, then the signal is considered to be great ‘1’—more details about TWI interface you can find on any ATmega datasheet. One of my examples Interfacing AD7416 digital temperature sensor you can find here: Analog Devices Digital temperature sensor AD7416

Continue reading