Electric Game Summary (ii)--AD chip summary of the audio processing chip ADC8009

Source: Internet
Author: User

First, the characteristic parameter

1, dedicated to audio processing of the ad chip

2, internal fixed 8K sample rate

3, 8-bit AD chip

Second, the internal structure diagram

Three, Chip pin diagram

Four, the PIN function description
Pin Name Function
In0~in7 Data-Entry
Abc Data input port Selection
St

ST is the conversion start signal. When the St jumps along, all internal registers clear 0, the lower jump edge, the start of A/D conversion, during the conversion, ST should remain low level.

EOC

The EOC signals the end of the conversion. When the EOC is high, it indicates that the conversion is over; otherwise, a A/D conversion is in progress

Oe

The OE outputs allow signals to control the data obtained from the three output latches to the microcontroller output. oe=1, output conversion data, oe=0, output data line is high-impedance state. The d7-d0 is a digital output line.

D7-d0 Digital output Line
Dl

Clock input signal line. Because there is no clock circuit inside the ADC0809, the required clock signal must be supplied by the outside world, usually using a frequency of 500KHZ

VREF (+) Reference voltage Input Positive
VREF (-) Reference voltage Input Negative

V. Stm32f103ze Driver
#include"stm32f10x.h"#defineCLK gpio_pin_0//#define B gpio_pin_1//#define C gpio_pin_2#defineALE Gpio_pin_4//#define IN0 Gpio_pin_4#defineST Gpio_pin_5#defineOE Gpio_pin_6//#define A gpio_pin_7#defineD0 gpio_pin_0#defineD1 gpio_pin_1#defineD2 gpio_pin_2#defineD3 Gpio_pin_3#defineD4 Gpio_pin_4#defineD5 Gpio_pin_5#defineD6 Gpio_pin_6#defineD7 gpio_pin_7#defineEOC Gpio_pin_8DoubleVal=0;voiddelay (u32 kk) { while(kk--);}/*Const unsigned short clk= gpio_pin_0;const unsigned short b=gpio_pin_1;const unsigned short c=gpio_pin_2;const unsign Ed Short ale=gpio_pin_3;const unsigned short in0=gpio_pin_4;const unsigned short st=gpio_pin_5;const unsigned short oe=gp Io_pin_6;const unsigned short a=gpio_pin_7;const unsigned short d0=gpio_pin_0;const unsigned short d1=gpio_pin_1;const unsigned short d2=gpio_pin_2;const unsigned short d3=gpio_pin_3;const unsigned short d4=gpio_pin_4;const unsigned short D 5=gpio_pin_5;const unsigned short d6=gpio_pin_6;const unsigned short d7=gpio_pin_7;const unsigned short eoc=gpio_pin_8; */voidAd_init () {gpio_inittypedef gpio_initstructure;        Rcc_apb2periphclockcmd (Rcc_apb2periph_gpioa, ENABLE); Gpio_initstructure.gpio_pin= gpio_pin_0| gpio_pin_1| gpio_pin_2| gpio_pin_3| gpio_pin_4| gpio_pin_5| gpio_pin_6| gpio_pin_7|Gpio_pin_8; Gpio_initstructure.gpio_mode=gpio_mode_out_pp; Gpio_initstructure.gpio_speed=Gpio_speed_50mhz; Gpio_init (Gpioa,&gpio_initstructure);    Rcc_apb2periphclockcmd (Rcc_apb2periph_gpiob, ENABLE); Gpio_initstructure.gpio_pin= gpio_pin_0| gpio_pin_1| gpio_pin_2| gpio_pin_3| gpio_pin_4| gpio_pin_5| gpio_pin_6| gpio_pin_7|Gpio_pin_8; Gpio_initstructure.gpio_mode=gpio_mode_in_floating; Gpio_initstructure.gpio_speed=Gpio_speed_50mhz; Gpio_init (GPIOB,&gpio_initstructure); Gpio_resetbits (Gpioa, ALE);//gpio_resetbits (Gpioa, A);//gpio_resetbits (Gpioa, B);//gpio_resetbits (Gpioa, C); //Delay (ten);gpio_setbits (Gpioa, ALE); //CLK}voidAdc0809_input () {//st2úéúé?éy?? Oí??? μ??gpio_resetbits (Gpioa, ST); Delay (Ten);    Gpio_setbits (GPIOA,ST); Delay (Ten);    Gpio_resetbits (Gpioa, ST); Delay (Ten);  while(Gpio_readinputdatabit (GPIOB, EOC) = =0);    Gpio_setbits (Gpioa,oe); Val=gpio_readinputdatabit (GPIOB, D0) *0x0001+gpio_readinputdatabit (GPIOB, D1)*0x0002+gpio_readinputdatabit (GPIOB, D2)*0x0004+gpio_readinputdatabit (GPIOB, D3)*0x0008+gpio_readinputdatabit (GPIOB, D4)*0x0010+gpio_readinputdatabit (GPIOB, D5)*0x0020+gpio_readinputdatabit (GPIOB, D6)*0x0040+gpio_readinputdatabit (GPIOB, D7)*0x0080;        Gpio_resetbits (Gpioa,oe); //val=val*2*0.98;}voidTimer_init ()//? ¨ê±?÷? D??????{nvic_inittypedef nvic_initstructure; //????? D??? Á11Tim_timebaseinittypedef tim_timebasestructure;    Rcc_apb2periphclockcmd (Rcc_apb2periph_gpioa, ENABLE);                 Rcc_apb1periphclockcmd (RCC_APB1PERIPH_TIM3, ENABLE);                     Nvic_prioritygroupconfig (NVIC_PRIORITYGROUP_0); //????? Ú2?ê±?óNvic_initstructure.nvic_irqchannel=tim3_irqn; Nvic_initstructure.nvic_irqchannelpreemptionpriority=0; Nvic_initstructure.nvic_irqchannelsubpriority=0; Nvic_initstructure.nvic_irqchannelcmd=ENABLE; Nvic_init (&nvic_initstructure);//? ¨ê±?÷3μ?? D?? 3?ê?? ˉtTim_timebasestructure.tim_period= -;//Ó??? Ò? Ddó????? O?£?μ¥??? Úê±?ód?o??? È?? E???? Ê?72mhz£??? 10000?a?? Êy?éò?éè??? D?? ʱ??Tim_timebasestructure.tim_prescaler= the;//? Addò2?éò??? £?μ?ê?? Aá?êy? Y????? 3t£?? 1ê?é?ò? Dd?? °ù?? °ùμ??? ±è?? O?tim_timebasestructure.tim_clockdivision=Tim_ckd_div1; Tim_timebasestructure.tim_countermode=tim_countermode_up; Tim_timebaseinit (TIM3,&tim_timebasestructure); Tim_itconfig (Tim3,tim_it_update|tim_it_trigger,enable);    Tim_cmd (TIM3, ENABLE); }intI=1;voidTim3_irqhandler () {if(Tim_getitstatus (tim3,tim_it_update)!=reset)//è? ¨?? È?á?? A??? D??{tim_clearitpendingbit (TIM3, tim_it_update); //    ?? 3y±ê?? £?±£??? E?? Òa?óAdc0809_input (); if(i==1) {gpio_setbits (Gpioa, gpio_pin_8); I=0; }                Else{i=1;        Gpio_resetbits (Gpioa, gpio_pin_8); }  }}voidAdc0809_clock () {tim_timebaseinittypedef tim_timebasestructure;     Tim_ocinittypedef tim_ocinitstructure;          Gpio_inittypedef gpio_initstructure;  Rcc_apb1periphclockcmd (rcc_apb1periph_tim2, ENABLE); Rcc_apb2periphclockcmd (Rcc_apb2periph_gpioa|Rcc_apb2periph_afio, ENABLE); Gpio_initstructure.gpio_pin=gpio_pin_0; Gpio_initstructure.gpio_mode=gpio_mode_af_pp; Gpio_initstructure.gpio_speed=Gpio_speed_50mhz; Gpio_init (Gpioa,&gpio_initstructure); //PWM--->100hzTim_timebasestructure.tim_period=Ten; Tim_timebasestructure.tim_prescaler= A; Tim_timebasestructure.tim_clockdivision=Tim_ckd_div1; Tim_timebasestructure.tim_countermode=tim_countermode_up; Tim_timebaseinit (TIM2,&tim_timebasestructure); //  //PA6--->50%//?????Tim_ocinitstructure.tim_ocmode=tim_ocmode_pwm1; Tim_ocinitstructure.tim_outputstate=tim_outputstate_enable; Tim_ocinitstructure.tim_pulse=5;//Pulse???? Period??????Tim_ocinitstructure.tim_outputstate=tim_outputstate_enable; Tim_ocinitstructure.tim_ocpolarity=Tim_ocpolarity_high; Tim_oc1init (TIM2,&tim_ocinitstructure); //  //PA7--->40%//tim_ocinitstructure.tim_pulse=40; //Tim_oc2init (TIM3, &tim_ocinitstructure);//  //PB0--->60%//tim_ocinitstructure.tim_pulse=60; //Tim_oc3init (TIM3, &tim_ocinitstructure);//  //PB1--->80%//tim_ocinitstructure.tim_pulse=80; //Tim_oc4init (TIM3, &tim_ocinitstructure);tim_cmd (TIM2, ENABLE);}intMain () {ad_init ();     Gpio_setbits (Gpioa, gpio_pin_3);       Adc0809_clock ();                   Timer_init ();  while(1)        {                }}

Electric Game Summary (ii)--AD chip summary of the audio processing chip ADC8009

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.