使用定时器1以定时方法在P1.0输出周期为300us,占空比为40%的矩形脉冲,设单片机晶振为6MHz.。

[复制链接]
查看11 | 回复2 | 2012-7-3 20:03:42 | 显示全部楼层 |阅读模式
unsigned char hflag;sbit pulse = P1^0;unsigned char aaa;#includemain(){
TMOD = 0x20;
//定时方式2
TH1 = (65536 - 50) / 256;//定时100us
TL1 = (65536 - 50) % 256;
EA = 1;
TR1 = 1;
ET1 = 1;
aaa = 0;
while(1);}void T1_INT() interrupt 3{
aaa++;
if(aaa == 5) ...
回复

使用道具 举报

千问 | 2012-7-3 20:03:42 | 显示全部楼层
unsigned char hflag;sbit pulse=P1^0;unsigned char hth1h,hth1l,lth1h,lth1l;#includemain(){
TMOD=0x10;
hth1h=(65536-60)/256;
hth1l=(6553...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行