Consider PWM signal

When using microcontroller and want to drive motor control or control led intensity you can use DAC to generate analog output voltage. But there is an easier way of doing this. You can use digital output to reach same results. This technique is known as PWM -Pulse Width Modulation. In this picture you can see 50% duty cycle square wave form. The width of ‘0’ is equal to ‘1’ level, this means if signal amplitude is 5V, then 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 AVR ISP programmer where 74HC244 buffer is used. Using buffer is safer for your AVR. But what if you need 128 atmega programmer without any parts, then you can connect your microcontroller directly to 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 socket. Programming software can be PonyProg

Continue reading

Integrated Processor RISC AVR rules!

AVR family is quite new in integrated processor RISC family. These microcontrollers can solve many embedded problems. They differ from other integrated processor RISC families by high speed performance, and by big deficiency. Because of this AVR RISC processors can be used instead some other 16 bit processors. In other hand AVR processors are easy to program. Let’s see why AVR from Atmel are becoming so popular: Very fast Harvard architecture. Most instructions are held in one clock cycle. AVR can be clocked in up to 16MHz so this means about 16MIPS; Not a specific feature, but AVR have internal Flash which can be reprogrammed about 1000 times without failing. According to this processors can be programmed directly in circuit without removing them off. This speeds up development of embedded applications. Integrated Processor RISC AVR command system from beginning was developed to be effectively compiled using C language. This is…

Continue reading

Recognizing skin cancer symptoms using model based imaging

When quality skin model is constructed – recognizing skin cancer symptoms can be easier as there are many factors indicating about 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. There are 3 main factors that can indicate risk of skin cancer. Recognizing skin cancer symptoms can be based on them. They are: Melanin presence in papillary dermis; Thickness of papillary dermis; Blood behavior around the lesion and inside it. Firs of all Melanin presence in dermis. This is the main factor in recognizing skin cancer symptoms. If there is melanin spread in papillary dermis or even dermis, this is a big probability of being skin cancer symptoms, but not always. There are several sub factors in this issue like melanin spreading figure, depth, and melanin density within this shape.…

Continue reading

First LPC2148 ARM7 microcontroller test – led blink

This is simple led blinking routine using my development board. The compiler I used was WINARM. I like this compiler because its free and adaptation is easy while the same functionality is in WINAVR. This simple test just blinks pin 16 of port 0. This I used when I first got to know ARM microcontroller. Here is the main code: /************************************************* * WinARM Demo P0.16 blink **************************************************/ #include “types.h” #include “LPC214x.h” #include “config.h” #include “armVIC.h” #define IOPINS016 16 static void lowInit(void) { // set PLL multiplier & divisor. // values computed from config PLLCFG = PLLCFG_MSEL | PLLCFG_PSEL; // enable PLL PLLCON = PLLCON_PLLE; PLLFEED = 0xAA; // Make it happen. These two updates PLLFEED = 0x55; // MUST occur in sequence. // setup the parallel port pin IO0CLR = (1< IO0SET &= ~(1< IO0DIR =(1< // wait for PLL lock while (!(PLLSTAT & PLLSTAT_LOCK)) continue; // enable & connect…

Continue reading

TWI (I2C) interface on AVR

Two wire serial interfaces are included in following AVR microcontroller families: ATmega8x, ATmega16x, ATmega163x, ATmega32x, ATmega323x, ATmega64x, and ATmega128x. TWI interface is a “Philips” standard I2C. Using 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 this interface to work properly. I2C interface circuit is open collector. This means if one of all devices has low level signal on a line, then it is ‘0’, and if all devices have high impedance state, then signal is considered to be high ‘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

Using buttons and switches with AVR microcontrollers

In most designs you might want to put buttons and switches to control your program flow. This is not very difficult to read button state. You can connect button between pin and ground with internal pull up enabled. Then when button is pressed, then pin value will be 0 when released – 1. Of course you can use external pull-up resistor. In fact all mechanical contacts have their shortcomings – they generate multiple micro connections that can confuse AVR. Delay of this effect depends on quality of buttons or switches and can vary from 10 to 100ms.

Continue reading