From 03922c139ed21f3e22b69e515a67bd025ba12647 Mon Sep 17 00:00:00 2001 From: aadit Date: Thu, 11 Sep 2025 12:12:01 +0530 Subject: [PATCH] Update ES/Lab/LAB6/BinaryUpCounter.c --- ES/Lab/LAB6/BinaryUpCounter.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) 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++); + } } }