From 968890a5fe39bea0882cc8d2b56b188b251ddbaf Mon Sep 17 00:00:00 2001 From: aadit Date: Thu, 28 Aug 2025 13:11:56 +0530 Subject: [PATCH] Add ES/Lab/LAB6/BinaryUpCounter.c --- ES/Lab/LAB6/BinaryUpCounter.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 ES/Lab/LAB6/BinaryUpCounter.c diff --git a/ES/Lab/LAB6/BinaryUpCounter.c b/ES/Lab/LAB6/BinaryUpCounter.c new file mode 100644 index 0000000..06986af --- /dev/null +++ b/ES/Lab/LAB6/BinaryUpCounter.c @@ -0,0 +1,21 @@ +#include + +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; + } + } +}