| View previous topic :: View next topic   | 
	
	
	
		| Author | 
		Message | 
	
	
		
			elizeu
 
 
  Joined: 07 Aug 2006 Posts: 2
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				| Who to pass PIN with formal parameters of user functions | 
			 
			
				 Posted: Mon Aug 14, 2006 8:42 am     | 
				     | 
			 
			
				
  | 
			 
			
				.
 
I´m  from Brazil, and have problem with this type of function
 
Help -me ?
 
 
 
Ex: 
 
 
using of function : 
 
 
if( myfunc(PIN_A1))
 
{
 
  ....
 
  .... 
 
  ...
 
}
 
 
int myfunc( short int pin)
 
{
 
      if(input(pin))
 
     {
 
         return 1;
 
     }
 
     ....
 
     ....
 
     ....
 
}
 
 
Congratulations | 
			 
		  | 
	
	
		  | 
	
	
		
			Ttelmah Guest
 
 
 
 
  
			
			
			
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Mon Aug 14, 2006 9:09 am     | 
				     | 
			 
			
				
  | 
			 
			
				The 'key', is that the standard pin I/O functions, cannot accept variables. They are replaced 'inline', with direct I/O to the specified pin. Hence with these, you cannot pass a value to a function, specifying a pin.
 
However you can generate your own version of the I/O punction, that will accept a variable. 
 
Have a look at the thread "Accessing digital I/O from within a for loop", which has references to a number of different solutions.
 
 
Best Wishes | 
			 
		  | 
	
	
		  | 
	
	
		
			PCM programmer
 
 
  Joined: 06 Sep 2003 Posts: 21708
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		 | 
	
	
		  | 
	
	
		 |