PCM programmer
 
 
  Joined: 06 Sep 2003 Posts: 21708
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Sat Sep 27, 2008 11:59 am     | 
				     | 
			 
			
				
  | 
			 
			
				There is no CCS function to read the latch registers.  But you can use
 
a #byte statement to declare the register addresses, and then read
 
them directly, in code.  Example:
 
 	  | Code: | 	 		  #include <18F452.H> 
 
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP 
 
#use delay(clock=4000000) 
 
 
#byte LATA = 0xF89
 
#byte LATB = 0xF8A
 
#byte LATC = 0xF8B
 
#byte LATD = 0xF8C
 
#byte LATE = 0xF8D
 
 
//===================================== 
 
void main() 
 
{ 
 
int8 value;
 
 
value = LATC;  // Read the latch register for Port C
 
 
while(1);
 
}
 
 | 	  
 
 
 
The register addresses come from this section of the PIC data sheet:
 
 	  | Quote: | 	 		  | TABLE 4-1: SPECIAL FUNCTION REGISTER MAP | 	 
  | 
			 
		  |