日本黄色一级经典视频|伊人久久精品视频|亚洲黄色色周成人视频九九九|av免费网址黄色小短片|黄色Av无码亚洲成年人|亚洲1区2区3区无码|真人黄片免费观看|无码一级小说欧美日免费三级|日韩中文字幕91在线看|精品久久久无码中文字幕边打电话

當(dāng)前位置:首頁 > 單片機 > 單片機
[導(dǎo)讀]#include #include #include #pragma interrupt_handler timer0_ovf:10#pragma interrupt_handler int1_isr:3#define DDR_address DDRA=0xfe#define DDR_contrue DDRB|=BIT(PB0)|BIT(PB1)|BIT(PB2)#define address

#include
#include
#include
#pragma interrupt_handler timer0_ovf:10
#pragma interrupt_handler int1_isr:3
#define DDR_address DDRA=0xfe
#define DDR_contrue DDRB|=BIT(PB0)|BIT(PB1)|BIT(PB2)
#define address PORTA
#define CE_H PORTB|=BIT(PB0)
#define CE_L PORTB&=~BIT(PB0)
#define PD_H PORTB|=BIT(PB1)
#define PD_L PORTB&=~BIT(PB1)
#define PLAY PORTB|=BIT(PB2)
#define RECORD PORTB&=~BIT(PB2)
uchar count=0;//每0.8秒 時間計數(shù)一次
uchar num=0; //Timer0中斷計數(shù),每計數(shù)100個為0.8秒
uchar play_addr=0;//放音地址
uchar record_addr=0;//錄音地址
uchar record_time=1;
void delay_isd2560()
{
uchar a,b;
for (a=0;a<100;a++)
for (b=0;b<100;b++)
;
}
void timer0_ovf()
{
TCNT0=5;
num++;
if (num>95)//num取值要略小于100,防止錄音時間超出分段地址時間(0.8秒)。
{
num=0;
count++;
record_addr++;//地址每加一次,錄音時間增加0.8秒
}
if (count>=((int)(record_time*10)/8))
{
stop();
TIMSK=0x00;
count=0;
num=0;
LCMDisplayString(4,3,"錄音停止");
}
}
void int1_isr()//根據(jù)錄音結(jié)束標(biāo)志,判斷此段放音結(jié)束
{
stop();
LCMDisplayString(4,4,"放音停止");
}
void isd2560_init()
{
MCUCR|=0x08;
GICR|=0x80;
TIMSK=0x00;
TIFR=0;
TCCR0=0x04;
TCNT0=5;
SREG=0x80;
DDR_address;
DDR_contrue;
DDRD&=~BIT(PD3);
CE_H;
PD_H;
}
void record()
{
MCUCR&=~0x08;
address=record_addr<<1;
delay_isd2560();
RECORD;
PD_L;
CE_L;
TIMSK=0x01;
TCNT0=5;
num=0;
count=0;
}
void play()
{
MCUCR|=0x08;
TIMSK=0x00;
address=play_addr<<1;
delay_isd2560();
PLAY;
PD_L;
delay_isd2560();
CE_L;
delay_isd2560();
CE_H;
}
void stop()
{
TIMSK=0x00;
CE_H;
PD_H;
}

本站聲明: 本文章由作者或相關(guān)機構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點,本站亦不保證或承諾內(nèi)容真實性等。需要轉(zhuǎn)載請聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請及時聯(lián)系本站刪除( 郵箱:macysun@21ic.com )。
換一批
延伸閱讀
關(guān)閉