Nimi2440 bare metal LED program Problems

Source: Internet
Author: User
Nimi2440 bare metal LED program problems-general Linux technology-Linux technology and application information, the following is a detailed description. I am a beginner. This is the code I wrote. There is no syntax error, but it is a logic error and cannot implement the desired result. Please advise !!

# Define GPBCON (* (volatile unsigned long *) 0x56000010)
# Define GPBDAT (* (volatile unsigned long *) 0x56000014)

# Define LED1_BCL (3 <(2*5 ))
# Define LED2_BCL (3 <(2*6 ))
# Define LED3_BCL (3 <(2*7 ))
# Define LED4_BCL (3 <(2*8 ))

# Define ledshortout (1 <(2*5 ))
# Define LED2_OUT (1 <(2*6 ))
# Define LED3_OUT (1 <(2*7 ))
# Define LED4_OUT (1 <(2*8 ))


# Define ledbench ON ~ (1 <5)
# Define LED2_ON ~ (1 <6)
# Define LED3_ON ~ (1 <7)
# Define LED4_ON ~ (1 <8)

# Define led0000off (1 <5)
# Define LED2_OFF (1 <6)
# Define LED3_OFF (1 <7)
# Define LED4_OFF (1 <8)

# Define BEEP_OFF ~ (1 <0)

Void delay (unsigned long MS)
{
For (; ms> 0; ms --);
}

Int main (void)
{
/* Set the led gpcon as the output */
GPBCON & = ~ (LED1_BCL | LED2_BCL | LED3_BCL | LED4_BCL );
GPBCON | = (led0000out | LED2_OUT | LED3_OUT | LED4_OUT );

/* Light LED1, delay for a period of time, and then extinguish LED1 */
GPBDAT = ledbench on & BEEP_OFF; // By the way, the sound of the buzzer is disabled, indicating that BEEP 1 is on and 0 is off.
Delay (1000 );
GPBDAT | = led0000off;
/*
GPBDAT = LED2_ON & BEEP_OFF;
Delay (10 );
GPBDAT | = LED2_OFF;

GPBDAT = LED3_ON & BEEP_OFF;
Delay (10 );
GPBDAT | = LED3_OFF;

GPBDAT = LED4_ON & BEEP_OFF;
Delay (10 );
GPBDAT | = LED4_OFF;
*/
Return 0;
}


My question is, why does the LED1 light no longer go out after the delay ?? Is the result different from the program I wrote ??

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.