有些人没有说话的能力,或者在事故中失去了说话的能力。他们发现表达自己的想法或向他人传达信息是困难的。
硬件规格
老不。
|
类型的组件
|
规范
|
1.
|
手套
|
手套
|
2.
|
单片机
|
AVR Atmega 16
|
3.
|
Flex传感器
|
光谱符号4.5“
|
4.
|
液晶
|
JHD162A
|
5.
|
音频合成器
|
TTS & SpeakJet
|
6.
|
音频放大器
|
LM 386
|
7.
|
发言者
|
Deeksha 8 ?
|
老不。
|
参数
|
规范
|
1.
|
组件使
|
光谱的象征
|
2.
|
耐抵抗力
|
10 k ?
|
3.
|
弯管阻力
|
60K?到110k?
|
4.
|
耐受性
|
±30%
|
5.
|
权力
|
0.5W连续/ 1W峰
|
6.
|
尺寸长度
|
4.5”
|
老不。
|
参数
|
规范
|
1.
|
组件使
|
Atmel公司
|
2.
|
一些指令
|
8位
|
3.
|
过程的速度
|
16 MHz的16 MIPS
|
4.
|
ISP闪存
|
16 Kb
|
5.
|
EEPROM.
|
512字节
|
6.
|
内部存储器
|
1 Kb
|
7.
|
内置ADC
|
8路10位
|
8.
|
沟通
|
串行USART
|
9.
|
工作电压
|
2.7 v - 5.5 v
|
10。
|
1MHz, 3V的功耗
|
活跃:1.1 ma,闲置:0.35 mA
|
11.
|
包
|
40-pin PDIP
|
老不。
|
参数
|
规范
|
1.
|
支持的波特率
|
9600
|
2.
|
工作电压
|
3V - 5.25V.
|
3.
|
包
|
28-pin PDIP
|
老不。
|
参数
|
规范
|
1.
|
组件使
|
Magnevation
|
2.
|
合成器
|
5通道可编程
|
3.
|
内部输入缓冲器
|
64个字节
|
4.
|
工作电压
|
2V - 5.5V.
|
5.
|
电源电流
|
空闲/说话< 25 mA
|
6.
|
包
|
18-pin PDIP
|
老不。
|
参数
|
规范
|
1.
|
显示建筑
|
16 x 2
|
2.
|
显示类型
|
积极的半透反射式的
|
3.
|
背光
|
领导(5 v)
|
4.
|
数据线
|
8位并行
|
5.
|
工作电压
|
-0.3v - 7v.
|
6.
|
电源电流
|
0.2马
|
7.
|
包
|
板上芯片
|
老不。
|
参数
|
规范
|
1.
|
组件使
|
美国国家半导体公司
|
2.
|
工作电压
|
4V - 12V或5V - 18V
|
3.
|
电流损耗
|
4马
|
4.
|
电压增益
|
20 – 200
|
5.
|
6V时的功耗
|
24兆瓦
|
6.
|
包
|
产品有MSOP
|
项目描述
线路图
项目源代码
项目源代码
###
#定义F_CPU 16000000 ul
#define usart_baudrate 9600.
#define baud_prescale((f_cpu /(usart_baudrate * 16ul))) - 1)
# include
# include
# include
// LCD.
#定义数据端口端口C//LCD数据端口
#define commport PORTA //LCD命令端口
#define rs PINA5 //LCD控制端口
#define wr pina6.
#定义en PINA7
/ /领导
#define mdlrn PINB0 //学习模式
#定义mdwrk PINB1//工作模式
#定义忙PINB2//busy模式
#define spkbusy PINB3 //说忙模式
/ /按钮
#define mslrn pind4 //学习
#define mswrk pind5 //工作
#define strt PIND6 //开始扫描
#define nxt PIND2 //下一个字母
int i, z = 0;
字母表unsigned char [26] = {A, B, C, D, E, F, G, H,“我”、“J”,“K”、“L”、“米”,
‘N’,‘O’,‘P’,‘问’,‘R’,‘S’,‘T’,‘你’,‘V’,‘W’,‘X’,' Y ', ' Z '};
无符号字符字母[26][10]= {" aay /”、“蜜蜂/”、“看/”,“迪/”,“ee /”,“eff /”,“jee /”,
“ech /”,“i /”,“jay /”,“kay /”,“ell /”,“emm /”,“enn /”,“oo /”,“oo /”,“pee /”,“kyu /”,“AAR /”,“ESS /”,
“TEE /”,“你/”,“我们/”,“双U /”,“AX /”,“为什么/”,“ZED /”};
unsigned char手势[7][6]= {" ok /”,“你”,“食物/”,“我/”,“/”,“再见”,“水/ "};
int字母= 0;
int l,flagcmd = 0;
int j,f;
无符号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模式;
智力测试[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(空白);
int LCDdisplay(unsigned char disp[]);
int LCDcommand (char);
int wrdata(空白);
int wrcomm(无效);
int numberdisplay (int);
int led_initial(无效);
int按钮(无效);
int strt_chck ();
int EEPROM_read (int);
int searchletter();
int主要(空白)
{
ddra = 0xe0;// porta dirctn.
DDRB=0xBF//直接端口
DDRC = 0 xff;/ / PORTC dirctn
DDRD = 0 x02;/ / PORTD dirctn
LCDinitialize ();
LCDCommand(0x01);
_delay_ms (5);
/ *
lcddisplay(“初始化/”);
LCDcommand (0 xc0);
LCDdisplay(“系统/”);
_delay_ms (600);
* /
//按钮上升到高
Portd |= 1 << pind4;
Portd |= 1 << pind5;
Portd |= 1 << pind6;
Portd |= 1 << pind2;
端口B |=0b00001111//所有人最初都领先
//仅用于传感器显示
/ *
ADCinitialize ();
而(1)
{
ADCSCAN();
}
* /
/ * LCDcommand (0 xc0);
lcd显示(“LED Status /”);
_delay_ms (10);
* /
led_initial ();/ /初始化LED闪烁
PORTB & = ~ (1 <
SREG = 0 x80;/ /全局中断使
MCUCR = 0 x00;//低电平的引脚
GICR |=1<
usart_init()//初始化TXN和RXN
UsArt_putch(0x0D);//将数据发送回PC(超级终端)
_延迟μms(1000);
ADCinitialize ();
//从TTS256的rxn数据
/ *(我= 0;< 5,我+ +)
{
而((UCSRA&(1<
rx[我]= UDR;
LCDinitialize ();
LCDdisplay (rx);
}
* /
LCDinitialize ();
LCDdisplay(“手语/”);
LCDcommand (0 xc0);
LCDdisplay(“手套/”);
_delay_ms (800);
演讲者(“Sygn /”);
发言人(“语言/”);
演讲者(“手套/”);
_delay_ms(100);
而(1)
{
纽扣();
}
返回0;
}
int按钮(void)
{
LCDcommand (0 x80);
LCDCommand(0x01);
LCDDisplay(“选择模式:/”);
扬声器(“选择/”);
发言人(“Moade /”);
_delay_ms (800);
LCDcommand (0 xc0);
lcddisplay(“1.Learn 2.Work/”);
演讲者(“/”);
演讲者(“Larrn /”);
发言人(“Moade /”);
发言人(“二/”;
演讲者(“工作/”);
发言人(“Moade /”);
_delay_ms(100);
而(1)
{
Portd ^= 1 << pind4;
Portd ^= 1 << pind5;
portd ^ = 1 << pind6;
if(bit_is_clear(pind,4))
{
如果(bit_is_clear (PIND 5))
{
而(1)
{
闪光();
}
}
PORTB & = ~ (1 <
模式= 0;
if(flagcmd == 1)
{
lrn();
}
其他的
{
学习();
}
纽扣();
PORTB | = (1 <
}
else if (bit_is_clear (PIND 5))
{
PORTB & = ~ (1 <
模式= 1;
工作();
纽扣();
PORTB | = (1 <
}
else if (bit_is_clear (PIND 6))
{
命令();
}
}
返回0;
}
int学习(空白)
{
int dateeprom;
模式= 0;
LCDcommand (0 x80);
LCDCommand(0x01);
LCDDisplay(“学习模式/”);
演讲者(“Larrn /”);
发言人(“Moade /”);
_delay_ms (600);
LCDcommand (0 x80);
LCDCommand(0x01);
LCDdisplay(“选择字母/”);
扬声器(“选择/”);
演讲者(“字母/”);
_delay_ms(100);
e = 0;
(我= 0;我< 26;我+ +)
{
LCDcommand (0 x80);
LCDCommand(0x01);//第一行
LCDdisplay(“/”做手势);
LCDcommand (0 xc0);
dataport =字母(信);
wrdata();
发言人(“Doo/”);
演讲者(“手势/”);
演讲者(“/”);
演讲者(字母(信));
字母++;
ADCinitialize ();
/ * LCDcommand (0 x01);
LCDcommand (0 x80);
LCDdisplay(“扫描开始/”);
_delay_ms (10);
* /
ADCSCAN();
/ * LCDinitialize ();
lcddisplay(“师/”);
LCDcommand (0 xc0);
(我= 0;< 3,我+ +)
{
数字显示(avgpos[i]);
LCDcommand (0 x14);
}
_delay_ms (10);
LCDCommand(0x01);
LCDcommand (0 x80);
lcddisplay(“扫描完成/”);
_delay_ms (10);
* /
LCDCommand(0x01);
LCDcommand (0 x80);
LCDdisplay(“写内存/”);
_delay_ms (600);
LCDcommand (0 xc0);
(z = 0; z < 3; z + +)
{
NumberDisplay(avgpos [z]);
LCDcommand (0 x14);
}
_延迟μms(1000);
int t = 0;
(d = 0; d < 6; d = d + 2)
{
datwr = avgpos [t];
T ++;
addr = e + d;
If (datwr>=000 && datwr<256), color0000ff;
{
e1 = 0;
e2 = datwr;
}
Else if(datwr>=256 && datwr<512)
{
e1 = 1;
e2=datwr-256;
}
否则如果(datwr>=512&&datwr<768)
{
e1 = 2;
e2 = datwr - 512;
}
其他的
{
e1 = 3;
e2 = datwr - 768;
}
EEPROM_write (addr, e1);
addr + +;
EEPROM_write (addr, e2);
LCDCommand(0x01);
LCDcommand (0 x80);
lcddisplay(“EEPROM检查/”);
_delay_ms (10);
f2 = EEPROM_read (addr);
addr,;
f1 = EEPROM_read (addr);
/ * LCDcommand (0 x01);
LCDcommand (0 x80);
数字显示(f1);
LCDcommand (0 x14);
数字显示(f2);
LCDCommand(0x01);
* /
if(f1 == 0)
{
f2 = f2;
}
否则if(f1 == 1)
{
F2 = F2 + 256;
}
Else if(f1 == 2) = 1
{
f2 = f2 + 512;
}
其他的
{
f2 = f2 + 768;
}
dateeprom = f2;
LCDcommand (0 xc0);
numberdisplay (addr);
LCDcommand (0 x14);
NumberDisplay(DateEprom);
_delay_ms(50);
}
e = e + 6;
LCDCommand(0x01);
LCDcommand (0 x80);
LCDdisplay(写作/完成);
LCDCommand(0x01);
LCDcommand (0 x80);
_delay_ms (500);
Portd ^= 1 << pind4;
if(bit_is_clear(pind,4))
{
LCDCommand(0x01);
LCDcommand (0 x80);
LCDdisplay(“继续扫描/”);
_delay_ms (400);
继续;
}
其他的
{
返回0;
}
如果(我= = 25)
{
返回0;
}
}
返回0;
}
int lrn ()
{
int dateeprom;
模式= 0;
LCDcommand (0 x80);
LCDCommand(0x01);
lcddisplay(“学习命令/”);
演讲者(“Larrn /”);
发言人(“命令/”);
_delay_ms (600);
e = 0;
(我= 0;我< 6;我+ +)
{
LCDcommand (0 x80);
LCDCommand(0x01);//第一行
LCDdisplay(“/”做手势);
LCDcommand (0 xc0);
对于(f=0;f<6;f++)
{
dwrd [f] =手势[i] [f];
}
LCDdisplay (dwrd);
LCDdisplay (dwrd);
发言人(“Doo/”);
演讲者(“手势/”);
演讲者(“/”);
演讲者(dwrd);
ADCinitialize ();
/ * LCDcommand (0 x01);
LCDcommand (0 x80);
LCDdisplay(“扫描开始/”);
_delay_ms (10);
* /
ADCSCAN();
/ * LCDinitialize ();
lcddisplay(“师/”);
LCDcommand (0 xc0);
(我= 0;< 3,我+ +)
{
数字显示(avgpos[i]);
LCDcommand (0 x14);
}
_delay_ms (10);
LCDCommand(0x01);
LCDcommand (0 x80);
lcddisplay(“扫描完成/”);
_delay_ms (10);
* /
LCDCommand(0x01);
LCDcommand (0 x80);
LCDdisplay(“写内存/”);
_delay_ms (600);
LCDcommand (0 xc0);
(z = 0; z < 3; z + +)
{
NumberDisplay(avgpos [z]);
LCDcommand (0 x14);
}
_延迟μms(1000);
int t = 0;
e = 300;
(d = 0; d < 6; d = d + 2)
{
datwr = avgpos [t];
T ++;
addr = e + d;
If (datwr>=000 && datwr<256), color0000ff;
{
e1 = 0;
e2 = datwr;
}
Else if(datwr>=256 && datwr<512)
{
e1 = 1;
e2=datwr-256;
}
否则如果(datwr>=512&&datwr<768)
{
e1 = 2;
e2 = datwr - 512;
}
其他的
{
e1 = 3;
e2 = datwr - 768;
}
EEPROM_write (addr, e1);
addr + +;
EEPROM_write (addr, e2);
LCDCommand(0x01);
LCDcommand (0 x80);
lcddisplay(“EEPROM检查/”);
_delay_ms (10);
f2 = EEPROM_read (addr);
addr,;
f1 = EEPROM_read (addr);
/ * LCDcommand (0 x01);
LCDcommand (0 x80);
数字显示(f1);
LCDcommand (0 x14);
数字显示(f2);
LCDCommand(0x01);
* /
if(f1 == 0)
{
f2 = f2;
}
否则if(f1 == 1)
{
F2 = F2 + 256;
}
Else if(f1 == 2) = 1
{
f2 = f2 + 512;
}
其他的
{
f2 = f2 + 768;
}
dateeprom = f2;
LCDcommand (0 xc0);
numberdisplay (addr);
LCDcommand (0 x14);
NumberDisplay(DateEprom);
_delay_ms(50);
}
e = e + 6;
LCDCommand(0x01);
LCDcommand (0 x80);
LCDdisplay(写作/完成);
LCDCommand(0x01);
LCDcommand (0 x80);
_delay_ms (500);
Portd ^= 1 << pind4;
if(bit_is_clear(pind,4))
{
LCDCommand(0x01);
LCDcommand (0 x80);
LCDdisplay(“继续扫描/”);
_delay_ms (400);
继续;
}
其他的
{
返回0;
}
如果(我= = 6)
{
返回0;
}
}
返回0;
}
int(工作)
{
模式= 1;
LCDcommand (0 x80);
LCDCommand(0x01);
LCDDisplay(“工作模式/”);
演讲者(“工作/”);
扬声器(“模式/”);
_delay_ms (600);
LCDcommand (0 x80);
LCDCommand(0x01);
LCDdisplay(“新闻开始…/”);
演讲者(“启动/”);
演讲者(“手势/”);
_delay_ms (600);
portd ^ = 1 << pind6;
如果(bit_is_clear (PIND 6))
{
strt_chck();
}
其他的
{
如果(bit_is_clear (PIND 5))
{
工作();
}
其他的
{
LCDcommand (0 x80);
LCDCommand(0x01);
LCDdisplay(“退出工作模式/”);
_delay_ms (400);
返回0;
}
}
返回0;
}
int strt_chck ()
{
portd ^ = 1 << strt;//检查按钮状态
if (bit_is_clear(PIND, 6)) //按下按钮检查
{
/ * lcdcommand(0x01);
LCDcommand (0 x80);
LCDdisplay(“扫描开始/”);
_delay_ms (10);
* /
ADCinitialize ();
ADCSCAN();
LCDCommand(0x01);
LCDcommand (0 x80);
LCDdisplay(“工作扫描完成/”;
_delay_ms (600);
如果(flagcmd = = 1)
{
还生产();
}
其他的
{
searchletter ();
compwrd[z]='/';
}
//给出单词的结尾
LCDCommand(0x01);
LCDcommand (0 x80);
lcddisplay(“word是=”);
LCDcommand (0 xc0);
lcddisplay(compwrd);
_延迟μms(1000);
如果(!(位为清除(PIND,6)))
{
LCDCommand(0x01);
LCDcommand (0 x80);
LCDdisplay(“退出扫描/”);
_delay_ms (600);
LCDCommand(0x01);
LCDcommand (0 x80);
LCDdisplay(“最后词= ");
LCDcommand (0 xc0);
lcddisplay(compwrd);
_延迟μms(1000);
演讲者(compwrd);
word_end ();
z = 0;//用于将Word传输到SpeedJET
而(Bit_Is_clear(Pind,5));
工作();
}
其他的
{
strt_chck();
}
}
其他的
{
strt_chck();
}
返回0;
}
int word_end ()
{
PORTB & = ~ (1 <
而(!(UCSRA & (1 <
UDR = 0 x0d;//命令在最后发言
而(门& (1 <
PORTB | = (1 <
返回0;
}
int命令()
{
LCDinitialize ();
LCDdisplay(“命令模式/”);
_delay_ms (800);
flagcmd=1;
}
int ADCinitialize ()
{
/* adcsra |= 1<< aden;
ADCSRA | = 1 << ADPS2;
ADMUX |=1<
// adcsra | = 1 << Adie;
* /
ADCSRA = 0 x87;
返回0;
}
int ADCscan ()
{
int问;
PORTB | = (1 <
LCDinitialize ();
LCDdisplay(“扫描..../”);
(q = 0; q < 10; q + +)
{
闪光();
}
//仅用于传感器显示
/ *
而(1)
{
_delay_ms(50);
LCDinitialize ();
(我= 0;< 3,我+ +)
{
ADMUX = 0 x40 + i;
/ * numberdisplay (ADMUX);
LCDCommand(0x01);
LCDcommand (0 x80);
* /
/ * _delay_ms (2);
ADCSRA | = 1 << ADSC;//开始另一个转换
而(ADIF = = ' 0 ');
是= ADCL;
差异= ADCH;/ /得到样品
/ * numberdisplay (Ain);
LCDcommand (0 xc0);
numberdisplay(差异);/ /得到样品
_delay_ms (10);
LCDCommand(0x01);
LCDcommand (0 x80);
* /
/ *
如果(Aout==0)
{
ain = ain;
}
else if(Aout==1)
{
是=是+ 256;
}
else if(Aout == 2)
{
ain = ain + 512;
}
其他的
{
是=是+ 768;
}
LCDcommand (0 x14);
数字显示(Ain);
}
}
* /
for(j = 0; J <6; J ++)
{
LCDCommand(0x01);
LCDcommand (0 x80);
for(i = 0; I <3; I ++)
{
ADMUX = 0 x40 + i;
/ * numberdisplay (ADMUX);
LCDCommand(0x01);
LCDcommand (0 x80);
* / _delay_ms(2);
ADCSRA | = 1 << ADSC;//开始另一个转换
而(ADIF = = ' 0 ');
是= ADCL;
差异= ADCH;/ /得到样品
/ * numberdisplay (Ain);
LCDcommand (0 xc0);
numberdisplay(差异);/ /得到样品
_delay_ms (10);
LCDCommand(0x01);
LCDcommand (0 x80);
* /
如果(Aout==0)
{
ain = ain;
}
else if(Aout==1)
{
是=是+ 256;
}
else if(Aout == 2)
{
ain = ain + 512;
}
其他的
{
是=是+ 768;
}
pos [j][我]=还;
/ *
NumberDisplay(i);
数字显示(j);
LCDcommand (0 xc0);
数字显示(Ain)//拿样品
_delay_ms (10);
LCDCommand(0x01);
LCDcommand (0 x80);
* /
}
}
/ * LCDcommand (0 x01);
LCDcommand (0 x80);
LCDdisplay(“pos = /”);
LCDCommand(0x01);
LCDcommand (0 x80);
for(j = 0; J <6; J ++)
{
LCDinitialize ();
lcddisplay(“行/”);
数字显示(j);
LCDcommand (0 xc0);
for(i = 0; I <3; I ++)
{
numberdisplay (pos [j][我]);
LCDcommand (0 x14);
}
_delay_ms (10);
}
* /
LCDCommand(0x01);
LCDcommand (0 x80);
LCDdisplay(“扫描/ ");
_delay_ms (600);
PORTB & = ~ (1 <
For (i = 0;我< 3;我+ +)
{
sumpos[我]= 0;
}
/ * LCDcommand (0 x01);
LCDcommand (0 x80);
lcddisplay(“创建Sumpos /”);
_delay_ms (10);
LCDCommand(0x01);
LCDcommand (0 x80);
LCDdisplay (sumpos);
_delay_ms(10); * /
For (i = 1;我< 6;我+ +)
{
Sumpos [0] = Sumpos [0] + pos[i][0];
sumpos [1] = sumpos [1] + pos [i] [1];
sumpos [2] = sumpos [2] + pos [i] [2];
}
/ * LCDcommand (0 x01);
LCDcommand (0 x80);
LCDdisplay(“Sumpos加法/”);
_delay_ms (10);
/ * LCDcommand (0 x01);
LCDcommand (0 x80);
(我= 0;< 3,我+ +)
{
numberdisplay (sumpos[我]);
LCDcommand (0 x14);
}
_delay_ms (10);
* /
LCDCommand(0x01);
LCDcommand (0 x80);
For (i = 0;我< 3;我+ +)
{
avgpos[我]= ((sumpos[我])/ 5);
_delay_ms (10);
}
For (i = 0;我< 3;我+ +)
{
avgpostest[i]=((sumpos[i])/5);
_delay_ms (10);
}
返回0;
}
int searchletter ()
{
无符号整型的测试;
int国旗= 0;
int数;
int alphano;
e = 0;
LCDCommand(0x01);
LCDcommand (0 x80);
LCDdisplay(“搜索/”);
LCDcommand (0 xc0);
数据库LCDdisplay(“/”);
_delay_ms (500);
alphano = -1;
LCDinitialize ();
LCDdisplay(“工作数据:/”);
LCDcommand (0 xc0);
(我= 0;< 3,我+ +)
{
数字显示(avgpostest[i]);
LCDcommand (0 x14);
}
_延迟μms(1000);
LCDCommand(0x01);
for(c = 0; c <7; c ++)
{
alphano + +;
数= 0;
int y = 0;
if(flagcmd == 1)
{
e = 300;
}
其他的
{
e = 0;
}
(d = 0; d < 6; d = d + 2)
{
addr = e + d;
f1 = EEPROM_read (addr);
addr + +;
f2 = EEPROM_read (addr);
/ * LCDcommand (0 x01);
LCDcommand (0 x80);
数字显示(f1);
LCDcommand (0 x14);
数字显示(f2);
LCDCommand(0x01);
* /
if(f1 == 0)
{
f2 = f2;
}
否则if(f1 == 1)
{
F2 = F2 + 256;
}
Else if(f1 == 2) = 1
{
f2 = f2 + 512;
}
其他的
{
f2 = f2 + 768;
}
测试= f2;
/ *
LCDCommand(0x01);
LCDcommand (0 x80);
数字显示(f2);
LCDCommand(0x01);
LCDCommand(0x01);
LCDcommand (0 x80);
numberdisplay (avgpostest [y]);
LCDCommand(0x01);
* /
如果((avgpostest[y]>(test-10))&&(avgpostest[y]<(test+10))| |(avgpostest[y]==(test)))
{
数= 1;
标志= 1;
}
其他的
{
数= 0;
d = 6;
}
y + +;
}
如果(count == 1)
{
LCDCommand(0x01);
LCDcommand (0 x80);
LCDdisplay(“匹配发现/ ");
if(flagcmd == 1)
{
LCDcommand (0 xc0);
LCDdisplay(“word is/”);
LCDcommand (0 x14);
对于(f=0;f<6;f++)
{
compwrd [f] =手势[alphano] [f];
}
LCDdisplay(手势(alphano));
_delay_ms (600);
}
其他的
{
LCDcommand (0 xc0);
LCDdisplay(“字母/”);
LCDcommand (0 x14);
字母表compwrd [z] = [alphano];
_delay_ms (10);
z++;
dataport =字母(alphano);
wrdata();
_delay_ms (600);
}
}
e = e + 6;
}
如果(标志= = 0)
{
LCDCommand(0x01);
LCDcommand (0 x80);
LCDdisplay(“未找到匹配/”);
_delay_ms (400);
}
返回0;
}
ISR (int0_vect)
{
字母++;
}
空白usart_init ()
{
UCSRB | =(1 << RXEN)|(1 << TXEN);
//打开传输和接收电路
Ucsrc |= (1< < ursel)
//使用8位字符大小
UBRRH=(波特率>>8);//加载波特率值的上8位。。
//进入UBRR寄存器的高字节
UBRRL = BAUD_PRESCALE;//将波特率值降低8位。
//进入UBRR寄存器的低字节
}
Void speaker(unsigned char data[])
{
int我;
PORTB & = ~ (1 <
//LCDcommand(0x01);
/ / LCDcommand (0 x80);
/ / LCDdisplay(“说忙/ ");
/ / _delay_ms (100);
/ /当(冰镇。4 = = ' 0 ');
for(i = 0; i
{
[我]usart_putch(数据);
}
UsArt_putch(0x0D);//将数据发送回PC(超级终端)
_延迟μms(1000);
// while(PORTA & (1<
PORTB | = (1 <
}
Int size (unsigned char disp[])
{
(我= 0;< 16,我+ +)
{
如果(disp[我]= = ' / ')
{
返回(张);
}
}
}
Void usart_putch(unsigned char send)
{
while ((UCSRA & (1 << UDRE)) == 0);//在UDR准备好之前什么都不要做…
//若要写入更多数据
UDR=send;//发送字节
}
unsigned int usart_getch()
{
而((UCSRA&(1<
//在接收到数据并准备好从UDR读取数据之前,不做任何操作
返回(UDR);//返回字节
}
void USART_Flush(void)
{
无符号字符伪;
而(UCSRA&(1 <
}
int lcdinitialize()
{
DataPort = 0x38;//初始化LCD 2行,5x7矩阵
WRCOMM();//将命令字节右转到命令寄存器
数据端口=0x01//清晰液晶显示器
WRCOMM();//将命令字节右转到命令寄存器
dataport = 0 x06;//光标闪烁显示
WRCOMM();
dataport = 0 x0e;//光标闪烁显示
WRCOMM();//将命令字节右转到命令寄存器
dataport = 0 x80;//光标在第一行,位置1
WRCOMM();//将命令字节右转到命令寄存器
// dataport = 0x1c;//将整个显示转移到右侧
/ / wrcomm ();//将命令字节右转到命令寄存器
返回1;
}
int LCDcommand (char cmd)
{
dataport = cmd;
WRCOMM();
}
/*发送数据到LCD显示*/
int LCDdisplay(unsigned char disp[])
{
int i,len;
len =大小(disp);
(我= 0;我<兰;我+ +)
{
数据端口=disp[i];
wrdata();
}
返回1;
}
/*显示数组的大小*/
int size(无符号char disp [])
{
(我= 0;< 16,我+ +)
{
如果(disp[我]= = ' / ')
{
返回(我);
}
}
}
/*将命令字节赋值为命令寄存器*/
int wrcomm(空白)
{
通信端口&=~(1<
Commport &= (1 << wr);//设置RW = 0
commport | =(1 << en);// en = 1
Commport &= ~(1 << en); / /输入//EN = 0, Enable引脚高到低脉冲
_delay_ms (5);/ / 10毫秒的延迟
返回1;
}
/*将数据字节调整为数据寄存器*/
INT WRDATA(void)
{
通讯端口|=(1<
Commport &= (1 << wr);//设置RW = 0
commport | =(1 << en);// en = 1
Commport &= ~(1 << en); / /输入//EN = 0, Enable引脚高到低脉冲
_delay_ms (5);/ / 10毫秒的延迟
返回1;
}
int numberdisplay (int麻木)
{
INT DTC,DTCM,DTMM,DTM,DTN,DTL,DTV;
数字电视=麻木/ 1000;
DTCM = NUMB%1000;
dtc = dtcm / 100;
dtmm = dtcm % 100;
dtm = dtmm / 10;
dtn=dtmm%10;
dataport = numlcd(数字电视);
wrdata();
dataport = numlcd (dtc);
wrdata();
dataport = numlcd [dtm];
wrdata();
dataport = numlcd [dtn];
wrdata();
返回0;
}
void EEPROM_write(int add, int dat)
{
而(eecr&(1 <
EEAR =添加;
EEDR = DAT;
EECR | = (1 <
EECR | = (1 <
}
int EEPROM_read (int添加)
{
而(eecr&(1 <
EEAR =添加;
EECR | = (1 <
返回EEDR;
}
int led_initial() //在选择模式前显示led闪烁
{
//所有指示灯都亮起
PORTB & = ~ (1 <
_delay_ms (500);/ /延迟
PORTB & = ~ (1 <
_delay_ms (500);/ /延迟
PORTB & = ~ (1 <
_delay_ms (500);/ /延迟
PORTB & = ~ (1 <
_delay_ms (500);/ /延迟
_delay_ms (500);/ /延迟
/ /所有发光二极管
PORTB | = (1 <
PORTB | = (1 <
PORTB | = (1 <
PORTB | = (1 <
返回0;
}
int flash ()
{
_delay_ms(50);
LCDinitialize ();
(我= 0;< 3,我+ +)
{
ADMUX = 0 x40 + i;
/ / numberdisplay (ADMUX);
//LCDcommand(0x01);
/ / LCDcommand (0 x80);
_延迟时间(2);
ADCSRA | = 1 << ADSC;//开始另一个转换
而(ADIF = = ' 0 ');
是= ADCL;
差异= ADCH;/ /得到样品
/ * numberdisplay (Ain);
LCDcommand (0 xc0);
numberdisplay(差异);/ /得到样品
_delay_ms (10);
LCDCommand(0x01);
LCDcommand (0 x80);
* /
如果(Aout==0)
{
ain = ain;
}
else if(Aout==1)
{
是=是+ 256;
}
else if(Aout == 2)
{
ain = ain + 512;
}
其他的
{
是=是+ 768;
}
数字显示(Ain);
LCDcommand (0 x14);
}
}
###
电路图
了下:188金宝搏提款有问题吗