S5PV210_UM_REV1.1.pdf
第1章 3.2 PIN DISCRIP
tiON
第2章 GENERAL PURPOSE INPUT/ OUTPUT
2.1.5.3 Pin Mux Description 复用引脚
寄存器操作
2.2.2 PORT GROUP GPA0 CONTROL REGISTER
There are six control registers, namely, GPA0CON, GPA0DAT, GPA0PUD, GPA0DRV,GPA0CONPDN and GPA0PUDPDN in the Port Group GPA0 Control Registers
二、OK210 & LED
大概有一些了解,再来看看OK210 的LED操作
OK210底板原理图.pdf
再看FET210D0-V1.1核心板原理图.pdf
代码如下:
#define MP0_4CON (*(volatile unsigned long *)0xE0200340)
#define MP0_4DAT (*(volatile unsigned long *)0xE0200344)
#define GPD0CON (*(volatile unsigned long *)0xE02000A0)
#define MP0_4PUD (*(volatile unsigned long *)0xE0200348)
void clock_init(void);
void putc(char c);
void uart_init(void);
void putout(char * c);
int print(const char *fmt, ...);
static void Delay(int count)
{
volatile int i, j = 0;
volatile static int loop = 800000000/10000;
for(;count > 0;count--)
for(i=0;i < loop; i++) { j++; }
}
void main(void)
{
int i;
GPD0CON &= ~(0xF << 0);//关闭蜂鸣器
MP0_4CON = (MP0_4CON & ~0xFFFF0000) | 0x11110000; //设置高4为管脚为输出方式
MP0_4PUD=(0x55<<16)&MP0_4PUD;//设置为下拉方式
clock_init();
uart_init();
//MP0_4DAT |= 0xF0;
for( i=4;i<8;i++)//关闭led
{
MP0_4DAT |= ( 1<< i);
Delay(100000);
}
char print[40]={'l','e','d','1',' ','i','s',' ','o','n'};
char print1[40]={'l','e','d','1',' ','i','s',' ','o','f','f'};
while(1)
{
for( i=4;i<8;i++)//循环点亮led
{
print[3]= i+45;
print1[3]= i+45;
MP0_4DAT &= ~( 1<< i);
putout(print);//输出打印信息
Delay(300000);
MP0_4DAT |= ( 1<< i);
putout(print1);// 输出打印信息
Delay(300000);
}
}
}
实验结果
led1 ~4 流水灯