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

📄 rd7472.cpp

📁 串口可交换程序
💻 CPP
字号:
#include <math.h>
#include <stdio.h>
#include <assert.h>
#include <time.h>

#include "global.h"
#include "rd7472.h"

int read7472()
{
	long int data=0;
	char i,test_times;
	if(_avg[chs].on_off==ON)
		test_times=_avg[chs].avg_times;
	else
		test_times=1;
	for(i=0;i<test_times;i++){
		outport(0x370,cmd_word|0x0040);
		outport(0x370,cmd_word&0xffbf);
		outport(0x370,cmd_word|0x0040);

		while(!(inport(0x378)&0x8000));
		while(!(inport(0x378)&0x8000));

		data+=inport(0x340)&0xfff;
	}
	data/=(test_times);
//	data = 0xe00;
	return (int)data;
}
float conv(int data_in)
{
//	float max=2.5;            //return (in-temp)*50+15;
//	float max=temp;
	//float resul;
//	resul=(2.5f*data_in/0x0fff-max)*0.1/x+15;
//	resul=(2.5f*data_in/4096.0f-2.5)*50+15;
//	printf("%#x",data_in);
	return (125.0f*((float)data_in/4096.0)-110.0f);
//	printf("%.2f   ",resul);
	//return resul;
}
void draw_map(long f,float x)
{
	if(f<100000||f>50000000)
		return;
	float pos1=_scale[chs].ref_pos+(x-_scale[chs].ref_vol)/_scale[chs].scale_unit;
	x_map=DISP_X1+(double)(f-_freq[chs].start_freq)/(double)(_freq[chs].freq_width)*500.0f;
	y_map=(10.0-pos1)*40-1;  //???????
}
void draw_map(int points,int p,float x)
{
	float pos1;
	pos1=_scale[chs].ref_pos+(x-_scale[chs].ref_vol)/_scale[chs].scale_unit;
	assert(points!=0);
	x_map=DISP_X1+500L*p/points;
	y_map=(10.0f-pos1)*40-1;
}

⌨️ 快捷键说明

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