printf 函数在keil2 中的使用
来源:互联网 发布:大数据行业股票 编辑:程序博客网 时间:2024/05/18 02:22
/****************************************************************************/
/* */
/* SERIAL.C: Interrupt Controlled Serial Interface */
/* */
/****************************************************************************/
//采用中断接收串口数据
//发送数据到串口可使用<stdio.h>定义的函数
//有疑义可访问bbs.21ic.com进行讨论。
//测试:古道热肠
//#include <reg52.h>
#include "STC_NEW_8051.H"
#include <stdio.h>
volatile unsigned char UartIsSending;
char putchar (char ucWriteData)
{
SBUF=ucWriteData;
UartIsSending=1;
while(UartIsSending);
return (ucWriteData);
}
volatile unsigned char UartIsSending;
void UartIsr(void) interrupt 4
{
if(TI) //发送中断
{
UartIsSending=0;
TI=0;
}
if(RI) //接收中断
{
RI=0;
}
}
/****************************************************************************/
/* serial_init: initialize serial interface */
/****************************************************************************/
serial_init ()
{
SCON = 0x50; /* mode 1: 8-bit UART, enable receiver */
TMOD |= 0x20; /* timer 1 mode 2: 8-Bit reload */
TH1 = 0xfa; /* reload value 2400 baud */
TR1 = 1; /* timer 1 run */
ES=1;
}
void Delay(void)
{
unsigned char ucDelayCount;
for(ucDelayCount=0; ucDelayCount<0xFF; ucDelayCount++)
{
;
}
}
unsigned long sum=0;
unsigned long __checksum=0xE728 ;
void main(void)
{
serial_init();
EA = 1;
while(1)
{
putchar('8');
putchar('\n');
Delay();
printf("welcome to www.21ic.com\n");
printf("Checksum failed: 0x%04lX (calculated) "
"vs 0x%04lX (from linker)\n", sum, __checksum);
}
}
/* */
/* SERIAL.C: Interrupt Controlled Serial Interface */
/* */
/****************************************************************************/
//采用中断接收串口数据
//发送数据到串口可使用<stdio.h>定义的函数
//有疑义可访问bbs.21ic.com进行讨论。
//测试:古道热肠
//#include <reg52.h>
#include "STC_NEW_8051.H"
#include <stdio.h>
volatile unsigned char UartIsSending;
char putchar (char ucWriteData)
{
SBUF=ucWriteData;
UartIsSending=1;
while(UartIsSending);
return (ucWriteData);
}
volatile unsigned char UartIsSending;
void UartIsr(void) interrupt 4
{
if(TI) //发送中断
{
UartIsSending=0;
TI=0;
}
if(RI) //接收中断
{
RI=0;
}
}
/****************************************************************************/
/* serial_init: initialize serial interface */
/****************************************************************************/
serial_init ()
{
SCON = 0x50; /* mode 1: 8-bit UART, enable receiver */
TMOD |= 0x20; /* timer 1 mode 2: 8-Bit reload */
TH1 = 0xfa; /* reload value 2400 baud */
TR1 = 1; /* timer 1 run */
ES=1;
}
void Delay(void)
{
unsigned char ucDelayCount;
for(ucDelayCount=0; ucDelayCount<0xFF; ucDelayCount++)
{
;
}
}
unsigned long sum=0;
unsigned long __checksum=0xE728 ;
void main(void)
{
serial_init();
EA = 1;
while(1)
{
putchar('8');
putchar('\n');
Delay();
printf("welcome to www.21ic.com\n");
printf("Checksum failed: 0x%04lX (calculated) "
"vs 0x%04lX (from linker)\n", sum, __checksum);
}
}
0 0
- printf 函数在keil2 中的使用
- 在 Freescale CodeWarrior 中使用 printf( ) 函数
- printf在消息框中的使用
- awk中的printf函数
- printf函数使用
- printf函数的使用
- printf函数的使用
- printf函数使用技巧
- 使用printf函数输出
- 在keil中使用printf()函数的要点
- 在keil中使用printf()函数的要点分析:
- 关于在stm32中使用printf函数的问题
- STM32L152RC 在keil4中使用printf()和scanf() 函数
- stm32在keil编译环境下使用printf函数
- 如何在单片机上使用printf函数(printf)(avr)(stm)(lpc)(单片机)
- C中的printf函数详解
- perl printf函数的使用
- cuda上使用printf函数
- eclipse下tomcat发布更新文件(Could not delete xxx.data May be locked by another process)
- ZigBee 的发展也有“碎片化”——从工程师的角度看ZigBee 在各个领域的发展
- 需求层次理论
- MySQL 时间戳(Timestamp)函数
- 服務器端驗證類
- printf 函数在keil2 中的使用
- vb.net机房收费系统的系统登录
- webService 之 Axis2
- GitHub详细教程
- c/c++ 符号拓展
- vim学习笔记
- Hibernate查询缓存全面分析
- 亂碼產生器
- Flex使用JXL导出Excel文档(包含设置时间、数字格式以及其他相关设置)