⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dcdc_example.c

📁 含t h r e a d x,u c o s 的b s p
💻 C
字号:
/***********************************************************************
 * $Workfile:   dcdc_example.c  $
 * $Revision:   1.0  $
 * $Author:   WellsK  $
 * $Date:   Jul 01 2003 09:20:06  $
 *
 * Project: DCDC driver example
 *
 * Description:
 *     A simple DCDC converter driver example.
 *
 * Revision History:
 * $Log:   //smaicnt2/pvcs/VM/sharpmcu/archives/sharpmcu/software/csps/lh7a404/bsps/sdk7a404/examples/dcdc/dcdc_example.c-arc  $
 * 
 *    Rev 1.0   Jul 01 2003 09:20:06   WellsK
 * Initial revision.
 * 
 *
 ***********************************************************************
 * SHARP MICROELECTRONICS OF THE AMERICAS MAKES NO REPRESENTATION
 * OR WARRANTIES WITH RESPECT TO THE PERFORMANCE OF THIS SOFTWARE,
 * AND SPECIFICALLY DISCLAIMS ANY RESPONSIBILITY FOR ANY DAMAGES, 
 * SPECIAL OR CONSEQUENTIAL, CONNECTED WITH THE USE OF THIS SOFTWARE.
 *
 * SHARP MICROELECTRONICS OF THE AMERICAS PROVIDES THIS SOFTWARE SOLELY 
 * FOR THE PURPOSE OF SOFTWARE DEVELOPMENT INCORPORATING THE USE OF A 
 * SHARP MICROCONTROLLER OR SYSTEM-ON-CHIP PRODUCT. USE OF THIS SOURCE
 * FILE IMPLIES ACCEPTANCE OF THESE CONDITIONS.
 *
 * COPYRIGHT (C) 2001 SHARP MICROELECTRONICS OF THE AMERICAS, INC.
 *     CAMAS, WA
 **********************************************************************/

#include "abl_types.h"
#include "lh7a404_dcdc_driver.h"

/***********************************************************************
 *
 * Function: c_entry
 *
 * Purpose: DCDC modulators driver example
 *
 * Processing:
 *     See function. This example sets up DCDC modulator 1 for a
 *     constant frequency and duty cycle output. (If the DCDC modulator
 *     output is connected to the speaker, a buzzing sound will be
 *     heard.)
 *
 * Parameters: None
 *
 * Outputs: None
 *
 * Returns: Always returns 1
 *
 * Notes:
 *     Single step through this file, or add a delay prior to the
 *     dcdc_close() function to hear the buzzing noise.
 *
 **********************************************************************/
int c_entry(void)
{
    INT_32 dcdcdev;

    /* Open DCDC modulator */
    if ((dcdcdev = dcdc_open(DCDC, 0)) == 0x00000000)
    {
        return 0;
    }

    /* Set DCDC modulator 2 for 5/8th duty cycle for NEXTPWR = low */
    dcdc_ioctl(dcdcdev, DCDC2_SET_DUTYL, FIVE_EIGTHS);

    /* Set DCDC modulator 2 for 5/8th duty cycle for NEXTPWR = high */
    dcdc_ioctl(dcdcdev, DCDC2_SET_DUTYH, FIVE_EIGTHS);

    /* Set DCDC modulator 2 frequency to 7.2KHz for NEXTPWR = low */
    dcdc_ioctl(dcdcdev, DCDC2_SET_PSCL, SEVEN_POINT_TWO_KHZ);

    /* Set DCDC modulator 2 frequency to 7.2KHz for NEXTPWR = high */
    dcdc_ioctl(dcdcdev, DCDC2_SET_PSCH, SEVEN_POINT_TWO_KHZ);

    /* Close RTC */
    dcdc_close(dcdcdev);

    return 1;
}

#ifndef __GNUC__
/* With ARM and GHS toolsets, the entry point is main() - this will
   allow the linker to generate wrapper code to setup stacks, allocate
   heap area, and initialize and copy code and data segments. For GNU
   toolsets, the entry point is through __start() in the crt0_gnu.asm
   file, and that startup code will setup stacks and data */
int main(void)
{
    return c_entry();
}
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -