Add ES/Lab/LAB6/BinaryUpCounter.c
This commit is contained in:
parent
7e1ff29eac
commit
968890a5fe
1 changed files with 21 additions and 0 deletions
21
ES/Lab/LAB6/BinaryUpCounter.c
Normal file
21
ES/Lab/LAB6/BinaryUpCounter.c
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#include <LPC17xx.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
unsigned long x, i;
|
||||||
|
// from P1.24 -> 31
|
||||||
|
LPC_PINCON->PINSEL3 &= 0x0000FFFF; // values
|
||||||
|
|
||||||
|
LPC_GPIO1->FIODIR = 0xFF000000;
|
||||||
|
|
||||||
|
x = 0x01000000; // new variable
|
||||||
|
|
||||||
|
while(1){
|
||||||
|
x = 0x01000000;
|
||||||
|
|
||||||
|
for(i=0;i<256;i++){
|
||||||
|
LPC_GPIO1->FIOSET=x;
|
||||||
|
x = x + 0x01000000;
|
||||||
|
LPC_GPIO1->FIOCLR=-x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue