nterMode_Up; _TimeBaseInit (TIM6, & timer6_base); _SelectOutputTrigger (TIM6, TIM_TRGOSource_Update); TIM_Cmd (TIM6, ENABLE ); }
void USART3_Configuration ( void )
{usart_struct. USART_BaudRate=115200; _struct. USART_WordLength=USART_WordLength_8b; _struct. USART_StopBits=USART_StopBits_1; _struct. USART_Parity=USART_Parity_No; _struct. USART_HardwareFlowControl=USART_HardwareFlowControl_None; _struct. USART_Mode=USART_Mode_Rx | USART_Mode_Tx; _Init (USART3, & usart_struct); _DMACmd (USART3, USART_DMAReq_Tx, ENABLE ); _DMACmd (USART3, USART_DMAReq_Rx, ENABLE ); _Cmd (USART3, ENABLE ); }
Малюнок ПБ.1 - Продовження
void DMA2_Stream0_Chanel0_Configuration ( void )
{DMA_DeInit (DMA2_Stream0); _struct. DMA_Channel=DMA_Channel_0; _struct. DMA_PeripheralBaseAddr=(uint32_t) (& ADC1-> DR); _struct. DMA_Memory0BaseAddr=(uint32_t) buffer; _struct. DMA_DIR=DMA_DIR_PeripheralToMemory; _struct. DMA_BufferSize= sizeof (buffer); _struct. DMA_PeripheralInc=DMA_PeripheralInc_Disable; _struct. DMA_MemoryInc=DMA_MemoryInc_Enable; _struct. DMA_PeripheralDataSize=DMA_PeripheralDataSize_Byte; _struct. DMA_MemoryDataSize=DMA_MemoryDataSize_Byte; _struct. DMA_Mode=DMA_Mode_Circular; _struct. DMA_Priority=DMA_Priority_High; _struct. DMA_FIFOMode=DMA_FIFOMode_Disable; _struct. DMA_FIFOThreshold=DMA_FIFOThreshold_HalfFull; _struct. DMA_MemoryBurst=DMA_MemoryBurst_Single; _struct. DMA_PeripheralBurst=DMA_PeripheralBurst_Single; _Init (DMA2_Stream0, & dma2_struct); _Cmd (DMA2_Stream0, ENABLE );
}
void ADC1_Configuration ( void )
{ADC_DeInit (); _common_init_struct. ADC_Mode=ADC_Mode_Independent;// _common_init_struct. ADC_Prescaler=ADC_Prescaler_Div2; _CommonInit (& adc_common_init_struct); _init_struct. ADC_Resolution=ADC_Resolution_8b; _init_struct. ADC_ScanConvMode= DISABLE ; _init_struct. ADC_ContinuousConvMode= DISABLE ; _init_struct. ADC_ExternalTrigConvEdge=ADC_ExternalTrigConvEdge_Rising; _init_struct. ADC_ExternalTrigConv=ADC_ExternalTrigConv_T2_TRGO; _init_struct. ADC_DataAlign=ADC_DataAlign_Right; _init_struct. ADC_NbrOfConversion=0; _Init (ADC1, & adc1_init_struct); ADC_RegularChannelConfig (ADC1, ADC_Channel_0, 1, ADC_SampleTime_3Cycles); _EnableIRQ ( ADC_IRQn ); _ITConfig (ADC1, ADC_IT_EOC, ENABLE ); _Cmd (ADC1, ENABLE ); }
void DMA1_Stream6_Chanel7_Configuration ( void )
{DMA_DeInit (DMA1_Stream6); _struct. DMA_Channel=DMA_Channel_7; _struct. DMA_PeripheralBaseAddr=(uint32_t) & (DAC-> DHR8R2); _struct. DMA_Memory0BaseAddr=(uint32_t) sin;// Escalator8bit; _struct. DMA_DIR=DMA_DIR_MemoryToPeripheral; _struct. DMA_BufferSize= sizeof (sin);//) Escalator8bit; _struct. DMA_PeripheralInc=DMA_PeripheralInc_Disable; _struct. DMA_Me...