1.4 haas506开发教程-driver-ADC

haas506开发教程-driver-ADC

1.硬件图

在这里插入图片描述

2.板载ADC

(1)案例说明
  Haas506开发板有两个ADC接口,可以使用板载ADC接口进行数据测量。
(2)main.py

# coding=utf-8
# This is a sample Python script.
from driver import ADC
import utime as time
print("-------------------start adc test--------------------")
adc0 = ADC()
adc1=ADC()
for i in range(100):
    time.sleep(2)
    adc0.open("ADC0")
    adc1.open("ADC1")
    value0=adc0.read()
    value1=adc1.read()
    print("values of adc0 and adc1 ",value0,value1)
    adc0.close()
    adc1.close()
print("-------------------end adc test--------------------")

(3)board.json

{
"version": "1.0.0",
"io": {
    "ADC0": {
            "type": "ADC",
            "port": 0,
            "sampling": 12000000
        },
    "ADC1": {
              "type": "ADC",
              "port": 1,
              "sampling": 12000000
        }
    },
"debugLevel": "DEBUG"
}

3.日志

-------------------start adc test-------------------
values of adc0 and adc1 : 279 225
values of adc0 and adc1 : 242 1
values of adc0 and adc1 : 225 231
values of adc0 and adc1 : 222 236
values of adc0 and adc1 : 355 2287
values of adc0 and adc1 : 961 3184
values of adc0 and adc1 : 3184 2820
values of adc0 and adc1 : 3184 1522
values of adc0 and adc1 : 3184 843
values of adc0 and adc1 : 3184 501
...
-------------------end adc test---------------------

4.总结

  本节介绍了如何使用haas506的driver库的ADC模块,进行数据测量。注意所测得的数据的单位是mv(毫伏)。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值