main._c

来自「avr单片机mega128 的串口通讯的完整程序」· _C 代码 · 共 52 行

_C
52
字号
/*--------------------------------------------------*/
/*             AVR-ARM开发网论坛                    */
/*           http://www.avrarm.com                  */
/*            AVR生成代码测试程序                   */
/*--------------------------------------------------*/
/*     程序由AVR辅助开发工具V2.1.1自动生成          */
/*     AVR系统的处理器为:   ATMega128               */
/*     AVR系统的晶振频率:   8.0000 Mhz             */
/*--------------------------------------------------*/

#include <iom128v.h>
#include <macros.h>
#include "uart.h"


//-----------------------------------------------------------
//主函数
//-----------------------------------------------------------
void main(void)
{
   unsigned char i=0;

   Uart0_Init();

   Puts0("AVR-ARM ");//开发网论坛RS232 通信测试程序");
   Puts0("Http://www.avrarm.com");
   //Puts0("ATMega128的串口0 测试");
   Putchar0(0x0d);
   Putchar0(0x0a);
   DDRD=0x08;
   PORTD=0x08;
   while(1)
   {
      
	  i = Getchar0();
      
	  //if (i==0x0F)    //发送0x0F开始测试
     // while(1);
	  //{
        
		DDRD=0x04;
      PORTD=0x04;
		 i=0;
         Puts0("AVR-ARM 开发网论坛RS232 通信测试程序");
         Puts0("Http://www.avrarm.com");
         Puts0("ATMega128的串口0 测试");
         Putchar0(0x0d);
         Putchar0(0x0a);
     // }
   }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?