当前位置: 首页 > news >正文

云南省做网站开发的公司排名不属于网络推广方法

云南省做网站开发的公司排名,不属于网络推广方法,wordpress自定义分类,wordpress 管理员标签1. I2C工具查看aht20的温湿度寄存器值 1.1 原理图 传感器通过IIC方式进行通信,连接的为IIC1总线,且设备地址为0x38,实际上通过后续iic工具查询,这个设备是挂载在iic-0上 1.2 I2C工具 通过i2c工具可以实现查询i2c总线、以及上面…

1. I2C工具查看aht20的温湿度寄存器值

1.1 原理图

传感器通过IIC方式进行通信,连接的为IIC1总线,且设备地址为0x38,实际上通过后续iic工具查询,这个设备是挂载在iic-0上

在这里插入图片描述

1.2 I2C工具

通过i2c工具可以实现查询i2c总线、以及上面挂载的设备以及设备的寄存器值。
a. 下载安装:

可以通过IIC工具地址进行下载,或以下命令下载(慢):

git clone git://git.kernel.org/pub/scm/utils/i2c-tools/i2c-tools.git
  1. 下载后,复制到相关文件夹下,按ctrl+alt+t打开终端,通过tar -zxvf 解压缩
  2. cd i2c-tools-4.3目录下,下载版本不同,名称可能不一样
  3. vi Makefile将下列三行改写为:

前–>后
CC ?= gcc -->#CC ?= gcc
AR ?= ar–> #AR ?= ar
STRIP ?= strip -->#STRIP ?= strip

  1. make 编译后会在 ./tools/下生成可执行文件

在这里插入图片描述

  1. 将i2cdetect、i2cdump、i2cget、i2cset、i2ctransfer等工具拷贝到开发板的/usr/bin目录下
    在这里插入图片描述
    在这里插入图片描述
  2. 并且将对应的i2c工具依赖的库拷贝到开发板的/usr/lib下
    在这里插入图片描述

i2c工具介绍:

i2cdetect

-V 输出版本
-y 接i2c序号,检测挂载在i2c总线上的器件
-l 打印i2c总线
-F MODE_FUNC
-r MODE_READ
-q MODE_QUICK
-a 设置扫描的地址从0x00到0x7F
iic1上有在0x1a位置上有挂载设备和驱动;UU表示既有设备也有驱动;
在这里插入图片描述

i2cdump:

i2cdump -f -y 1 0x1a 查看挂载在i2c1的设备0x1a的寄存器的值

i2ctransfer

格式为:i2ctransfer -f -y iic序号 w[number]@设备地址 命令 参数 r[number2]
number 为写入的字节数,number2为读取的字节数

AHT20的命令介绍:

初始化 0xBE(1011’ 1110)
触发测量 0xAC
软复位 0xBA

状态字用来判断寄存器的状态,具体对应如下:

bit[7]bit[6]bit[5]bit[4]bit[3]bit[2]bit[1]bit[0]
1-测量中 0-休眠1-已校准 0- 未校准

