Add ES/Lab/LAB6/valuelist.c
This commit is contained in:
		
							parent
							
								
									5a2ec831ee
								
							
						
					
					
						commit
						1e1c3b9687
					
				
					 1 changed files with 17 additions and 0 deletions
				
			
		
							
								
								
									
										17
									
								
								ES/Lab/LAB6/valuelist.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								ES/Lab/LAB6/valuelist.c
									
										
									
									
									
										Normal 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++); 
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue