cancel
Showing results for 
Search instead for 
Did you mean: 

CCO

carnett1
Associate II
Posted on December 14, 2010 at 13:49

has anybody ever used CCO, the configurable Clock Output?  I think I initialized it.  I enabled it.  Everything compiled but I never did anything that would set the frequency.  The output is a high.  Does anyone know of an example or what I should be doing?  I look thru the manuals and nothing seems to help me.  It seems like such a simpe function but it is difficult for me.

charles

2 REPLIES 2
spiovan9
Associate II
Posted on December 16, 2010 at 18:37

 Â»  Â»  Â»  Â»  Â» 

examples/TIM1/TIM1_Input_Capture/main.c

00001

/**

00002

******************************************************************************

00003

* @file TIM1_Input_Capture\main.c

00004

* @brief This file contains the main function for TIM1 Input Capture example.

00005

* @author STMicroelectronics - MCD Application Team

00006

* @version V1.1.1

00007

* @date 06/05/2009

00008

******************************************************************************

00009

*

00010

* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS

00011

* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE

00012

* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY

00013

* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING

00014

* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE

00015

* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.

00016

*

00017

* <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2>

00018

* @image html logo.bmp

00019

******************************************************************************

00020

*/

00021 00022

/* Includes ------------------------------------------------------------------*/

00023

#include ''''

00024 00025

/**

00026

* @addtogroup TIM1_Input_Capture

00027

* @{

00028

*/

00029 00030

/* Private typedef -----------------------------------------------------------*/

00031

/* Private define ------------------------------------------------------------*/

00032

/* Private macro -------------------------------------------------------------*/

00033

/* Private variables ---------------------------------------------------------*/

= 2000000; = 0; =0, =0; 00037

/* Private function prototypes -----------------------------------------------*/

00038

/* Private functions ---------------------------------------------------------*/

00039

/* Public functions ----------------------------------------------------------*/

00040 00041

/**

00042

* @brief Example firmware main entry point.

00043

* @par Parameters:

00044

* None

00045

* @retval

00046

* None

00047

*/

void

(

void

) 00049 { 00050 00051 ( , , , , 0x0); 00052 00053

/* Enable TIM1 */

00054 (); 00055 00056

/* Clear CC1 Flag*/

00057 (); 00058 00059

/* Connect LSI to COO pin*/

00060 (, , ); 00061 (); 00062 (); 00063 00064 00065

/* wait a capture on CC1 */

00066

while

((->SR1 & ) != ); 00067

/* Get CCR1 value*/

00068 = (); 00069 (); 00070 00071

/* wait a capture on cc1 */

00072

while

((->SR1 & ) != ); 00073

/* Get CCR1 value*/

00074 = (); 00075 (); 00076 00077

/* Compute LSI clock frequency */

00078 = (8 * ) / ( - ); 00079 00080

/* Insert a break point here */

00081

while

(1); 00082 } 00083 00084 00085

#ifdef USE_FULL_ASSERT

00086 00087

/**

00088

* @brief Reports the name of the source file and the source line number

00089

* where the assert_param error has occurred.

00090

* @param file: pointer to the source file name

00091

* @param line: assert_param error line source number

00092

* @retval

00093

* None

00094

*/

00095

void

assert_failed(* file, line) 00096 { 00097

/* User can add his own implementation to report the file name and line number,

00098

ex: printf(''Wrong parameters value: file %s on line %d\r\n'', file, line) */

00099 00100

/* Infinite loop */

00101

while

(1) 00102 { 00103 } 00104 } 00105

#endif

00106 00107

/**

00108

* @}

00109

*/

00110 00111

/******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/

spiovan9
Associate II
Posted on December 16, 2010 at 18:41