Add ES/Lab/LAB6/valuelist.c

This commit is contained in:
aadit 2025-08-28 12:32:22 +05:30
parent 5a2ec831ee
commit 1e1c3b9687

17
ES/Lab/LAB6/valuelist.c Normal file
View file

@ -0,0 +1,17 @@
#include <LPC17xx.h>
int main(){
int i;
// from P2.15 -> P2.22
LPC_PINCON->PINSEL4 &= 0x3FFFFFFF; // all values except P2.15 are taken as 1
LPC_PINCON->PINSEL5 &= 0xFFFFC000; // all values except P2.16 (0,1) -> P2.22 (12,13) are taken as 1
LPC_GPIO2->FIODIR = 0x007F8000; // all values except 15 -> 22 are taken as 0 (and GPIO2 because it's PIN 2)
while(1){
LPC_GPIO2-> FIOSET=0x007F8000;
for(i=0; i<1000; i++);
LPC_GPIO2->FIOCLR=0x007F8000;
for(i=0; i<1000; i++);
}
}