diff --git a/ES/Lab/LAB6/BinaryUpCounter.c b/ES/Lab/LAB6/BinaryUpCounter.c index 06986af..cc4c798 100644 --- a/ES/Lab/LAB6/BinaryUpCounter.c +++ b/ES/Lab/LAB6/BinaryUpCounter.c @@ -1,21 +1,24 @@ #include int main(){ - unsigned long x, i; - // from P1.24 -> 31 - LPC_PINCON->PINSEL3 &= 0x0000FFFF; // values + int i; + unsigned long x, j; + LPC_PINCON->PINSEL0 = 0; - LPC_GPIO1->FIODIR = 0xFF000000; + LPC_GPIO0->FIODIR = 0xFF<<15; - x = 0x01000000; // new variable + x = 1<<15; // new variable while(1){ - x = 0x01000000; - - for(i=0;i<256;i++){ - LPC_GPIO1->FIOSET=x; - x = x + 0x01000000; - LPC_GPIO1->FIOCLR=-x; - } + x = 1<<15; + for(i=0;i<256;i++){ + LPC_GPIO0->FIOSET=x; + for(j=0; j<2000000; j++); + + x = x + (1<<15); + + LPC_GPIO0->FIOCLR=-x; + for(j=0; j<2000000; j++); + } } }