官方例程里面给出了一个ADC采样的示例代码,使用定时器的频率来控制采样的,我的困惑是ADC最高的采样频率有多高?也就是tim = pyb.Timer(8, freq=10)中freq最大可以设置为多高?
adc = pyb.ADC(pyb.Pin("P6")) # create an ADC on pin P6
tim = pyb.Timer(8, freq=10) # create a timer running at 10Hz
buf = bytearray(1000) # creat a buffer to store the samples
adc.read_timed(buf, tim) # sample 100 values, taking 10simport pyb
import time
clock = time.clock()
adc = pyb.ADC(pyb.Pin("P6")) # create an ADC on pin P6
while True:
clock.tick()
value = adc.read()
print(clock.fps(), value)我用这个代码,大概是20kHZ