標(biāo)題: STM32英文版ADC編程思路 [打印本頁(yè)]

作者: Cliff    時(shí)間: 2018-1-10 21:51
標(biāo)題: STM32英文版ADC編程思路
STM32平臺(tái)完成一次ADC芯片的編程的過(guò)程對(duì)于一個(gè)菜鳥來(lái)說(shuō)實(shí)在可怕
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;
附錄一個(gè)菜鳥初次編程的ADC

ads1242.pdf

1.09 MB, 下載次數(shù): 16, 下載積分: 黑幣 -5

你大可一試的ADC芯片


作者: wyh5360    時(shí)間: 2018-1-11 11:50
謝謝分享謝謝分享aaaaaaaaaa
作者: wyh5360    時(shí)間: 2018-1-11 11:51
謝謝分享謝謝分享樓主




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1