标签:
早上依旧七点不到就醒了,不知道是不是一年多来差不多都习惯了,想想大一大二都是九点后才醒的,现在真的不知道哪里来的精神。作为一个“插班生”,总要比别个努力一点,努力不丢人,,今天主要任务是裸机,s5pv210 的降频,
#define GPJ2CON *((volatile unsigned int *)0xE0200280)
#define GPJ2PUD *((volatile unsigned int *)0xE0200288)
#define GPJ2DAT *((volatile unsigned int *)0xE0200284)
#define APLL_CON0 *((volatile unsigned int *)0xE0100100)
extern void delay(void);
void chang_clock(void)
{
APLL_CON0 = APLL_CON0 |0x807d0302; //只有一行,嵌入式就是这样,短短的一行代码,后面就是不知道多少资料的翻阅
}
void main(void)
{
GPJ2CON = 0x1111;
GPJ2PUD = 0xaa;
GPJ2DAT = 0xf;
chang_clock();
while(1)
{
GPJ2DAT = 0x0;
delay();
GPJ2DAT = 0xf;
delay();
}
}
还做了按键轮询的裸机驱动,如下
#define GPJ2CON *((volatile unsigned int *)0xE0200280)
#define GPJ2PUD *((volatile unsigned int *)0xE0200288)
#define GPJ2DAT *((volatile unsigned int *)0xE0200284)
#define GPH2CON *((volatile unsigned int *)0xE0200C40)
#define GPH2PUD *((volatile unsigned int *)0xE0200C48)
#define GPH2DAT *((volatile unsigned int *)0xE0200C44)
/*
#define GPH3CON *((volatile unsigned int *)0xE0200C60)
#define GPH3PUD *((volatile unsigned int *)0xE0200C68)
#define GPH3DAT *((volatile unsigned int *)0xE0200C64)
GPH3CON = 0x00;
GPH3PUD = 0xaa;
//GPH3DAT = 0xff; //输入的时候是不能赋初值的
*/
extern void delay(void);
void main(void)
{
GPJ2CON = 0x1111;
GPJ2PUD = 0xaa;
GPJ2DAT = 0xf;
GPH2CON = 0x00;
GPH2PUD = 0xaa;//这里只是配置了四位,所以下面判断时用0e,od,ob,o7
//GPH2DAT = 0xff; //输入的时候是不能赋初值的
while(1)
{
delay();
if(GPH2DAT == 0x0e)
{
GPJ2DAT = GPJ2DAT ^1; //班上小美女想的,神来之笔,学习了
}
if(GPH2DAT == 0x0d)
{
GPJ2DAT = GPJ2DAT ^2; //每次进来只要和相应位异或就可以取反
}
if(GPH2DAT == 0x0b)
{
GPJ2DAT = GPJ2DAT ^4;
}
if(GPH2DAT == 0x07)
{
GPJ2DAT =GPJ2DAT ^8;
}
}
}
智力不够努力凑,人丑就要多学习。
标签:
原文地址:http://www.cnblogs.com/ygy1784717631/p/4764846.html