Update ES/Lab/LAB6/BinaryUpCounter.c
This commit is contained in:
		
							parent
							
								
									91765f4e0b
								
							
						
					
					
						commit
						03922c139e
					
				
					 1 changed files with 15 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -1,21 +1,24 @@
 | 
			
		|||
#include <LPC17xx.h>
 | 
			
		||||
 | 
			
		||||
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++);
 | 
			
		||||
				}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue