-
ARM 엠베드 MBED 백색잡음 White Noise 생성개발 팁/Embedded 2017. 11. 12. 04:26반응형
백색 잡음 White Noise를 생성하는 방법은 여러가지가 있으나, 여기서는 AnalogIn floating 잡음을 이용하는 방법을 사용한다.
1) AnalogIn Floting 잡음 소스는 다음과 같다.
#include "mbed.h"AnalogIn ADC16(A5);AnalogOut DAC18(DAC0_OUT);// main() runs in its own thread in the OSint main( void ) {uint16_t noise;uint32_t randn, mask = 0;mask = (1 << 16) - 1; // 16-bit mask to reduce 32-bit to 16-bitrandn = ADC16.read_u16(); // read floating pin voltage (seed) on DIP16// randn = ADC16.read_u16(); // read floating pin voltage (seed) on DIP16while(1){randn ^= randn << 13; // bit-shift to create random numbers from seedrandn ^= randn >> 17;randn ^= randn << 5;noise = randn & mask; // convert 32-bit uint to 16-bitDAC18.write_u16(noise);}}2) 회로 구성은 다음과 같다.
AnalogOut -> 스피커 +
GND -> 스피커 -
(Amp가 있는 스피커면 3.3V 혹은 5V 전원을 Acc에 추가로 연결한다)
출처 및 관련 정보
WhiteNoiseGenerator, https://github.com/4EA/WhiteNoiseGenerator/blob/master/Main.cpp
반응형'개발 팁 > Embedded' 카테고리의 다른 글
ARM9 assembly 어셈블리 source - SourceInsight 소스인사이트 파싱 Parsing File(CLF) (0) 2017.11.13 ARM MBED 엠베드 7 세그먼트(Grove 4-Digit Display) 구동 방법 (0) 2017.11.12 ARM MBED 엠베드 핀이름 헤더 파일 찾기 (0) 2017.11.12 ARM MBED 엠베드 음악 연주하기 (내장 DAC 사용) (0) 2017.11.12 임베디드 구현을 위한 음계 주파수 옥타브 정보 (0) 2017.11.12