knobby67 Guest
 
 
 
 
  
			
			
			
			
			
			
			
			
			
			
  
		  | 
		
			
				| Using input() with a variable | 
			 
			
				 Posted: Thu Sep 28, 2006 9:41 am     | 
				     | 
			 
			
				
  | 
			 
			
				Hello Im hoping someone can help me out with this, basically I have a structure define as  below
 
 
 	  | Code: | 	 		  
 
struct meter_input  
 
{
 
   byte input;
 
   long count;
 
   char status;
 
};
 
 | 	  
 
 
I then have structure like the below
 
 
 	  | Code: | 	 		  
 
STRUCT meter_input _10pCoinInput=
 
{
 
   PIN_B0,
 
   0,
 
   LO,   
 
 
};
 
 | 	  
 
 
Where input is used to store the pin to be read with the library function input()
 
 
I call the function
 
 
ReadStatus(&_10pCoinInput); 
 
 
The ReadStatus is as follows
 
 	  | Code: | 	 		  
 
void ReadStatus(struct meter_input *meter)
 
{
 
 
 
 
   if(meter->status==HIGH)         //is the status high
 
   {                        
 
      if(!input(meter->input))      //has the input dropped low
 
      {
 
         meter->status=LO;
 
         meter->count++;
 
      }
 
      else
 
      {
 
         return;
 
      }
 
   }
 
   else
 
 | 	  
 
However this gives a error 
 
Expression must evaluate to a constant
 
 
As far as Im awear it does? Input is PIN_B0, Ive tried defining input with a const ie const byte input; but this gives an error can anyone advise?
 
Thanks | 
			 
		  |