Main Menu
Home
AVR News
Atmel AVR
AVR Development Tools
Valuable Tools
WinAVR toolset
Makefile for WinAVR
AVR Virtual Simulators
Hardware for prototyping
GCC and AVR-GCC
Short introduction to C
AVR-GCC Tutorial
Example AVR Projects
AVR-GCC articles
WinAVR Site Map
Scienceprog FORUM
ScienceProg BLOG
Disclaimer
WinARM Tutorial
Login Form





Lost Password?
No account yet? Register
Latest comments
Programming AVR ADC module...
hi please send me example usart with...
More...

Measuring motor speed and...
main.c: In function...
More...

Running TX433 and RX433 RF...
(Hopefully this is not a re-post). I am...
More...

Running TX433 and RX433 RF...
I just bnought a pair of the RX/TX 433...
More...

Accessing AVR microcontroller...
You need to read PORTD 5th bit and...
More...

Syndicate
Friendly sites

Recommended sites

Tourist help and villas of Torrevieja Spain, view now
Oak furniture limed
Latest News
Measuring motor speed and display result on LCD
Written by Administrator   
Friday, 06 April 2007

For measuring motos speed there can Optical interrupter used like H21A1. This is a device where IR LED and photo-transistor is coupled in to plastic housing. The gap between then allows interrupting signal with opaque material and this way switching the output from ON to OFF.

Image

This device can be connected to Microcontrollers ICP pin and this way measuring PWM disk (with hole in it) speed can be measured. Disk has to me fixed to axis of motor. Each time the hole of disk passes the gap, optical interrupter will form a pulse which goes to ICP pin to trigger the timer. If take measuring interval 1s, then counted pulses will be equal to turns in Hz.

Lets take Atmega8 microcontroller which is clocked at 8MHz. For this lets use timer pre-scaler 8, then timer will run at frequency equal 1MHz(period 1μs ). Each time the pulse reaches ICP(Atmega8 – PB0 pin) pin then on falling front of pulse input capture interrupt occur. Interrupt service routine counts the number of timer pulses between two pulses. Number of timer counts define the disk speed (RPM - revolutions per minute).


User comments (1) Read more...
Simplified AVR LCD routines
Written by Administrator   
Friday, 30 March 2007

Controlling numeric LCD isn't so tricky as it may look like. O course you can find numbers of LCD libraries. One of more universal you can find in AVRLIB library for WinAVR AVR GCC compiler. Main disadvantage of such universal libraries that they compile all functions even if you don't want them. This way huge libraries occupy more program memory than you would like to. One way is to write simple routines specified only to your design.

My simple LCD library include only 8 bit mode. Each pin, connected to LCD, can be configured separately. For instance:


Be first to comment this article Read more...
AVR LCD menu routine
Written by Administrator   
Monday, 26 March 2007
Last Updated ( Monday, 26 March 2007 )

Lets have some practice and write simple AVR LCD menu routine. For this we need to write LCD control library. I decided not to use one from AVRLIB. LCD controlling isn't difficult just a few lines of code unless you want to make it more universal.

I want to demonstrate how LCD menu control may look. Of course this isn't the best practice as it uses pretty simple logic, but may do the job.

To make it interesting I am going to have 4 buttons: 2 for menu scrolling up and down and two for changing submenu parameters. As output I am going to use three LED diodes that will light according to parameters selected in menu. Button states are going to be read using timer0 overflow interrupts. Code is written for WinAVR compiler.


User comments (2) Read more...
Avr-gcc versions comparison
Written by Administrator   
Friday, 16 March 2007
Last Updated ( Friday, 16 March 2007 )

AVR-GCC versions comparison By Dmitry K. 
Flash and Stack values are in bytes. 
Time units are in CPU clocks. 
All values were simulated by simulavr. 
Times and sizes are presented without initialization of function args.
Results 
 
 
 

 
AVR:                             at90s8515                 atmega8      
avr-gcc version: 3.3.6 3.4.6 4.0.4 4.1.2 3.3.6 3.4.6 4.0.4 4.1.2
--------------------------------------------------------------------------
dtostre(1.2345,s,6,0)
Flash: 1024 1024 1120 1212 954 954 1038 1112
Stack: 15 15 15 17 15 15 15 17
Time: 1199 1199 1289 1315 1060 1060 1123 1155

Be first to comment this article Read more...
<< Start < Prev 1 2 3 4 5 6 7 8 9 10 Next > End >>

Results 21 - 25 of 69

© 2008 WinAVR AVR-GCC Tutorial
Joomla! is Free Software released under the GNU/GPL License.