自己之前做的一个示波器,只用了LCD的底层驱动,没用系统及GUI 将C文件替换到固件包的STM32F429I-Discovery_FW_V1.0.1\Projects\Template下,运行即可 代码贴上看看: /** ****************************************************************************** * @file ADC_TripleModeInterleaved/main.c * @author MCD Application Team * @version V1.0.1 * @date 11-November-2013 * @brief This example provides a short description of how to use the ADC * peripheral to convert a regular channel in Triple interleaved mode * using DMA in mode 2 with 8.4Msps . ****************************************************************************** * @attention * * © COPYRIGHT 2013 STMicroelectronics * * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); * You may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.st.com/software_license_agreement_liberty_v2 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "main.h" #include /** @addtogroup STM32F429I_DISCOVERY_Examples * @{ */ /** @addtogroup ADC_TripleModeInterleaved * @{ */ /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ #define MESSAGE1 " Triple ADC Interleaved " #define MESSAGE1_1 " DMA mode2 example " #define MESSAGE2 " ADC Ch13 Conv " #define MESSAGE2_1 " 8.4Msps " #define MESSAGE3 "Connect voltage " #define MESSAGE4 "to ADC Ch13 " #define MESSAGE5 " ADC1 = %d,%d V" #define MESSAGE6 " ADC2 = %d,%d V" #define MESSAGE7 " ADC3 = %d,%d V" #define LINENUM 0x15 #define FONTSIZE Font8x12 uint8_t aTextBuffer[50]; int ADC_Value[4096]; int ADC_ValueSec[4096]; int i=0; int Zero[8] = {0,0,0,0,0,0,0,0}; int ZeroFlag = 1; /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ __IO uint32_t uhADCTripleConvertedValue[3]; /* Private function prototypes -----------------------------------------------*/ #ifdef USE_LCD static void Display_Init(void); static void Display(void); void gridon(void); #endif /* USE_LCD */ void DAC_Ch1_Config(void) { GPIO_InitTypeDef GPIO_InitStructure;// DAC_InitTypeDef DAC_InitStructure; RCC_APB1PeriphClockCmd(RCC_APB1Periph_DAC, ENABLE); //?? DCA ?? GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5; //DAC_OUT1=PA.4 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN; //??? AN ?? GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; //?????? GPIO_Init(GPIOA, &GPIO_InitStructure); // ? ? ? ? ? ?GPIOA DAC_InitStructure.DAC_Trigger = DAC_Trigger_Software ; //???? DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None; //????? DAC_InitStructure.DAC_LFSRUnmask_TriangleAmplitude= DAC_TriangleAmplitude_2047;//??? DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Enable; //???? DAC_Init(DAC_Channel_2, &DAC_InitStructure); // ?????? DAC1 DAC_Cmd(DAC_Channel_2, ENABLE); // ?? DAC1 ?? DAC_SetChannel2Data(DAC_Align_12b_R, 1000); //????? 0 DAC_SoftwareTriggerCmd(DAC_Channel_2, ENABLE); ///?????? } void DAC1_SET(unsigned int date) { DAC_SetChannel2Data(DAC_Align_12b_R, date ); //???? DAC_SoftwareTriggerCmd(DAC_Channel_2, ENABLE); //?????? } /* Private functions ---------------------------------------------------------*/ /** * @brief Main program * @param None * @retval None */ /** * @brief ADC configuration * @note This function Configure the ADC peripheral 1) Enable peripheral clocks 2) Configure ADC Channel 13 pin as analog input 3) DMA2_Stream0 channel0 configuration 4) Configure ADC1 Channel 13 5) Configure ADC2 Channel 13 6) Configure ADC3 Channel 13 * @param None * @retval None */ static void GPIO_Configuration(void) { GPIO_InitTypeDef GPIO_InitStructure; RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC,ENABLE); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ; GPIO_Init(GPIOC, &GPIO_InitStructure); } void Gyro_ADC_Configuration(uint8_t ADC_SampleTime_Cycles) { ADC_InitTypeDef ADC_InitStructure; ADC_CommonInitTypeDef ADC_CommonInitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC2, ENABLE); /* ADC Common Init **********************************************************/ ADC_CommonInitStructure.ADC_Mode = ADC_Mode_Independent; ADC_CommonInitStructure.ADC_Prescaler = ADC_Prescaler_Div2; ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled; ADC_CommonInitStructure.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles; ADC_CommonInit(&ADC_CommonInitStructure); /* ADC2 Init ****************************************************************/ ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b; ADC_InitStructure.ADC_ScanConvMode = ENABLE; ADC_InitStructure.ADC_ContinuousConvMode = ENABLE; ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None; ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStructure.ADC_NbrOfConversion = 1; ADC_Init(ADC2, &ADC_InitStructure); ADC_ITConfig(ADC2, ADC_IT_EOC, ENABLE); ADC_RegularChannelConfig(ADC2, ADC_Channel_13, 1, ADC_SampleTime_Cycles); /* Enable ADC2 */ ADC_Cmd(ADC2, ENABLE); /* Start ADC2 Software Conversion */ ADC_SoftwareStartConv(ADC2); } /* Functions --------------------------------------------------------------------------------*/ void ADC_Config(uint8_t ADC_SampleTime_Cycles) { GPIO_Configuration(); Gyro_ADC_Configuration(ADC_SampleTime_Cycles); } uint16_t Get_ADC_Data(void) { while(!(ADC_GetFlagStatus(ADC2, ADC_FLAG_EOC)==SET)); return(ADC_GetConversionValue(ADC2)); } #ifdef USE_LCD /** * @brief Display ADCs converted values on LCD * @param None * @retval None */ static void Display(void) { int delay = 20000,a=1000000000; int i=0,j=0; float ff = 150*4096/255; int tmpMax,tmpMin,cha,div,tmpMaxNum,tmpMinNum,offset,trigger,triggerflag = 0,temp1 = 0,temp2 = 0; int temp1flag = 0,temp2flag = 0; float Vpp; for(i=0;i |
源码没贴完整啊 请详细贴出源码 和操作方法 谢谢了 |
对啊,代码要贴完整才好嘛。。 |
F429 discovery的示波器不错 |
顶一个,Good! |
就是个坑啊~ |
【STM32F429开发日志】汉字显示(取模方式)
【STM32F429开发日志】5.uCOS-ii V2.91 移植OK
图形化玩转Nucleo-STM32F413手机APP远程控制应用开发
【stm32F429开发日志】使用STM32CubeMX配置STM32F429_USB_HID
【STM32F429开发日志】(三)使用STM32Cube开发环境
【STM32F429开发日志】——网络收集的例程分享(包括所有STM32F429Discovery板上外设驱动)
分享个用STM32F429做的网络摄像头
STM32F429UCOS 源代码
【STM32F429开发日志】+hello led(闪烁led灯)
STM32F429DSICOVERY移植到STemWIN(图片+源码)