基于fpga 对sgm58031进行数据读取

最近项目上用到了sgm58031这款芯片,经过两天时间的调试,成功实现了对于该芯片的读取和相关配置。

sgm58031是圣邦微的一款4通道输入ADC芯片,芯片地址为1001000,读操作为1,写操作为0,即写操作为90h,读操作为91h,本项目需要对其1、2通道数据进行读取,阅读手册发现,需要先配置相关的寄存器进行通道切换。

Write to Config Register:
First byte: 0b10010000 (first 7-bit I 2 C address followed
by a low read/write bit)
Second byte: 0b00000001 (points to Config register)
Third byte: 0b10000100 (MSB of the Config register to
be written)
Fourth byte: 0b10000011 (LSB of the Config register to
be written)
Write to Pointer Register:
First byte: 0b10010000 (first 7-bit I 2 C address followed
by a low read/write bit)
Second byte: 0b00000000 (points to Conversion
register)
Read Conversion Register:
First byte: 0b10010001 (first 7-bit I 2 C address followed
by a high read/write bit)
Second byte: the SGM58031 response with the MSB of
the Conversion register
Third byte: the SGM58031 response with the LSB of the Conversion register

 状态寄存器具体对应需参照该芯片数据手册,具体操作流程如下:

c5h对应第一个单端输入通道,d5h对应第二个单端输入通道,对两个通道进行读取时需要按上面流程进行切换,具体iic实现代码较为简单 。

输出计算为:x/32768 * 2.048

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值