Last active
April 21, 2016 16:29
-
-
Save AlexanderSavochkin/a9cb25ad7e9cb935a5e0efe5046d64a7 to your computer and use it in GitHub Desktop.
LED blink with LPC1114 in C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define REGISTER_32(ADDRESS) (*((volatile unsigned int *)(ADDRESS))) | |
#define SYSAHBCLKCTRL REGISTER_32(0x40048080) | |
#define GPIO0DATA REGISTER_32(0x50003ffc) | |
#define GPIO0DIR REGISTER_32(0x50008000) | |
int main() | |
{ | |
// Turn on clock for GPIO and IOCON | |
SYSAHBCLKCTRL |= (1 << 6) + (1 << 16); | |
GPIO0DIR = (1 << 7); // Make PIO0_7 an output | |
GPIO0DATA = 0; // Turn off PIO0 outputs | |
int n; | |
while(1) | |
{ | |
GPIO0DATA = (1 << 7); // Turn on PIO0_7 | |
n=1000000; while(--n); | |
GPIO0DATA = 0; // Turn off PIO0_7 | |
n=1000000; while(--n); | |
GPIO0DATA = (1 << 7); // Turn on PIO0_7 | |
n=3000000; while(--n); | |
GPIO0DATA = 0; // Turn off PIO0_7 | |
n=3000000; while(--n); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment