main.c

来自「ARM入门的好帮手.包含了从简单到相对较复杂的程序.」· C语言 代码 · 共 96 行

C
96
字号
//*----------------------------------------------------------------------------
//*      ATMEL Microcontroller Software Support  -  ROUSSET  -
//*----------------------------------------------------------------------------
//* The software is delivered "AS IS" without warranty or condition of any
//* kind, either express, implied or statutory. This includes without
//* limitation any warranty or condition with respect to merchantability or
//* fitness for any particular purpose, or against the infringements of
//* intellectual property rights of others.
//*----------------------------------------------------------------------------
//* File Name           : main.c
//* Object              : Main sodtware to switch between all clock sources
//*						: in AT91M55800A Microcontroller
//*
//* 1.0 08/01/01 S.C    : Creation
//*----------------------------------------------------------------------------

#include "parts/m55800/lib_m55800.h"
#include "clock_switching_driver.h"
#include "targets/eb55/eb55.h"


//*----------------------------------------------------------------------------
//* Function Name       : main
//* Object              : Example to use the Switching Clock Driver for the
//*						: AT91M55800A Microcontroller
//* Input Parameters    : The Targeted clock and for the PLL the multiplier ratio
//* Output Parameters   :
//*----------------------------------------------------------------------------
void main (void)
{

	//* -- Set up PIO
    at91_pio_write (&PIOB_DESC, LED_MASK, LED_OFF ) ;
    at91_pio_open ( &PIOB_DESC, LED_MASK, PIO_OUTPUT ) ;

    while (1)
    {
	/* To start with a initial config */

	mck_clock_speed (2,2) ;

	//* First Switching
	/* Start Event */
	at91_pio_write (&PIOB_DESC, LED1, LED_ON ) ;
    at91_pio_write (&PIOB_DESC, LED1, LED_OFF ) ;

	mck_clock_speed (1,0) ;

	at91_pio_write (&PIOB_DESC, LED1, LED_ON ) ;
    at91_pio_write (&PIOB_DESC, LED1, LED_OFF ) ;
    /* Stop Event */

	//* Second Switching

    mck_clock_speed (2,2) ;

	at91_pio_write (&PIOB_DESC, LED1, LED_ON ) ;
    at91_pio_write (&PIOB_DESC, LED1, LED_OFF ) ;

	//* Third Switching

	mck_clock_speed (0,0) ;

	at91_pio_write (&PIOB_DESC, LED1, LED_ON ) ;
    at91_pio_write (&PIOB_DESC, LED1, LED_OFF ) ;

	//* Fourth Switching

	mck_clock_speed (1,0) ;

	at91_pio_write (&PIOB_DESC, LED1, LED_ON ) ;
    at91_pio_write (&PIOB_DESC, LED1, LED_OFF ) ;

	//* Fifth Switching

	mck_clock_speed (0,0) ;

	at91_pio_write (&PIOB_DESC, LED1, LED_ON ) ;
    at91_pio_write (&PIOB_DESC, LED1, LED_OFF ) ;

	//* Sixth Switching

	mck_clock_speed (2,2) ;

	at91_pio_write (&PIOB_DESC, LED1, LED_ON ) ;
    at91_pio_write (&PIOB_DESC, LED1, LED_OFF ) ;

	//* Eighth Switching

	mck_clock_speed (0,0) ;

	at91_pio_write (&PIOB_DESC, LED1, LED_ON ) ;
    at91_pio_write (&PIOB_DESC, LED1, LED_OFF ) ;
	}
}

⌨️ 快捷键说明

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