Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > Программная инженерия > Микроконтроллеры, робототехника, схемотехника, 3D принтеры
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 15.08.2016, 15:23   #31
p51x
Старожил
 
Регистрация: 15.02.2010
Сообщений: 15,709
По умолчанию

вникаете дальше
Цитата:
*** Execution of ADC conversions ***
=================================== =================================== ========
[..]
(#) ADC driver can be used among three modes: polling, interruption,
transfer by DMA.

*** Polling mode IO operation ***
=================================
[..]
(+) Start the ADC peripheral using HAL_ADC_Start()
(+) Wait for end of conversion using HAL_ADC_PollForConversion(), at this stage
user can specify the value of timeout according to his end application
(+) To read the ADC converted values, use the HAL_ADC_GetValue() function.
(+) Stop the ADC peripheral using HAL_ADC_Stop()

*** Interrupt mode IO operation ***
===================================
[..]
(+) Start the ADC peripheral using HAL_ADC_Start_IT()
(+) Use HAL_ADC_IRQHandler() called under ADC_IRQHandler() Interrupt subroutine
(+) At ADC end of conversion HAL_ADC_ConvCpltCallback() function is executed and user can
add his own code by customization of function pointer HAL_ADC_ConvCpltCallback
(+) In case of ADC Error, HAL_ADC_ErrorCallback() function is executed and user can
add his own code by customization of function pointer HAL_ADC_ErrorCallback
(+) Stop the ADC peripheral using HAL_ADC_Stop_IT()

*** DMA mode IO operation ***
==============================
[..]
(+) Start the ADC peripheral using HAL_ADC_Start_DMA(), at this stage the user specify the length
of data to be transferred at each end of conversion
(+) At The end of data transfer by HAL_ADC_ConvCpltCallback() function is executed and user can
add his own code by customization of function pointer HAL_ADC_ConvCpltCallback
(+) In case of transfer Error, HAL_ADC_ErrorCallback() function is executed and user can
add his own code by customization of function pointer HAL_ADC_ErrorCallback
(+) Stop the ADC peripheral using HAL_ADC_Stop_DMA()

*** ADC HAL driver macros list ***
=================================== ==========
[..]
Below the list of most used macros in ADC HAL driver.

(+) __HAL_ADC_ENABLE : Enable the ADC peripheral
(+) __HAL_ADC_DISABLE : Disable the ADC peripheral
(+) __HAL_ADC_ENABLE_IT: Enable the ADC end of conversion interrupt
(+) __HAL_ADC_DISABLE_IT: Disable the ADC end of conversion interrupt
(+) __HAL_ADC_GET_IT_SOURCE: Check if the specified ADC interrupt source is enabled or disabled
(+) __HAL_ADC_CLEAR_FLAG: Clear the ADC's pending flags
(+) __HAL_ADC_GET_FLAG: Get the selected ADC's flag status
(+) ADC_GET_RESOLUTION: Return resolution bits in CR1 register

[..]
(@) You can refer to the ADC HAL driver header file for more useful macros

*** Deinitialization of ADC ***
=================================== =================================== ========
[..]
(#) Disable the ADC interface
(++) ADC clock can be hard reset and disabled at RCC top level.
(++) Hard reset of ADC peripherals
using macro __HAL_RCC_ADC_FORCE_RESET(), __HAL_RCC_ADC_RELEASE_RESET().
(++) ADC clock disable using the equivalent macro/functions as configuration step.
(+++) Example:
Into HAL_ADC_MspDeInit() (recommended code location) or with
other device clock parameters configuration:
(+++) HAL_RCC_GetOscConfig(&RCC_OscInitSt ructure);
(+++) RCC_OscInitStructure.OscillatorType = RCC_OSCILLATORTYPE_HSI;
(+++) RCC_OscInitStructure.HSIState = RCC_HSI_OFF; (if not used for system clock)
(+++) HAL_RCC_OscConfig(&RCC_OscInitStruc ture);

(#) ADC pins configuration
(++) Disable the clock for the ADC GPIOs using macro __HAL_RCC_GPIOx_CLK_DISABLE()

(#) Optionally, in case of usage of ADC with interruptions:
(++) Disable the NVIC for ADC using function HAL_NVIC_DisableIRQ(ADCx_IRQn)

(#) Optionally, in case of usage of DMA:
(++) Deinitialize the DMA using function HAL_DMA_DeInit().
(++) Disable the NVIC for DMA using function HAL_NVIC_DisableIRQ(DMAx_Channelx_I RQn)
p51x вне форума Ответить с цитированием
Старый 15.08.2016, 15:25   #32
RAFA91
Заблокирован
 
Регистрация: 06.02.2011
Сообщений: 1,999
По умолчанию

если предлагаете черпать инфу с сишных или заголовочных файлах то

это не самый лучший вариант. там всех тонкостей не опишешь.
RAFA91 вне форума Ответить с цитированием
Старый 15.08.2016, 15:25   #33
p51x
Старожил
 
Регистрация: 15.02.2010
Сообщений: 15,709
По умолчанию

Например, берем функцию HAL_ADC_Init
Код:
/**
  * @brief  Initializes the ADCx peripheral according to the specified parameters 
  *         in the ADC_InitStruct and initializes the ADC MSP.
  *           
  * @note   This function is used to configure the global features of the ADC ( 
  *         ClockPrescaler, Resolution, Data Alignment and number of conversion), however,
  *         the rest of the configuration parameters are specific to the regular
  *         channels group (scan mode activation, continuous mode activation,
  *         External trigger source and edge, DMA continuous request after the  
  *         last transfer and End of conversion selection).
  *             
  * @param  hadc: pointer to a ADC_HandleTypeDef structure that contains
  *         the configuration information for the specified ADC.  
  * @retval HAL status
  */
HAL_StatusTypeDef HAL_ADC_Init(ADC_HandleTypeDef* hadc)
Цитата:
если предлагаете черпать инфу с сишных или заголовочных файлах то

это не самый лучший вариант
это правильный вариант

Цитата:
там всех тонкостей не опишешь
Для тонкостей есть даташит, еррата и дока по работе с конкретной периферией.
p51x вне форума Ответить с цитированием
Старый 15.08.2016, 15:28   #34
RAFA91
Заблокирован
 
Регистрация: 06.02.2011
Сообщений: 1,999
По умолчанию

это не самое лучшее описание
Изображения
Тип файла: jpg Безымянный.JPG (110.7 Кб, 162 просмотров)
RAFA91 вне форума Ответить с цитированием
Старый 15.08.2016, 15:30   #35
p51x
Старожил
 
Регистрация: 15.02.2010
Сообщений: 15,709
По умолчанию

Чем оно вас не устраивает?
p51x вне форума Ответить с цитированием
Старый 15.08.2016, 15:40   #36
RAFA91
Заблокирован
 
Регистрация: 06.02.2011
Сообщений: 1,999
По умолчанию

из этого много информации не вытянешь.


тем более за одним файлом подвязано еще 20.

в строке

**
* @brief GPIO Init structure definition
*/

стоит символ @ - значит все это сливается в какую-то справочную инфу.

как ее нарыть в EmBitz 0.42 ?
RAFA91 вне форума Ответить с цитированием
Старый 15.08.2016, 15:43   #37
p51x
Старожил
 
Регистрация: 15.02.2010
Сообщений: 15,709
По умолчанию

Цитата:
как ее нарыть в EmBitz 0.42 ?
Узнать поддерживает ли оно доксиген и где. Если нет, взять доксиген и сгенерить.
p51x вне форума Ответить с цитированием
Старый 15.08.2016, 15:58   #38
RAFA91
Заблокирован
 
Регистрация: 06.02.2011
Сообщений: 1,999
По умолчанию

STM32F103C8 на прямую через регистры программируют ?
RAFA91 вне форума Ответить с цитированием
Старый 15.08.2016, 16:01   #39
p51x
Старожил
 
Регистрация: 15.02.2010
Сообщений: 15,709
По умолчанию

Все они программируется через регистры. Все функции и структуры лишь более-менее удобные обертки над ними.
p51x вне форума Ответить с цитированием
Старый 15.08.2016, 16:08   #40
RAFA91
Заблокирован
 
Регистрация: 06.02.2011
Сообщений: 1,999
По умолчанию

нужно ли знать назначение каждого регистра в этих мк?
RAFA91 вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
stm32 irq9_5 и одна из линий p51x Микроконтроллеры, робототехника, схемотехника, 3D принтеры 0 25.06.2016 19:39
Литература для начинающих по программированию STM32 Astradam Микроконтроллеры, робототехника, схемотехника, 3D принтеры 2 25.04.2016 11:08
Портировать проект GCC(ATxMEGA) в среду KEIL(STM32) AgasferCNC Фриланс 0 03.04.2015 12:35
asm и arm(stm32) evilboy Помощь студентам 0 03.06.2012 20:42
Халявный STM32 Discovery ??? gefest58 Свободное общение 3 22.04.2011 16:33