求c8051f310定时器 定时10s的c语言程序.急急急!!!!

[复制链接]
查看11 | 回复3 | 2010-8-2 17:00:11 | 显示全部楼层 |阅读模式
想要的是c8051f310的程序,,不是51系列单片机。。主要是初始化那一块不太懂

回复

使用道具 举报

千问 | 2010-8-2 17:00:11 | 显示全部楼层
先来个完整的程序定时十秒只要把 50毫秒*tt=10秒。即把tt改为200。参考一下这个,肯定会懂的。#include#define uint unsigned int#define uchar unsigned charsbit WL=P2^0;sbit DL=P2^1;sbit K=P2^7;uchar tt,aa,bb,cc;uchar code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};void display3(uchar aa);void display2(uchar bb)
回复

使用道具 举报

千问 | 2010-8-2 17:00:11 | 显示全部楼层
#includeunsigned charcounter;void main(){ TMOD = 0X01;// 定时器0 工作方式1 TH0 = 0X4C; TL0 = 0X00;//定时50ms; EA = 1; ET0 = 1; TR0 = 1; if(counter == 200) //1
回复

使用道具 举报

千问 | 2010-8-2 17:00:11 | 显示全部楼层
#include#define uchar unsigned char//宏定义#define uint unsigned intuchar numvoid main(){TMOD=0x01;//定时器0为工作方式1 M1M0 01TH0=(65536-50000)/256;装初值 12mhz TL0=(65
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行