Update ES/Lab/LAB6/JOHNSON_Counter.c

This commit is contained in:
aadit 2025-08-28 13:11:35 +05:30
parent 86d43c1a66
commit 7e1ff29eac

View file

@ -0,0 +1,30 @@
#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;
// LOOP to fill 24->31 incrementally
for(i=0;i<8;i++){
LPC_GPIO1->FIOSET=x;
x = x<<1;
}
// for(i=0; i<1000; i++); // delay
// LOOP to empty 24->31 incrementally.
x = 0x01000000;
for(i=0;i<8;i++){
LPC_GPIO1->FIOCLR=x;
x = x<<1;
}
// for(i=0; i<1000; i++); //delay
}
}