PERSISTENCE OF VISION DISPLAY
USING ATMEGA16 ADRUINO KIT
THIS SIMPLE POV DISPLAY USING APPROXIMATE CALCULATIONS.
WE DETERMINE THE DELAYS FOR PRODUCING THE TIME INTERVALS OF GLOW OF LED"S . GENERALLY 8 LEDS ARE USED FOR THE POV DISPLAY PURPOSE BUT IN CASE OF ATMEGA16 TWO PORTS CAN BE USED GIVING 16 LED ROWS AND BIGGER DISPLAY.
BECAUSE THE MECHANICAL DESIGN FOR USING A MOTOR WITH 1000 RPM WAS QUIET NASTY . ALSO I JUST WANTED TO SEE JUST THE IMPLEMENTATION SO I USED THE CEILING FAN . FAN HAS RPM AROUND 300 TO 350 . WHICH IS QUIET WELL TO SEE THE IMPLEMENTATION OF POV.
NEXT CODING THE MCU
//THIS PROGRAM IS FOR 8051
// in this code i did not used lookup tables for reducing the complexity
// i just gave code logic for one
letter'A' and sapace ' '
#include<reg51.h>
//#include<avr/io.h> for"ATmega16"
//#include<util/delay.h> for generating delay for"atmega16"
#define led P0 //port0 will be connected to leds
//#define led PORTB // DDRB=0xff;declaring portB as out put
unsigned int del=50//variable to control
void delay(void)
{
unsigned int i,j;
for(i=0;i<del;i++)
for(j=0;j<1275;j++);
}
/*the delay function is ther as default in util package of winavr so use: _delay_us( );
void delay(void)
{
_delay_us(del);
_delay_us(del);
_delay_us(del);
_delay_us(del);
}
remaining logic will be same for all microcontroller units*/
void display(unsigned char car);
void main()
{
while(1)
{
display('A'); // this displays a continious rotating"A A A A"
display(' ');
//try to change the del value as per your motor until you get a perfect
//display once you got it then write your code for remaining letters
//once you did this it will be very easy you can do your own fonts
//like "smily" ,"heart" etc
//but the main logic is to achieve perfect "delay".once if you refer to the
//delay calculations you will get it
//direction of rotation is also one important thing(clock wise or anti clock)
// this "A" is simetrical so works on both directions.
}
}
void display(car)
{
switch(car)
case 'A' : // letter A
{
led=0x81; delay( );
led=0x6f; delay( );
led=0x6f; delay( );
led=0x6f; delay( );
led=0x81; delay( );
led=0xff; delay( );// to make one column gap between letters
}
break;
case ' ' : // space
{
led=0xff; delay( );
led=0xff; delay( );
led=0xff; delay( );
led=0xff; delay( );
led=0xff; delay( );
led=0xff; delay( );
led=0xff; delay( );// to make one column gap between letters
} break;
default:
led=0xfe;
}
// END of program



No comments:
Post a Comment