adsmainled.c

来自「自已编at91rm9200的串口通讯程序。可供初学者参考」· C语言 代码 · 共 57 行

C
57
字号
//*----------------------------------------------------------------------------
//*         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              : Basic twi example. Write a byte into EEPROM and read it
//* Creation            : NL   25/11/02
//*
//*----------------------------------------------------------------------------
#include "main.h"

#define AT91_SYS                ((AT91PS_SYS) AT91C_BASE_SYS)

#define LEDCON0       AT91C_PIO_PA4
#define LEDCON1       AT91C_PIO_PA5
#define LEDCON2       AT91C_PIO_PA6
#define LEDCON3       AT91C_PIO_PA19
#define LEDCON4       AT91C_PIO_PA20
#define LEDCON5       AT91C_PIO_PA21
#define LEDCON6       AT91C_PIO_PA22
#define LEDCON7       AT91C_PIO_PA23


/*
 * Enable Configuration LED PIO interface.
 */
static void LedInit(void) {
                                                                                             
    // enable direct output enable   LED
    AT91_SYS->PIOA_PER |= LEDCON0 | LEDCON1 | LEDCON2 | LEDCON3 | LEDCON4 | LEDCON5 | LEDCON6 | LEDCON7;
    // enable output  LED
    AT91_SYS->PIOA_OER |= LEDCON0 | LEDCON1 | LEDCON2 | LEDCON3 | LEDCON4 | LEDCON5 | LEDCON6 | LEDCON7;

	AT91_SYS->PIOA_CODR |= LEDCON0 | LEDCON1 | LEDCON2 | LEDCON3 | LEDCON4 | LEDCON5 | LEDCON6 | LEDCON7;
		
}


int main()
{
	LedInit();
	
	 while(1)	
	  {
		AT91_SYS->PIOA_SODR |= LEDCON0 | LEDCON1 | LEDCON2 | LEDCON3 | LEDCON4 | LEDCON5 | LEDCON6 | LEDCON7;
		
		AT91_SYS->PIOA_CODR |= LEDCON0 | LEDCON1 | LEDCON2 | LEDCON3 | LEDCON4 | LEDCON5 | LEDCON6 | LEDCON7;
		
	  }
	
		
}

⌨️ 快捷键说明

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