Polling for keystrokes

Source: Internet
Author: User

The morning is still seven points not to wake up, do not know whether it is more than a year has been accustomed to, think of freshman sophomore are nine points after waking up, and now really do not know where the spirit. As a "slot", always than a little effort, effort is not shameful, today's main task is bare metal, s5pv210 of the frequency reduction,

#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; Only one line, embedded is like this, a short line of code, the back is not know how much information of the pages
}


void Main (void)
{

Gpj2con = 0x1111;
Gpj2pud = 0XAA;
Gpj2dat = 0xf;

Chang_clock ();

while (1)
{
Gpj2dat = 0x0;
Delay ();
Gpj2dat = 0xf;
Delay ();
}
}

Also made a bare-metal drive for button polling, as follows

#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; You cannot assign an initial value when you enter it.

*/
extern void delay (void);

void Main (void)
{
Gpj2con = 0x1111;
Gpj2pud = 0XAA;
Gpj2dat = 0xf;

Gph2con = 0x00;
Gph2pud = 0xaa;//Here is only configured with four bits, so the following is used to judge 0e,od,ob,o7
Gph2dat = 0xFF; You cannot assign an initial value when you enter it.

while (1)
{
Delay ();

if (Gph2dat = = 0x0e)
{
Gpj2dat = Gpj2dat ^1; The little girl in the class thought, genius, studied.
}

if (Gph2dat = = 0x0d)
{
Gpj2dat = Gpj2dat ^2; Every time you come in, you can take the opposite position.
}

if (Gph2dat = = 0x0b)
{
Gpj2dat = Gpj2dat ^4;
}

if (Gph2dat = = 0x07)
{
Gpj2dat =gpj2dat ^8;
}
}
}

Intelligence is not enough effort to make up, people ugly will learn more.

Polling for keystrokes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.