找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2511|回复: 2
收起左侧

STM32英文版ADC编程思路

[复制链接]
ID:274548 发表于 2018-1-10 21:51 | 显示全部楼层 |阅读模式
STM32平台完成一次ADC芯片的编程的过程对于一个菜鸟来说实在可怕
Power-up;

Delayto allow power supplies to settle and power-up reset to complete (minimum of 50µs);

Configurethe SPI interface of the stm32 to SPI mode 1 (CPOL = 0, CPHA = 1);

Ifthe CS pin is not tied low permanently, configure the stm32 GPIO connected toCS as an

output;

Configurethe stm32 GPIO connected to the DRDY pin as a falling edge triggered interrupt

input;

SetCS to the device low;

Delayfor a minimum of td(CSSC);

Sendthe RESET command (06h) to make sure the device is properly reset afterpower-up;

Delayfor a minimum of 50 µs + 32 · t(CLK);

Writethe respective register configuration with the WREG command (43h, 08h, 04h,10h, and 00h);

Asan optional sanity check, read back all configuration registers with the RREGcommand (23h);

Sendthe START/SYNC command (08h) to start converting in continuous conversion mode;

Delayfor a minimum of td(SCCS);

ClearCS to high (resets the serial interface);

Loop

{

Waitfor DRDY to transition low;

TakeCS low;

Delayfor a minimum of td(CSSC);

Send24 SCLK rising edges to read out conversion data on DOUT/DRDY;

Delayfor a minimum of td(SCCS);

ClearCS to high;

}

TakeCS low;

Delayfor a minimum of td(CSSC);

Sendthe POWERDOWN command (02h) to stop conversions and put the device in power-downmode;

Delayfor a minimum of td(SCCS);

ClearCS to high;
附录一个菜鸟初次编程的ADC

ads1242.pdf

1.09 MB, 下载次数: 16, 下载积分: 黑币 -5

你大可一试的ADC芯片

评分

参与人数 2黑币 +55 收起 理由
DX3906 + 5 很给力!
admin + 50 共享资料的黑币奖励!

查看全部评分

回复

使用道具 举报

ID:274730 发表于 2018-1-11 11:50 | 显示全部楼层
谢谢分享谢谢分享aaaaaaaaaa
回复

使用道具 举报

ID:274730 发表于 2018-1-11 11:51 | 显示全部楼层
谢谢分享谢谢分享楼主
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表