📄 mian.c
字号:
#define SYSTEM_CLOCK 8000000
#include<def_AVR_IAR.h>
#include"EN25B16_driver.h"
unsigned char temp[32]={1,2,3,4,5,6,7,8,9,0,9,8,7,6,5,4,3,2,1,0};
unsigned char temp2[32]={0};
void USART_Init(void )
{
unsigned int baud;
/* 设置波特率*/
baud=51;
UBRR0H = (unsigned char)(baud>>8);
UBRR0L = (unsigned char)baud;
/* 接收器与发送器使能*/
UCSR0B = (1<<3)|(1<<4);
/*设置帧格式: 8个数据位, 1个停止位 */
}
void USART_Transmit( unsigned char data )
{
/*等待发送缓冲器为空*/
while ( !( UCSR0A & (1<<5)) );//UDREn
/* 将数据放入缓冲器,发送数据*/
UDR0 = data;
}
void USART_Transmit_st( unsigned char *pd )
{
int a=0;
while(*pd!='\n')
{
while ( !( UCSR0A & (1<<5)) );//UDREn
UDR0 = *(pd+a);
a++;
}
}
main()
{
unsigned char i;
USART_Init();
// EN25B16_INITIALIZTION();
// EraseSector_64K(0);
// WriteSector_64K(3,3,20,temp);
DDRE = 0xff;
PORTE = 0X00;
while(1)
{
// ReadSector_64K(3, 3, 20,temp2);
while(1)
{
PORTE = ~PORTE;}
for ( i= 0 ;i < 32; i++){
// USART_Transmit(temp2[i]);
// USART_Transmit(0);
}
// _NOP_ms(300);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -