/////////////////////////////////////
// Generated Initialization File //
/////////////////////////////////////
#include "compiler_defs.h"
#include "C8051F320_defs.h"
#include "stdio.h"
sbit led1=P2^2;
sbit led2=P2^3;
char flag,count;
// Peripheral specific initialization functions,
// Called from the Init_Device() function
void PCA_Init()
{
PCA0MD &= ~0x40;
PCA0MD = 0x00;
}
void Timer_Init()
{
TCON = 0x50;
TMOD = 0x21;
CKCON = 0x01;
TL0 = 0xA0;
TH0 = 0x15;
TH1 = 0xB2;
}
void Port_IO_Init()
{
P0MDOUT = 0x10;
P2MDOUT = 0x0C;
XBR0 = 0x01;
XBR1 = 0x40;
}
void Oscillator_Init()
{
int i = 0;
CLKMUL = 0x80;
for (i = 0; i < 20; i++); // Wait 5us for initialization
CLKMUL |= 0xC0;
while ((CLKMUL & 0x20) == 0);
CLKSEL = 0x02;
}
void Interrupts_Init()
{
IE = 0x82;
}
// Initialization function for device,
// Call Init_Device() from your main program
void Init_Device(void)
{
PCA_Init();
Timer_Init();
Port_IO_Init();
Oscillator_Init();
Interrupts_Init();
}
void time0() interrupt 1
{
TH0=0x15;
TL0=0xa0;
count++;
}
void main()
{
Init_Device();
TI0=1;
while(1)
{
if(count==10)
{
led1=~led1;
printf("hello world\n");
}
if(count==20)
{
led2=~led2;
printf("hello fuck\n");
count=0;
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
max232_time.zip_源码
共17个文件
bak:3个
h:2个
administrator:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 55 浏览量
2022-09-19
19:47:27
上传
评论
收藏 54KB ZIP 举报
温馨提示
C8051F020的UART通信设置和程序
资源详情
资源评论
资源推荐
收起资源包目录
max232_time.zip (17个子文件)
max232_time
C8051F320_defs.h 18KB
max232_time.M51 10KB
max232_time.lnp 77B
max232_time.uvproj 13KB
max232_time 15KB
compiler_defs.h 23KB
max232_time_uvopt.bak 6KB
max232_time.OBJ 15KB
max232_time_uvproj.bak 13KB
max232_time.uvopt 6KB
max232_time.uvgui_Administrator.bak 142KB
ExtDll.iex 19B
max232_time.LST 4KB
max232_time.uvgui.Administrator 142KB
max232_time.plg 2KB
max232_time.cwg 6KB
max232_time.c 1KB
共 17 条
- 1
weixin_42653672
- 粉丝: 94
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0