Power sources for AVR

Power sources for AVR are very important part in projects. Avery circuit has to be powered from some source like battery or from AC adapter 110V/220V. Using batteries is 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 battery you should consider many factors: Capacity – this is very important parameter measured in mA/h. This parameter defines how long your microcontroller project will be working before recharging or replacing batteries. Rule is simple – as bigger battery capacity as longer your circuit will be working, but in other hand your project may become more expensive or even heavier because of bigger batteries. Second parameter is battery Voltage. If Voltage of battery is to small for tou circuit, youll have to connect several batteries in series. Other is Expirity date. You don’t want your battery energy leakage or become obsolete because of this. Working temperature. If your project will be working in more extreme temperatures – heat or cold, then you should consider this. And the last parameter would be chape, size and weight. If your project…

Continue reading

Atmega EEPROM memory writing

All atmega family microcontrollers have internal EEPROM memory. They can have from 512bytes to 4kBytes. EEPROM memory has its own memory space and is linearly organized. In order to access EEPROM mempry in atmega there are three registers used: Address register, Data register and Control register. Address register EEAR (EEPROM Address Register) is made of 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 interrupt after write cycle is finished. If bit is set to ‘1’ and also I bit SREG, then EEPROM Ready interrupt is enabled. If bit is set to ‘0’ – then interrupt is disabled. EEMWE – EEPROM Master Write Enable. The EEMWE bit determines whether setting EEWE to one cause 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 EEMWE…

Continue reading

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 why compiled code for AVR is very effective than in other microcontrollers. In this case you get better performance and smaller code size. There are 32 registers in AVR. And they all directly work with processing unit. This also decreases code size and increases program performance. In other microcontrollers there…

Continue reading

Recognizing skin cancer symptoms using model based imaging

When quality skin model is constructed – recognizing skin cancer symptoms can be more comfortable as many factors are indicating about 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 behavior around the lesion and inside it. Firs important factor is melanin presence in the 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 significant probability of being skin cancer symptoms, but not always. There are 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 thinner this layer, the more significant risk.

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 PLL PLLCON = PLLCON_PLLE | PLLCON_PLLC; PLLFEED = 0xAA; // Make it happen. These two updates PLLFEED = 0x55; // MUST occur in sequence. // setup & enable the MAM MAMTIM = MAMTIM_CYCLES; MAMCR = MAMCR_FULL; // set the peripheral bus speed // value computed from config.h VPBDIV = VPBDIV_VALUE;…

Continue reading