There are some people who don’t have the ability to speak or they lose it in an accident. They find it difficult to express their thoughts or to convey their message to other people.
Hardware Specification
Sr. No.
|
type of Component
|
specification
|
1.
|
Glove
|
Hand Glove
|
2.
|
Microcontroller
|
AVR Atmega 16
|
3.
|
Flex Sensors
|
Spectra Symbol 4.5″
|
4.
|
LCD
|
JHD162A
|
5.
|
Audio Synthesizer
|
TTS & SpeakJet
|
6.
|
Audio Amplifier
|
LM 386
|
7.
|
Speaker
|
Deeksha 8 ?
|
Sr. No.
|
Parameter
|
specification
|
1.
|
Component Make
|
Spectra Symbol
|
2.
|
Flat Resistance
|
10K?
|
3.
|
Bend Resistance
|
60K? to 110K?
|
4.
|
Resistance Tolerance
|
± 30%
|
5.
|
Power
|
0.5W continuous/ 1W peak
|
6.
|
Dimension Length
|
4.5″
|
Sr. No.
|
Parameter
|
specification
|
1.
|
Component Make
|
Atmel Corporation
|
2.
|
Bit Instruction
|
8 bits
|
3.
|
Process Speed
|
16 MIPS at 16 MHz
|
4.
|
ISP Flash Memory
|
16 Kb
|
5.
|
EEPROM
|
512 bytes
|
6.
|
Internal SRAM
|
1 Kb
|
7.
|
Inbuilt ADC
|
8-channel 10-bit
|
8.
|
Communication
|
Serial USART
|
9.
|
Operating Voltage
|
2.7V – 5.5V
|
10.
|
Power Consumption at 1MHz, 3V
|
Active : 1.1 mA, Idle : 0.35 mA
|
11.
|
Package
|
40-pin PDIP
|
Sr. No.
|
Parameter
|
specification
|
1.
|
Baud Rate Supported
|
9600
|
2.
|
Operating Voltage
|
3V – 5.25V
|
3.
|
Package
|
28-pin PDIP
|
Sr. No.
|
Parameter
|
specification
|
1.
|
Component Make
|
Magnevation
|
2.
|
Synthesizer
|
5-channel programmable
|
3.
|
Internal Input Buffer
|
64 byte
|
4.
|
Operating Voltage
|
2V – 5.5V
|
5.
|
Supply Current
|
Idle/Speaking < 25 mA
|
6.
|
Package
|
18-pin PDIP
|
Sr. No.
|
Parameter
|
specification
|
1.
|
Display Construction
|
16 x 2
|
2.
|
Display Type
|
Positive Transflective
|
3.
|
Backlight
|
LED (5V)
|
4.
|
Data Line
|
8-bit parallel
|
5.
|
Operating Voltage
|
-0.3V – 7V
|
6.
|
Supply Current
|
0.2 mA
|
7.
|
Package
|
Chip On Board
|
Sr. No.
|
Parameter
|
specification
|
1.
|
Component Make
|
National Semiconductor
|
2.
|
Operating Voltage
|
4V – 12V or 5V – 18V
|
3.
|
Current Drain
|
4 mA
|
4.
|
Voltage Gain
|
20 – 200
|
5.
|
Power Consumption at 6V
|
24 mW
|
6.
|
Package
|
8-pin MSOP
|
Project Description
Circuit Diagram
You may also like:
Project Source Code
Project Source Code
###
#define F_CPU 16000000UL
#define USART_BAUDRATE 9600
#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1)
#include
#include
#include
//LCD
#define dataport PORTC //LCD dataport
#define commport PORTA //LCD command port
#define rs PINA5 //LCD contol ports
#define wr PINA6
#define en PINA7
//LED
#define mdlrn PINB0 //learn mode
#define mdwrk PINB1 //work mode
#define busy PINB2 //busy mode
#define spkbusy PINB3 //speak busy mode
//buttons
#define mslrn PIND4 //learn
#define mswrk PIND5 //work
#define strt PIND6 //start scanning
#define nxt PIND2 //next letter
int i,z=0;
unsigned char alphabet[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M',
'N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
unsigned char alphabets[26][10]={"aay/","bee/","see/","dee/","ee/","eff/","jee/",
"ech/","i/","jay/","kay/","ell/","emm/","enn/","oo/","pee/","kyu/","aar/","ess/",
"tee/","you/","we/","double u/","axe/","why/","zed/"};
unsigned char gestures[7][6]={"ok/","you/","food/","I/","go/","bye/","water/"};
int letter=0;
int l,flagcmd=0;
int j,f;
unsigned int Ain,Aout,f1,f2,e1,e2;
char compwrd[10];
int pos[6][3];
int sumpos[5];
int avgpos[5];
int avgdisp[5];
int avgpostest[5];
int mode;
int test[5];
int addr,datwr;
int c,d,e;
int numlcd[10]={48,49,50,51,52,53,54,55,56,57};
char rx[10],dwrd[7]={""};
int LCDinitialize(void);
int LCDdisplay(unsigned char disp[]);
int LCDcommand(char);
int wrdata(void);
int wrcomm(void);
int numberdisplay(int);
int led_initial(void);
int buttons(void);
int strt_chck();
int EEPROM_read(int );
int searchletter();
int main(void)
{
DDRA = 0xE0; //PORTA dirctn
DDRB = 0xBF; //PORTB dirctn
DDRC = 0xFF; //PORTC dirctn
DDRD = 0x02; //PORTD dirctn
LCDinitialize();
LCDcommand(0x01);
_delay_ms(5);
/*
LCDdisplay(" Initialising /");
LCDcommand(0xC0);
LCDdisplay(" System /");
_delay_ms(600);
*/
//Buttons raised to high
PORTD |= 1 << PIND4;
PORTD |= 1 << PIND5;
PORTD |= 1 << PIND6;
PORTD |= 1 << PIND2;
PORTB |= 0b00001111; //All LED off initially
//for sensor display only
/*
ADCinitialize();
while(1)
{
ADCscan();
}
*/
/* LCDcommand(0xC0);
LCDdisplay(" LED Status /");
_delay_ms(10);
*/
led_initial(); //Initialize LED Blinking
PORTB &= ~(1<
SREG=0x80; //global interrupt enable
MCUCR=0x00; //low level on pin
GICR |= 1<
usart_init(); //Initialize TXN & RXN
usart_putch(0x0D); // send data back to the PC (HyperTerminal)
_delay_ms(1000);
ADCinitialize();
// for rxn data from TTS256
/* for(i=0;i<5;i++)
{
while ((UCSRA & (1 << RXC)) == 0);
rx[i]=UDR;
LCDinitialize();
LCDdisplay(rx);
}
*/
LCDinitialize();
LCDdisplay("Sign Language/");
LCDcommand(0xC0);
LCDdisplay("Glove/");
_delay_ms(800);
speaker(" Sygn/");
speaker(" language/");
speaker(" glove/");
_delay_ms(100);
while(1)
{
buttons();
}
return 0;
}
int buttons(void)
{
LCDcommand(0x80);
LCDcommand(0x01);
LCDdisplay("Select Mode:/");
speaker("Select/");
speaker("moade/");
_delay_ms(800);
LCDcommand(0xC0);
LCDdisplay("1.Learn 2.Work/");
speaker(" one/");
speaker(" Larrn/");
speaker("moade/");
speaker("two/");
speaker("Work/");
speaker("moade/");
_delay_ms(100);
while(1)
{
PORTD ^= 1 << PIND4;
PORTD ^= 1 << PIND5;
PORTD ^= 1 << PIND6;
if(bit_is_clear(PIND, 4))
{
if(bit_is_clear(PIND, 5))
{
while(1)
{
flash();
}
}
PORTB &= ~(1<
mode=0;
if(flagcmd==1)
{
lrn();
}
else
{
learn();
}
buttons();
PORTB |= (1<
}
else if(bit_is_clear(PIND, 5))
{
PORTB &= ~(1<
mode=1;
work();
buttons();
PORTB |= (1<
}
else if(bit_is_clear(PIND, 6))
{
command();
}
}
return 0;
}
int learn(void)
{
int dateeprom;
mode=0;
LCDcommand(0x80);
LCDcommand(0x01);
LCDdisplay("Learn Mode/");
speaker("Larrn/");
speaker("moade/");
_delay_ms(600);
LCDcommand(0x80);
LCDcommand(0x01);
LCDdisplay("Select Alphabet/");
speaker("Select/");
speaker("Alphabet/");
_delay_ms(100);
e=0;
for(i=0; i<26; i++)
{
LCDcommand(0x80);
LCDcommand(0x01); //first line
LCDdisplay("Do Gesture for/");
LCDcommand(0xC0);
dataport = alphabet[letter];
wrdata();
speaker("Doo/");
speaker("gesture/");
speaker("for/");
speaker(alphabets[letter]);
letter++;
ADCinitialize();
/* LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("Scan Started/");
_delay_ms(10);
*/
ADCscan();
/* LCDinitialize();
LCDdisplay("division/");
LCDcommand(0xC0);
for(i=0;i<3;i++)
{
numberdisplay(avgpos[i]);
LCDcommand(0x14);
}
_delay_ms(10);
LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("Scanning Done/");
_delay_ms(10);
*/
LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("Writing Memory/");
_delay_ms(600);
LCDcommand(0xC0);
for(z=0;z<3;z++)
{
numberdisplay(avgpos[z]);
LCDcommand(0x14);
}
_delay_ms(1000);
int t=0;
for(d=0;d<6;d=d+2)
{
datwr=avgpos[t];
t++;
addr=e+d;
if(datwr>=000 && datwr<256 )
{
e1=0;
e2=datwr;
}
else if(datwr>=256 && datwr<512 )
{
e1=1;
e2=datwr-256;
}
else if(datwr>=512 && datwr<768 )
{
e1=2;
e2=datwr-512;
}
else
{
e1=3;
e2=datwr-768;
}
EEPROM_write(addr,e1);
addr++;
EEPROM_write(addr,e2);
LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("EEPROM Check/");
_delay_ms(10);
f2=EEPROM_read(addr);
addr--;
f1=EEPROM_read(addr);
/* LCDcommand(0x01);
LCDcommand(0x80);
numberdisplay(f1);
LCDcommand(0x14);
numberdisplay(f2);
LCDcommand(0x01);
*/
if(f1 == 0)
{
f2=f2;
}
else if(f1== 1)
{
f2=f2+256;
}
else if(f1 == 2)
{
f2= f2+512;
}
else
{
f2=f2+768;
}
dateeprom=f2;
LCDcommand(0xC0);
numberdisplay(addr);
LCDcommand(0x14);
numberdisplay(dateeprom);
_delay_ms(50);
}
e=e+6;
LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("Writing Done/");
LCDcommand(0x01);
LCDcommand(0x80);
_delay_ms(500);
PORTD ^= 1 << PIND4;
if(bit_is_clear(PIND, 4))
{
LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("Continue Scan/");
_delay_ms(400);
continue;
}
else
{
return 0;
}
if(i== 25)
{
return 0;
}
}
return 0;
}
int lrn()
{
int dateeprom;
mode=0;
LCDcommand(0x80);
LCDcommand(0x01);
LCDdisplay("Learn command/");
speaker("Larrn/");
speaker("command/");
_delay_ms(600);
e=0;
for(i=0; i<6; i++)
{
LCDcommand(0x80);
LCDcommand(0x01); //first line
LCDdisplay("Do Gesture for/");
LCDcommand(0xC0);
for(f=0;f<6;f++)
{
dwrd[f]=gestures[i][f];
}
LCDdisplay(dwrd);
LCDdisplay(dwrd);
speaker("Doo/");
speaker("gesture/");
speaker("for/");
speaker(dwrd);
ADCinitialize();
/* LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("Scan Started/");
_delay_ms(10);
*/
ADCscan();
/* LCDinitialize();
LCDdisplay("division/");
LCDcommand(0xC0);
for(i=0;i<3;i++)
{
numberdisplay(avgpos[i]);
LCDcommand(0x14);
}
_delay_ms(10);
LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("Scanning Done/");
_delay_ms(10);
*/
LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("Writing Memory/");
_delay_ms(600);
LCDcommand(0xC0);
for(z=0;z<3;z++)
{
numberdisplay(avgpos[z]);
LCDcommand(0x14);
}
_delay_ms(1000);
int t=0;
e=300;
for(d=0;d<6;d=d+2)
{
datwr=avgpos[t];
t++;
addr=e+d;
if(datwr>=000 && datwr<256 )
{
e1=0;
e2=datwr;
}
else if(datwr>=256 && datwr<512 )
{
e1=1;
e2=datwr-256;
}
else if(datwr>=512 && datwr<768 )
{
e1=2;
e2=datwr-512;
}
else
{
e1=3;
e2=datwr-768;
}
EEPROM_write(addr,e1);
addr++;
EEPROM_write(addr,e2);
LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("EEPROM Check/");
_delay_ms(10);
f2=EEPROM_read(addr);
addr--;
f1=EEPROM_read(addr);
/* LCDcommand(0x01);
LCDcommand(0x80);
numberdisplay(f1);
LCDcommand(0x14);
numberdisplay(f2);
LCDcommand(0x01);
*/
if(f1 == 0)
{
f2=f2;
}
else if(f1== 1)
{
f2=f2+256;
}
else if(f1 == 2)
{
f2= f2+512;
}
else
{
f2=f2+768;
}
dateeprom=f2;
LCDcommand(0xC0);
numberdisplay(addr);
LCDcommand(0x14);
numberdisplay(dateeprom);
_delay_ms(50);
}
e=e+6;
LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("Writing Done/");
LCDcommand(0x01);
LCDcommand(0x80);
_delay_ms(500);
PORTD ^= 1 << PIND4;
if(bit_is_clear(PIND, 4))
{
LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("Continue Scan/");
_delay_ms(400);
continue;
}
else
{
return 0;
}
if(i== 6)
{
return 0;
}
}
return 0;
}
int work()
{
mode=1;
LCDcommand(0x80);
LCDcommand(0x01);
LCDdisplay("Work Mode/");
speaker("Work/");
speaker("mode/");
_delay_ms(600);
LCDcommand(0x80);
LCDcommand(0x01);
LCDdisplay("Press Start..../");
speaker("Start/");
speaker("Gesture/");
_delay_ms(600);
PORTD ^= 1 << PIND6;
if(bit_is_clear(PIND, 6))
{
strt_chck();
}
else
{
if(bit_is_clear(PIND, 5))
{
work();
}
else
{
LCDcommand(0x80);
LCDcommand(0x01);
LCDdisplay("Exiting Workmode/");
_delay_ms(400);
return 0;
}
}
return 0;
}
int strt_chck()
{
PORTD ^= 1 << strt; //Checking button status
if (bit_is_clear(PIND, 6)) //Check with button pressed
{
/*LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("Scan Started/");
_delay_ms(10);
*/
ADCinitialize();
ADCscan();
LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("Work-Scan Done/");
_delay_ms(600);
if (flagcmd==1)
{
srch();
}
else
{
searchletter();
compwrd[z]='/';
}
//give end of word to it
LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("Word is=");
LCDcommand(0xC0);
LCDdisplay(compwrd);
_delay_ms(1000);
if(!(bit_is_clear(PIND, 6)))
{
LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("Exit Scanning/");
_delay_ms(600);
LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("final Word is=");
LCDcommand(0xC0);
LCDdisplay(compwrd);
_delay_ms(1000);
speaker(compwrd);
word_end();
z=0; //for transmitting word to speakjet
while(bit_is_clear(PIND, 5));
work();
}
else
{
strt_chck();
}
}
else
{
strt_chck();
}
return 0;
}
int word_end()
{
PORTB &= ~(1<
while(!(UCSRA & (1<
UDR=0x0D; //command to speak at end
while(PORTA & (1<
PORTB |= (1<
return 0;
}
int command()
{
LCDinitialize();
LCDdisplay("command mode/");
_delay_ms(800);
flagcmd=1;
}
int ADCinitialize()
{
/* ADCSRA |= 1<< ADEN;
ADCSRA |= 1<< ADPS2;
ADMUX |= 1<< REFS0;
//ADCSRA |= 1<< ADIE;
*/
ADCSRA=0x87;
return 0;
}
int ADCscan()
{
int q;
PORTB |= (1<
LCDinitialize();
LCDdisplay("Scanning..../");
for(q=0;q<10;q++)
{
flash();
}
// for sensor display only
/*
while(1)
{
_delay_ms(50);
LCDinitialize();
for(i=0;i<3;i++)
{
ADMUX=0x40+i;
/* numberdisplay(ADMUX);
LCDcommand(0x01);
LCDcommand(0x80);
*/
/* _delay_ms(2);
ADCSRA |= 1<< ADSC; //start another conversion
while(ADIF == '0');
Ain= ADCL;
Aout = ADCH; //get the sample
/* numberdisplay(Ain);
LCDcommand(0xC0);
numberdisplay(Aout); //get the sample
_delay_ms(10);
LCDcommand(0x01);
LCDcommand(0x80);
*/
/*
if(Aout == 0)
{
Ain=Ain;
}
else if(Aout== 1)
{
Ain=Ain+256;
}
else if(Aout == 2)
{
Ain= Ain+512;
}
else
{
Ain=Ain+768;
}
LCDcommand(0x14);
numberdisplay(Ain);
}
}
*/
for (j=0; j < 6; j++)
{
LCDcommand(0x01);
LCDcommand(0x80);
for (i=0;i < 3;i++)
{
ADMUX=0x40+i;
/* numberdisplay(ADMUX);
LCDcommand(0x01);
LCDcommand(0x80);
*/ _delay_ms(2);
ADCSRA |= 1<< ADSC; //start another conversion
while(ADIF == '0');
Ain= ADCL;
Aout = ADCH; //get the sample
/* numberdisplay(Ain);
LCDcommand(0xC0);
numberdisplay(Aout); //get the sample
_delay_ms(10);
LCDcommand(0x01);
LCDcommand(0x80);
*/
if(Aout == 0)
{
Ain=Ain;
}
else if(Aout== 1)
{
Ain=Ain+256;
}
else if(Aout == 2)
{
Ain= Ain+512;
}
else
{
Ain=Ain+768;
}
pos[j][i]=Ain;
/*
numberdisplay(i);
numberdisplay(j);
LCDcommand(0xC0);
numberdisplay(Ain); //get the sample
_delay_ms(10);
LCDcommand(0x01);
LCDcommand(0x80);
*/
}
}
/* LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("pos=/");
LCDcommand(0x01);
LCDcommand(0x80);
for (j=0; j < 6; j++)
{
LCDinitialize();
LCDdisplay("row/");
numberdisplay(j);
LCDcommand(0xC0);
for (i=0;i < 3;i++)
{
numberdisplay(pos[j][i]);
LCDcommand(0x14);
}
_delay_ms(10);
}
*/
LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("Scan Done/");
_delay_ms(600);
PORTB &= ~(1<
for (i = 0; i < 3; i++)
{
sumpos[i] = 0;
}
/* LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("Creating Sumpos/");
_delay_ms(10);
LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay(sumpos);
_delay_ms(10);*/
for (i = 1; i < 6; i++)
{
sumpos[0] = sumpos[0] + pos[i][0];
sumpos[1] = sumpos[1] + pos[i][1];
sumpos[2] = sumpos[2] + pos[i][2];
}
/* LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("Sumpos Addition/");
_delay_ms(10);
/* LCDcommand(0x01);
LCDcommand(0x80);
for(i=0;i<3;i++)
{
numberdisplay(sumpos[i]);
LCDcommand(0x14);
}
_delay_ms(10);
*/
LCDcommand(0x01);
LCDcommand(0x80);
for (i = 0; i < 3; i++)
{
avgpos[i] =((sumpos[i])/5);
_delay_ms(10);
}
for (i = 0; i < 3; i++)
{
avgpostest[i] =((sumpos[i])/5);
_delay_ms(10);
}
return 0;
}
int searchletter()
{
unsigned int test;
int flag=0;
int count;
int alphano;
e=0;
LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("Searching /");
LCDcommand(0xC0);
LCDdisplay("Database /");
_delay_ms(500);
alphano=-1;
LCDinitialize();
LCDdisplay("Work data:/");
LCDcommand(0xC0);
for(i=0;i<3;i++)
{
numberdisplay(avgpostest[i]);
LCDcommand(0x14);
}
_delay_ms(1000);
LCDcommand(0x01);
for(c=0;c<7;c++)
{
alphano++;
count = 0;
int y=0;
if(flagcmd==1)
{
e=300;
}
else
{
e=0;
}
for(d=0;d<6;d=d+2)
{
addr=e+d;
f1=EEPROM_read(addr);
addr++;
f2=EEPROM_read(addr);
/* LCDcommand(0x01);
LCDcommand(0x80);
numberdisplay(f1);
LCDcommand(0x14);
numberdisplay(f2);
LCDcommand(0x01);
*/
if(f1 == 0)
{
f2=f2;
}
else if(f1== 1)
{
f2=f2+256;
}
else if(f1 == 2)
{
f2= f2+512;
}
else
{
f2=f2+768;
}
test=f2;
/*
LCDcommand(0x01);
LCDcommand(0x80);
numberdisplay(f2);
LCDcommand(0x01);
LCDcommand(0x01);
LCDcommand(0x80);
numberdisplay(avgpostest[y]);
LCDcommand(0x01);
*/
if((avgpostest[y] > (test-10)) && (avgpostest[y] < (test+10)) || (avgpostest[y] == (test)))
{
count=1;
flag=1;
}
else
{
count=0;
d=6;
}
y++;
}
if(count==1)
{
LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("Match Found/");
if(flagcmd==1)
{
LCDcommand(0xC0);
LCDdisplay("word is/");
LCDcommand(0x14);
for(f=0;f<6;f++)
{
compwrd[f]=gestures[alphano][f];
}
LCDdisplay(gestures[alphano]);
_delay_ms(600);
}
else
{
LCDcommand(0xC0);
LCDdisplay("Alphabet is/");
LCDcommand(0x14);
compwrd[z]=alphabet[alphano];
_delay_ms(10);
z++;
dataport=alphabet[alphano];
wrdata();
_delay_ms(600);
}
}
e=e+6;
}
if(flag==0)
{
LCDcommand(0x01);
LCDcommand(0x80);
LCDdisplay("Match not Found/");
_delay_ms(400);
}
return 0;
}
ISR(int0_vect)
{
letter++;
}
void usart_init()
{
UCSRB |= (1 << RXEN) | (1 << TXEN);
// Turn on the transmission and reception circuitry
UCSRC |= (1 << URSEL) | (1<
// Use 8-bit character sizes
UBRRH = (BAUD_PRESCALE >> 8); // Load upper 8-bits of the baud rate value..
// into the high byte of the UBRR register
UBRRL = BAUD_PRESCALE; // Load lower 8-bits of the baud rate value..
// into the low byte of the UBRR register
}
void speaker(unsigned char data[])
{
int i;
PORTB &= ~(1<
// LCDcommand(0x01);
// LCDcommand(0x80);
// LCDdisplay("speak busy/");
// _delay_ms(100);
// while(PINA.4 == '0');
for(i=0;i< sizes(data);i++)
{
usart_putch(data[i]);
}
usart_putch(0x0D); // send data back to the PC (HyperTerminal)
_delay_ms(1000);
// while(PORTA & (1<
PORTB |= (1<
}
int sizes(unsigned char disp[])
{
for(i=0;i<16;i++)
{
if(disp[i] == '/')
{
return (i-1);
}
}
}
void usart_putch(unsigned char send)
{
while ((UCSRA & (1 << UDRE)) == 0); // Do nothing until UDR is ready..
// for more data to be written to it
UDR = send; // Send the byte
}
unsigned int usart_getch()
{
while ((UCSRA & (1 << RXC)) == 0);
// Do nothing until data have been received and is ready to be read from UDR
return(UDR); // return the byte
}
void USART_Flush( void )
{
unsigned char dummy;
while ( UCSRA & (1<
}
int LCDinitialize()
{
dataport = 0x38; //initialize LCD 2 lines, 5x7 matrix
wrcomm(); //Right the command byte to command register
dataport = 0x01; //Clear LCD
wrcomm(); //Right the command byte to command register
dataport = 0x06; //Display on Cursor Blinking
wrcomm();
dataport = 0x0E; //Display on Cursor Blinking
wrcomm(); //Right the command byte to command register
dataport = 0x80; //Cursor at line 1, position 1
wrcomm(); //Right the command byte to command register
//dataport = 0x1C; //Shift Entire Display To Right
//wrcomm(); //Right the command byte to command register
return 1;
}
int LCDcommand(char cmd)
{
dataport= cmd;
wrcomm();
}
/*Sending Data To LCD Display*/
int LCDdisplay(unsigned char disp[])
{
int i,len;
len=size(disp);
for(i = 0; i < len; i++)
{
dataport = disp[i];
wrdata();
}
return 1;
}
/* size of array for display */
int size(unsigned char disp[])
{
for(i=0;i<16;i++)
{
if(disp[i] == '/')
{
return (i);
}
}
}
/*Righting the command byte to command register*/
int wrcomm(void)
{
commport &= ~(1 << rs); //Setting RS = 0, selecting command register
commport &= ~(1 << wr); //Setting RW = 0
commport |= (1 << en); //EN = 1
commport &= ~(1 << en); //EN = 0,high to low pulse on Enable pin
_delay_ms(5); //10ms delay
return 1;
}
/*Righting the Data byte to Data register*/
int wrdata(void)
{
commport |= (1 << rs); //Setting RS = 1, selecting data register
commport &= ~(1 << wr); //Setting RW = 0
commport |= (1 << en); //EN = 1
commport &= ~(1 << en); //EN = 0, high to low pulse on Enable pin
_delay_ms(5) ; //10ms delay
return 1;
}
int numberdisplay(int numb)
{
int dtc,dtcm,dtmm,dtm,dtn,dtl,dtv;
dtv=numb/1000;
dtcm=numb%1000;
dtc=dtcm/100;
dtmm=dtcm%100;
dtm=dtmm/10;
dtn=dtmm%10;
dataport=numlcd[dtv];
wrdata();
dataport=numlcd[dtc];
wrdata();
dataport=numlcd[dtm];
wrdata();
dataport=numlcd[dtn];
wrdata();
return 0;
}
void EEPROM_write(int add, int dat)
{
while(EECR & (1<
EEAR=add;
EEDR=dat;
EECR |= (1<
EECR |= (1<
}
int EEPROM_read(int add)
{
while(EECR & (1<
EEAR=add;
EECR |= (1<
return EEDR;
}
int led_initial() //Will be used to display led blink before Mode selection
{
//All LEDs ON
PORTB &= ~(1<
_delay_ms(500); // Delay
PORTB &= ~(1<
_delay_ms(500); // Delay
PORTB &= ~(1<
_delay_ms(500); // Delay
PORTB &= ~(1<
_delay_ms(500); // Delay
_delay_ms(500); // Delay
//All LEDs OFF
PORTB |= (1<
PORTB |= (1<
PORTB |= (1<
PORTB |= (1<
return 0;
}
int flash()
{
_delay_ms(50);
LCDinitialize();
for(i=0;i<3;i++)
{
ADMUX=0x40+i;
// numberdisplay(ADMUX);
// LCDcommand(0x01);
// LCDcommand(0x80);
_delay_ms(2);
ADCSRA |= 1<< ADSC; //start another conversion
while(ADIF == '0');
Ain= ADCL;
Aout = ADCH; //get the sample
/* numberdisplay(Ain);
LCDcommand(0xC0);
numberdisplay(Aout); //get the sample
_delay_ms(10);
LCDcommand(0x01);
LCDcommand(0x80);
*/
if(Aout == 0)
{
Ain=Ain;
}
else if(Aout== 1)
{
Ain=Ain+256;
}
else if(Aout == 2)
{
Ain= Ain+512;
}
else
{
Ain=Ain+768;
}
numberdisplay(Ain);
LCDcommand(0x14);
}
}
###
Circuit Diagrams
Filed Under: Electronic Projects
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.