📄 主处理程序.txt
字号:
主处理程序主要是捕获相应的中断标志,进行相应的处理.
下面为具体的程序。
#include "SPI.h"
#include "ISD4004.h"
//定义全局变量
static char nPlay;//PLAY按键
static char nRec;//REC按键
static char nPlay_count;//PLAY按键次数
static char nRec_count;//REC按键次数
static char nVOF;//ISD4004 INT中断标志
//定义串口操作变量
char nRev_UART0;//串口 0 的接收标志
unsigned char UART0_TX_BUF[20];// 串口 0 的发送缓冲区
unsigned char UART0_RX_BUF[20];// 串口 0 的接收缓冲区
static int nTX0_Len;//发送数据长度
static int nRX0_Len;//接收数据长度
int nRX0_Len_temp;
static char nTX0_Flag;//发送完成标志
int nSend_TX0;//发送记数器
void main()
{
int nRec_Row;
int nPlay_Row;
WDTCTL = WDTPW + WDTHOLD; // 关闭看门狗
_DINT();//关闭中断
// 初始化
Init_CLK();
PORT_Init();
SPI_Init();
nPlay = 0;
nRec = 0;
nPlay_count = 0;
nRec_count = 0;
nRec_Row = 0;
nPlay_Row = 0;
_EINT();//打开中断
for(;;)
{
// 放音的处理
if((nPlay == 1) && (nPlay_count == 1))
{
// 放音
Play(nPlay_Row);
nPlay_Row += 1;
if(nPlay_Row >= 2400) nPlay_Row = 0;
}
// 录音的处理
if((nRec == 1) && (nRec_count == 1))
{
// 录音
Record(nRec_Row);
nRec_Row += 1;
if(nRec_Row >= 2400) nRec_Row = 0;
}
Delay_us(10);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -