Update ES/Lab/LAB6/JOHNSON_Counter.c
This commit is contained in:
parent
6744ea11bc
commit
91765f4e0b
1 changed files with 13 additions and 12 deletions
|
@ -1,30 +1,31 @@
|
|||
#include <LPC17xx.h>
|
||||
|
||||
int main(){
|
||||
unsigned long x, i;
|
||||
unsigned long x, i, j;
|
||||
// from P1.24 -> 31
|
||||
LPC_PINCON->PINSEL3 &= 0x0000FFFF; // values
|
||||
LPC_PINCON->PINSEL0 = 0; // values
|
||||
|
||||
LPC_GPIO1->FIODIR = 0xFF000000;
|
||||
LPC_GPIO0->FIODIR = 0xFF<<15;
|
||||
|
||||
x = 0x01000000; // new variable
|
||||
x = 1<<15; // new variable
|
||||
|
||||
while(1){
|
||||
x = 0x01000000;
|
||||
x = 1<<15;
|
||||
|
||||
// LOOP to fill 24->31 incrementally
|
||||
for(i=0;i<8;i++){
|
||||
LPC_GPIO1->FIOSET=x;
|
||||
LPC_GPIO0->FIOSET=x;
|
||||
x = x<<1;
|
||||
for(j=0; j<800000; j++);
|
||||
}
|
||||
// for(i=0; i<1000; i++); // delay
|
||||
// delay
|
||||
|
||||
// LOOP to empty 24->31 incrementally.
|
||||
x = 0x01000000;
|
||||
x = 1<<15;
|
||||
for(i=0;i<8;i++){
|
||||
LPC_GPIO1->FIOCLR=x;
|
||||
LPC_GPIO0->FIOCLR=x;
|
||||
x = x<<1;
|
||||
for(j=0; j<800000; j++);
|
||||
|
||||
}
|
||||
// for(i=0; i<1000; i++); //delay
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue