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

📄 main.c

📁 AT91RM9200的最小程序
💻 C
字号:
//*----------------------------------------------------------------------------
//*         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 application written in C
//* Creation            : FB   24/10/2002
//*
//*----------------------------------------------------------------------------
#include "AT91RM9200.h"
#include "lib_AT91RM9200.h"
extern void AT91F_DBGU_Printk(char *);

static void wshdelay(int x)
{
	int i;
	for(i=0;i<x;i++);
}

static void configPIO_GIO1(void)
{
	AT91S_PIO *nPIO ;	
	nPIO = AT91C_BASE_PIOA ;
	nPIO->PIO_PER = 0x1 << 14; //使能PA14
	//nPIO->PIO_PDR = 0;	
	nPIO->PIO_OER =  0x1 << 14; //设置为输出
	//nPIO->PIO_ODR = 0 ;
	//nPIO->PIO_IFER =0;
	//nPIO->PIO_IFDR = 0;//input filter 
	nPIO->PIO_IER = 0; 
	nPIO->PIO_IDR = 0x1 << 14;//disable interupt
	//nPIO->PIO_MDER = 0;
	nPIO->PIO_MDDR = 0x1 << 14; //disable open drain
	nPIO->PIO_PPUER = 0x1 << 14; //enable pullup
	//nPIO->PIO_PPUDR = 0;
	//nPIO->PIO_ASR= 0	;
	//nPIO->PIO_BSR=0;
	nPIO->PIO_OWER =0x1 << 14;	//输出写使能
	//nPIO->PIO_OWDR = 0x00; 	
}

void initLED_D1(void)
{
	 //int i;
	 AT91S_PIO *nPIO= AT91C_BASE_PIOA ; 
	 configPIO_GIO1();		//配置PA14口
	//while(1){
	
	nPIO->PIO_SODR =0x1 << 14;	//置位
	//for(i=0;i<0x200;i++)
		wshdelay(0x70000)	;		//延时
	nPIO->PIO_CODR = 0x1 << 14;	//清零
	//for(i=0;i<0x200;i++)
		wshdelay(0x70000)	;
	//}
}


int main()
{	
	while (1){
	initLED_D1();
	AT91F_DBGU_Printk("\n\rBasicBoot Successfull: Enter main()\n\r");
	}
}

⌨️ 快捷键说明

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