利用中断控制秒表的开关

#include <reg52.h> typedef unsigned int U16; typedef unsigned char U8; U8 num[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0x7F,0xFF}; sbit LED0=P1^0; sbit LED1=P1^1; sbit LED2=P1^2; sbit LED3=P1^3; sbit KeyIn4=P3^4; U8 shuma[4]={0}; void delay() { U16 i=1000; whil...
2017-04-11 09:15 | 阅读 906 次 | 评论 0 条

单片机 两个按键分别控制

#include<reg52.h> typedef unsigned char U8; typedef unsigned int U16; U16 x=0; sbit S1 = P3^6; sbit S2 = P3^7; sbit led0=P1^3; sbit led1=P1^2; sbit led2=P1^1; sbit led3=P1^0; code U8 num[]={0xC0,0xF9,0xA4,0xB0,0x99, 0x92,0x82,0xF8,0x80,0x90}; U8 shuma[4]={0}; void delay() { ...
2017-04-11 09:14 | 阅读 777 次 | 评论 0 条

利用中断实现十进制

#include <reg52.h> typedef unsigned int U16; typedef unsigned char U8; U8 num[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0x7f,0xFF}; sbit LED3=P1^3; sbit LED2=P1^2; sbit LED1=P1^1; sbit LED0=P1^0; U8 shuma[4]={0}; void T0_Init() { TMOD=0x10; TH1=0xFC; TL1=0x18; TR1=1...
2017-04-11 09:13 | 阅读 665 次 | 评论 0 条

倒计时

#include <reg52.h> #include <reg52.h> typedef unsigned int U16; typedef unsigned char U8; U8 num[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92, 0x82,0xF8,0x80,0x90,0x7f,0xFF}; sbit LED3=P1^3; sbit LED2=P1^2; sbit LED1...
2017-04-11 09:12 | 阅读 649 次 | 评论 0 条

十进制

#include <reg52.h> #include <reg52.h> typedef unsigned int U16; typedef unsigned char U8; U8 num[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0x7f,0xFF}; sbit LED3=P1^3; sbit LED2=P1^2; sbit LED1=P1^1; sbit...
2017-04-11 09:11 | 阅读 687 次 | 评论 0 条

11111

#include <reg52.h> typedef unsigned int U16; typedef unsigned char U8; U8 num[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0X7F}; sbit LED1=P1^0; sbit LED2=P1^1; sbit LED3=P1^2; sbit LED4=P1^3; void TO_INIt() { U8 j=0,t=0,n=0; TMOD=0x10; TH1=0x3C; TL1=0xB0; TR1=1...
2017-04-11 09:11 | 阅读 834 次 | 评论 0 条

求水分子数

#include<stdio.h> #include<stdlib.h> #define WEIGHT 3.0e-23 #define CHAGE 950 int main() { float k; printf("Please enter:"); scanf("%f,&amp;k"); printf("%e\n,k * CHAGE /WEIGHT"); exit(0); }
2017-04-11 09:04 | 阅读 640 次 | 评论 0 条
文章分类
文章归档
最新评论