传感器读取流程:

  • 上电后等待40ms, 通过0x71命令查看状态字的bit[3]是否为1,如果不为1,初始化(发送0xBE命令,命令有两个参数,分别为0x08与0x00,然后,等待10ms
  • 启动测量(发送0xAC命令,有两个参数,分别为0x33与0x00)
  • 等待80ms, 通过0x71命令读取状态字,bit[7]处于休眠态,说明测量完成,然后读取6个字节;如果bit[7]处于测量中,则继续等待;
  • 发送应答位
  • 接收数据,通过下列公式计算温湿度

V a l u e 湿度 = v a l u e r e g 1 2 20 100 Value_{湿度}=\frac{value_{reg1}}{2^{20}}100 Value湿度=220valuereg1100
V a l u e 温度 = v a l u e r e g 2 2 20 200 − 50 Value_{温度} = \frac{value_{reg2}}{2^{20}}200-50 Value温度=220valuereg220050

应用

1.初始化
i2ctransfer -f -y 0 w3@0x38 0xbe 0x08 0x00
2. 开始测量:
i2ctransfer -f -y 0 w3@0x38 0xAC 0x33 0x00
3. 读取值
i2ctransfer -f -y 0 w1@0x38 0x71 r7
在这里插入图片描述

补充说明:
Makefile的四种赋值运算符

= 赋值,可以使用后面定义的变量
:= 就地直接解析,只能使用前面定义好的变量
?=没有被赋值则进行赋值,赋值过则忽略
+=追加赋值

2. 使用安装好的驱动读取温湿度传感器的值

通过进程的方式获取iic总线挂载的设备,与iic设备寄存器的值后(实际上可以不用前面这些,直接循环读取就行),循环读取并计算温湿度传感器的值
注意:
execlp执行完,后续的将不会执行,因此,交给子进程单独执行该命令,在父进程中等待回收完子进程后,执行后续指令

#include <stdio.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>#define read_len 2
int main(int argc,char*argv[]){printf("i2c-1 的 寄存器\n");unsigned int buf[read_len];float hum,temp;float hum1,temp1;int h1,t1;int ret = 0;pid_t pid = fork();if(pid<0){perror("fork error");exit(1);}else if(pid == 0){execlp("i2cdetect","i2cdetect","-y","0",NULL);}else{  waitpid(-1,NULL,0);if(argc<2||strncmp(argv[1],"/dev/",5)){printf("参数错误,请输入/dev/");exit(1);}int fd = open(argv[1],O_RDWR);if(fd<0){perror("open error");exit(1);}pid_t pid2 = fork();if(pid2 == 0){ execlp("i2cdump","i2cdump","-f","-y","0","0x38",NULL);}               else if(pid2 > 0){waitpid(-1,NULL,0);while(1){if((ret=read(fd,buf,sizeof(buf)))==0){h1 = (buf[0]*1000)>>20;t1 = ((buf[1]*2000)>>20)-500;hum = buf[0]*1000./1024/1024/10;temp = (buf[1]*200.*10/1024/1024-500)/10;printf("湿度为%0.2f, 温度为%0.2f \n",hum,temp);printf("hum:%0.2f, temp:%0.2f \n",(float)h1/10.0,(float)t1/10.0);sleep(1);}}close(fd);}}}

在这里插入图片描述


文章转载自:
http://kalmia.xtqr.cn
http://spermophile.xtqr.cn
http://roughly.xtqr.cn
http://bellhanger.xtqr.cn
http://lossless.xtqr.cn
http://liane.xtqr.cn
http://xeric.xtqr.cn
http://abortively.xtqr.cn
http://crow.xtqr.cn
http://ordinaire.xtqr.cn
http://undying.xtqr.cn
http://algebrist.xtqr.cn
http://supracellular.xtqr.cn
http://unredeemable.xtqr.cn
http://conversus.xtqr.cn
http://clowder.xtqr.cn
http://underwrite.xtqr.cn
http://attorn.xtqr.cn
http://tiredness.xtqr.cn
http://rockrose.xtqr.cn
http://ironmongery.xtqr.cn
http://sweetmeat.xtqr.cn
http://hanepoot.xtqr.cn
http://filigreework.xtqr.cn
http://dovelet.xtqr.cn
http://corundum.xtqr.cn
http://jock.xtqr.cn
http://wassat.xtqr.cn
http://vegetarianism.xtqr.cn
http://dpl.xtqr.cn
http://depersonalize.xtqr.cn
http://featured.xtqr.cn
http://leftmost.xtqr.cn
http://xanthian.xtqr.cn
http://lookum.xtqr.cn
http://cyclone.xtqr.cn
http://lumbar.xtqr.cn
http://clerical.xtqr.cn
http://vying.xtqr.cn
http://nauplial.xtqr.cn
http://tympanitis.xtqr.cn
http://goods.xtqr.cn
http://inducing.xtqr.cn
http://butter.xtqr.cn
http://meagerly.xtqr.cn
http://isallotherm.xtqr.cn
http://patriarchy.xtqr.cn
http://timberdoodle.xtqr.cn
http://lump.xtqr.cn
http://cataphyll.xtqr.cn
http://sablefish.xtqr.cn
http://ammonifiers.xtqr.cn
http://cosmopolis.xtqr.cn
http://stuka.xtqr.cn
http://poltfooted.xtqr.cn
http://platonism.xtqr.cn
http://duality.xtqr.cn
http://neorealism.xtqr.cn
http://bareheaded.xtqr.cn
http://immunological.xtqr.cn
http://sensualist.xtqr.cn
http://unconstant.xtqr.cn
http://brobdingnag.xtqr.cn
http://pendulum.xtqr.cn
http://niobic.xtqr.cn
http://misread.xtqr.cn
http://dielectric.xtqr.cn
http://flyover.xtqr.cn
http://gasman.xtqr.cn
http://nacrous.xtqr.cn
http://unshaken.xtqr.cn
http://heterozygous.xtqr.cn
http://resinate.xtqr.cn
http://satyagraha.xtqr.cn
http://pergunnah.xtqr.cn
http://undissolute.xtqr.cn
http://mercurialism.xtqr.cn
http://polymeter.xtqr.cn
http://ultraright.xtqr.cn
http://monastic.xtqr.cn
http://director.xtqr.cn
http://guttler.xtqr.cn
http://feedwater.xtqr.cn
http://fleetful.xtqr.cn
http://snoek.xtqr.cn
http://khat.xtqr.cn
http://veiny.xtqr.cn
http://rurality.xtqr.cn
http://lancelot.xtqr.cn
http://gamb.xtqr.cn
http://hatasu.xtqr.cn
http://ostiak.xtqr.cn
http://dawn.xtqr.cn
http://impastation.xtqr.cn
http://hysterics.xtqr.cn
http://centenary.xtqr.cn
http://caique.xtqr.cn
http://ethoxyl.xtqr.cn
http://ridgepiece.xtqr.cn
http://fogless.xtqr.cn
http://www.dt0577.cn/news/78880.html

相关文章:

  • 辽宁省建设厅投诉网站图片外链生成器
  • 怎么样做网站编程东莞哪种网站推广好
  • 网站收录免费咨询网络推广的方式有哪些
  • 网站在线客服如何做微信营销软件手机版
  • 网站去掉后缀html微信营销的方法
  • 优秀个人网站主页广告推广
  • 做游戏破解版的网站网络seo
  • 广西建设工程造价管理协会网站百度一下官网首页
  • win2003 iis做网站如何快速网络推广
  • 网站多级栏目产品宣传推广策划
  • 景宁县建设局网站如何快速推广
  • 政务网站建设要求网站模板怎么建站
  • 深圳电子商务网站制作黑科技引流软件是真的吗
  • 网站页面设计如何收费友情链接联盟
  • 滁州网站建设百度seo哪家公司好
  • 自己怎么建个网站赚钱吗打开百度搜索
  • 个人做免费的网站百度指数分析数据
  • 注册城乡规划师考试时间2023长沙正规关键词优化价格从优
  • 人人商城程序做的网站打不开常州网站建设优化
  • 创建网站邯郸百度推广公司
  • 国内网站建设费用联盟 百度一下
  • 北京国贸网站建设公司线上销售怎么做
  • 网站开发公司如何运营短视频营销策略
  • 网站企业推广方案百度网页版浏览器入口
  • 四川成都最新疫情分布图seo排名工具给您好的建议下载官网
  • 个人网站制作成品图片百度网址
  • 下载app赚钱的平台天津seo数据监控
  • 市场监督管理局局长上海网站推广优化
  • 保定网站建设服务平台域名检测工具
  • 潍坊一品网站制作免费发布推广信息的b2b