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

📄 iar-

📁 IAR_example_EasyARM8962.zip
💻
字号:
/****************************************Copyright (c)****************************************************
**                            Guangzhou ZHIYUAN electronics Co.,LTD.
**                                      
**                                 http://www.embedtools.com
**
**--------------File Info---------------------------------------------------------------------------------
** File name:               SetPLL.c
** Last modified Date:      2007.12.20
** Latest Version:          V1.1
** Descriptions:            PLL设置实验程序
**
**--------------------------------------------------------------------------------------------------------
** Created by:              Zhao shimin
** Created date:            2007.09.16
** Version:                 V1.0
** Descriptions:            The original version
**
**--------------------------------------------------------------------------------------------------------
** Modified by:             Kang qinhua
** Modified date:           2008.01.12    
** Version:                 V1.1    
** Descriptions:            
**
*********************************************************************************************************/

/*********************************************************************************************************
  调用库函数的头文件  
*********************************************************************************************************/
#include "hw_memmap.h"
#include "hw_types.h"
#include "ssi.h"
#include "gpio.h"
#include "sysctl.h"
#include "systick.h"

#define   BEEP   GPIO_PIN_7

void JTAGProtect(void);

/*********************************************************************************************************
** Function name:           delay
** Descriptions:            延时函数,输入参数越大,延时时间越长
** input parameters:        uld    延时时间值
** output parameters:       NONE                         
** Returned value:          NONE
** Created by:              Zhao shimin
** Created Date:            2007/09/16
**--------------------------------------------------------------------------------------------------------
** Modified by:           
** Modified date:               
**--------------------------------------------------------------------------------------------------------
*********************************************************************************************************/
void delay (unsigned long  uld)
{
    for(; uld; uld--) {
        ;
    }      
}

/*********************************************************************************************************
** Function name:           main
** Descriptions:            PLL设置程序
** input parameters:        NONE
** output parameters:       NONE
** Returned value:          NONE
** Created by:              Zhao shimin
** Created Date:            2007/09/16
**--------------------------------------------------------------------------------------------------------
** Modified by:             
** Modified date:              
**--------------------------------------------------------------------------------------------------------
*********************************************************************************************************/
int main (void)
{
    unsigned long  i;
    JTAGProtect();
    SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | 
                   SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ);                 /*  设置直接使用外部晶体        */
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);                        /*  给GPIOA提供时钟             */
	
    
    GPIOPadConfigSet(GPIO_PORTA_BASE, BEEP, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
                                                                        /*  设定 GPIO PA6引脚为推挽     */
                                                                        /*  2MA输出                    */
    
    GPIODirModeSet(GPIO_PORTA_BASE, BEEP, GPIO_DIR_MODE_OUT);           /*  设定 GPIO PA6 引脚为        */
                                                                        /*  GPIO输出口                  */
    for (i = 0; i < 10; i++) {                                          
        GPIOPinWrite(GPIO_PORTA_BASE,BEEP,~BEEP);
        delay(200000);
        GPIOPinWrite(GPIO_PORTA_BASE,BEEP,BEEP);
        delay(200000);
    }   
    SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_OSC_MAIN | 
                   SYSCTL_USE_PLL   | SYSCTL_XTAL_6MHZ);                /*  设置使用PLL,10分频         */
    for (i = 0; i < 10; i++) {
        GPIOPinWrite(GPIO_PORTA_BASE,BEEP,~BEEP);
        delay(200000);
        GPIOPinWrite(GPIO_PORTA_BASE,BEEP,BEEP);
        delay(200000);
    }
    while (1) {
        ;
    }     
}

/*********************************************************************************************************
** Function name:           JTAGProtect
** Descriptions:            防止JTAG失效的程序
** input parameters:        NONE
** output parameters:       NONE
** Returned value:          NONE
** Created by:              Zhao shimin
** Created Date:            2007/09/16
**--------------------------------------------------------------------------------------------------------
** Modified by:            
** Modified date:               
**--------------------------------------------------------------------------------------------------------
*********************************************************************************************************/
#define KEY3   GPIO_PIN_4

void JTAGProtect (void)
{   
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);                        /*  给GPIOB提供时钟             */    
    GPIOPadConfigSet(GPIO_PORTB_BASE, KEY3, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
                                                                        /*  设定 GPIO PB4引脚为上拉     */
                                                                        /*  2MA输入                    */
    
    GPIODirModeSet(GPIO_PORTB_BASE, KEY3, GPIO_DIR_MODE_IN);            /*  设定 GPIO PB4 引脚为        */
                                                                        /*  GPIO输入口                  */    
    while ((GPIOPinRead(GPIO_PORTB_BASE,KEY3) & KEY3)== 0) {
        ;
    }
}

/*********************************************************************************************************
  END FILE
*********************************************************************************************************/

⌨️ 快捷键说明

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