main.c
来自「使用8880实现DTMF通信及拨号的程序.」· C语言 代码 · 共 52 行
C
52 行
//ICC-AVR application builder : 2007-10-27 10:16:42
// Target : M8
// Crystal: 7.3728Mhz
#include <iom8v.h>
#include <macros.h>
#include "8880.h"
#include "serial.h"
#include "main.h"
#include "shell.h"
#include "timer.h"
SysOption sysoption;
void delay(unsigned int x)
{
for (;x>0;x--);
}
void port_init(void)
{
PORTB = 0x20; //00010000
DDRB = 0x0F; //00001111
PORTC = 0x0F; //00001111
DDRC = 0x2F; //00100000
PORTD = 0x0e; //00000100
DDRD = 0x02; //00000010
}
//call this routine to initialize all peripherals
void init_devices(void)
{
//stop errant interrupts until set up
CLI(); //disable all interrupts
port_init();
uart0_init();
MCUCR = 0x08;
GICR = 0x80;
TIMSK = 0x00; //timer interrupt sources
timer1_init();
SEI(); //re-enable interrupts
//all peripherals are now initialized
}
void main(void)
{
char buf[20];
init_devices();
M8880_Init();
sysoption.echo=-1;
sysoption.calling=0;
sysoption.timer=0;
sysoption.autoanswer=0;
while(1)shellin();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?