read.c

来自「此程序是基于c8051f020平台实现的是等精度频率计的测量控制部分」· C语言 代码 · 共 62 行

C
62
字号
#include<c8051f020.h>
//#include "hao.h"
#define uint unsigned int
#define uchar unsigned char
#define ulong unsigned long int

sbit sel0=P2^0;
sbit sel1=P2^1;
sbit sel2=P2^2;
sbit cl=P2^3;
sbit clr=P2^4;
sbit spul=P2^5;
sbit start=P2^6;
sbit eend=P2^7;
ulong std_num;
ulong test_num;
	
ulong read_std_num()
{
   uint std_num0=0,std_num1=0,std_num2=0,std_num3=0;
   sel2=0;
   sel1=0;
   sel0=0;
   std_num0=P0;	
   sel2=0;
   sel1=0;
   sel0=1;
   std_num1=P0;
   sel2=0;
   sel1=1;
   sel0=0;
   std_num2=P0;
   sel2=0;
   sel1=1;
   sel0=1;
   std_num3=P0;
   std_num=(std_num3<<24)+(std_num2<<16)+(std_num1<<8)+std_num0;
   return(std_num);			
}

ulong read_test_num()
{
   uint test_num0,test_num1,test_num2,test_num3;
   sel2=1;
   sel1=0;
   sel0=0;
   test_num0=P0;	
   sel2=0;
   sel1=0;
   sel0=1;
   test_num1=P0;
   sel2=0;
   sel1=1;
   sel0=0;
   test_num2=P0;
   sel2=0;
   sel1=1;
   sel0=1;
   test_num3=P0;
   test_num=(test_num3<<24)+(test_num2<<16)+(test_num1<<8)+test_num0;
   return(test_num);			
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?