Hackaday.io上的示波器项目-Arduino示波器:688000个样本/秒
收藏
分享
脑图
Hackaday.io上的示波器项目-Arduino示波器:688000个样本/秒
关于项目
项目描述:arduino 库支持在到期时约 13 KHz 的 A/D 转换,对于有用的音频速率示波器来说速度不够快。重写 acqusion 环路以直接访问 ADC 寄存器可将转换(包括环路开销)速度加快至约 688,000 个采样/秒,这是一个相当大的改进。
项目图片
项目详情
arduino 库支持约 13 KHz 的 A/D 转换,对于有用的音频速率示波器来说速度不够快。重写 acqusion 环路以直接访问 ADC reqister 可将转换速度(包括环路开销)速度加快至约 688,000 个采样/秒,这是一个相当大的改进。采样循环变得相当短。如果我们定义寄存器和常量如下
#define ADC_MR * (volatile unsigned int *) (0x400C0004) /*adc mode word*/
#define ADC_CR * (volatile unsigned int *) (0x400C0000) /*write a 2 to start convertion*/
#define ADC_ISR * (volatile unsigned int *) (0x400C0030) /*status reg -- bit 24 is data ready*/
#define ADC_ISR_DRDY 0x01000000
#define ADC_START 2
#define ADC_LCDR * (volatile unsigned int *) (0x400C0020) /*last converted low 12 bits*/
#define ADC_DATA 0x00000FFF
然后示例循环变为
ADC_CR = ADC_START ;
for (i=0; i<320; i++){
// Wait for end of conversion
while (!(ADC_ISR & ADC_ISR_DRDY));
// Read the value
analog_data[i] = ADC_LCDR & ADC_DATA ;
// start next
ADC_CR = ADC_START ;
}
有关 TFT 显示连接,请参阅Adafruit 教程,并查阅上面的源代码。我用下面的行在文件中注释出来。
//#define USE_ADAFRUIT_SHIELD_PINOUT
Adafruit_TFTLCD.h
// The control pins for the LCD can be assigned to any digital or
// analog pins...but we'll use the analog pins as this allows us to
// double up the pins with the touch screen (see the TFT paint example).
#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0
#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin
// With shield defined (from pin_magic.h)
// LCD Data Bit : 7 6 5 4 3 2 1 0 (LCD data pin)
// Due pin # : 7 6 13 4 11 10 9 8 (board pin #)
轻微重写显示周期输入波的频率每秒钟。
相关列表

评论

0 / 100
查看更多
Sen
2020-08-21
823
硬禾服务号
关注最新动态
0512-67862536
info@eetree.cn
江苏省苏州市苏州工业园区新平街388号腾飞创新园A2幢815室
苏州硬禾信息科技有限公司
Copyright © 2023 苏州硬禾信息科技有限公司 All Rights Reserved 苏ICP备19040198号