⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 therm.c

📁 数字温度计原代码
💻 C
字号:
#include <string.h>
#include <stdlib.h>
ioport unsigned int portbfff;
extern void dspinit();
extern void bsp2init();
extern void writetherm(unsigned int);
extern unsigned int  readtherm();
extern void resettherm();
/////////////////////////////////////////////////////////////
void smg_dis(unsigned int address,unsigned int dot,unsigned int value, unsigned int light)
{
	unsigned int temp;
	temp=((address<<6)&0xc0)+(dot?0x10:0x00)+(light?0x20:0x00)+value;
	portbfff=temp;
}
void dis_therm(unsigned int value)
{
	unsigned int temp;
	temp=value&0x0f;
	temp=temp*10/16;
	smg_dis(0,0,temp,1);
	value=value>>4;
	temp=value%10;
	value=value/10;
	smg_dis(1,1,temp,1);
	temp=value%10;
	smg_dis(2,0,temp,1);
	temp=value/10;
	smg_dis(3,0,temp,1);
}

void main()
{
	unsigned int i;
	
	dspinit();
	bsp2init();
	while(1)
	{
		resettherm();
		writetherm(0xcc);
		writetherm(0x44);
		i=readtherm();
		while(i!=0xfff)
		{
			i=readtherm();
		}
		for(i=0;i<0xfff;i++);
		resettherm();
		writetherm(0xcc);
		writetherm(0xbe);
		i=readtherm();	
		dis_therm(i);
	}
}




⌨️ 快捷键说明

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