📄 main2.c
字号:
/*
文件:main.c
描述:AD592温度探测程序
编写:黄曦
*/
#include <avr/io.h>
#include <avr/delay.h>
#include <avr/pgmspace.h>
#include <stdio.h>
#define uchar unsigned char
#define uint unsigned int
static uint AdConvertBuff[8];
void delayms(uint t)
{
uint i;
for(i=0;i<t;i++)
_delay_loop_2(1000);
}
//////////////////////////
/////////串口部分/////////
/////////////////////////
int usart_putchar(char ch)
{
if(ch=='\n')
usart_putchar('\r');
loop_until_bit_is_set(UCSRA,UDRE);
UDR=ch;
return 0;
}
int usart_getchar(void)
{
loop_until_bit_is_set(UCSRA,RXC);
return UDR;
}
////
void IoInit(void)
{
PORTC=0x00;
DDRC=0x00;
//uart初始化
UCSRB=_BV(RXEN)|_BV(TXEN);
UBRRL=25; //9600bps
//IO流UART连接
fdevopen(usart_putchar,usart_getchar,0);
}
void main()
{
uchar i;
int ret;
IoInit();
delayms(10);
while(1)
{
//ret=GetAdc()/2-25;
printf("Test\r\n");
delayms(250);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -