cancel
Showing results for 
Search instead for 
Did you mean: 

ADC - str7 library

sjo
Associate II
Posted on September 23, 2004 at 12:04

ADC - str7 library

2 REPLIES 2
sjo
Associate II
Posted on September 23, 2004 at 09:26

STR7 Gurus,

Another query regarding the str7lib

The adc lib function uses the formula:

PRESCALER = APB2_FREQ / (SAMPLE_FREQ * 512 * 4)

to calculate the prescaler.

The datasheet states that the result from the above formula must be halved

APB2_FREQ = 16MHz

SAMPLE_FREQ= 500Hz

PRESCALER= 16M/(500*512*4)

PRESCALER= 16

according to datasheet (page371 v3.0) the precaling factor must be 8 to obtain a prescaler of 16.

which is correct ?

So far I have been very impressed with the str7, but I must put my comments regarding the adc - its really bad.

I have just realised all conversions require calibrating for offset/gain errors, after just spending a few hours diagnosing really strange conversion results.

Are there any good tips on the adc for the str7?

Regards

sjo
hichem2
Associate II
Posted on September 23, 2004 at 12:04

Hi, sjo

I agree with you concerning your remark;

The result mentioned in the datasheet is the correct one and the formula used in the ADC lib to compute the prescaler must be replaced by the following one:

PRESCALER = APB2_FREQ / (SAMPLE_FREQ * 512 * 😎 .

Best Regards

Hich

[ This message was edited by: Hich on 23-09-2004 15:44 ]

[ This message was edited by: Hich on 23-09-2004 15:45 ]