| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| tenebris 
 
 
 Joined: 15 Mar 2018
 Posts: 2
 
 
 
			    
 
 | 
			
				| Comparator 16F628A not working |  
				|  Posted: Thu Mar 15, 2018 8:51 am |   |  
				| 
 |  
				| Hello! I'm using the 5.07v compiler, and trying to make C2OUT work with the argument NC_NC_A1_A2 but nothing happens... 
 
  	  | Code: |  	  | #include <16f628a.h>
 #fuses INTRC_IO, NOWDT, NOPROTECT, NOMCLR, NOBROWNOUT, PUT, NOLVP
 #use delay(clock=4000000)
 
 void main()
 {
 setup_comparator (NC_NC_A1_A2);
 
 while(TRUE){
 if (C2OUT)
 output_high(PIN_A5);
 
 else
 output_low(PIN_A5);
 }
 
 }
 
 | 
 
 And this is what the .lst looks like:
 
  	  | Code: |  	  | .................... setup_comparator (NC_NC_A1_A2);
 000D:  MOVLW  05
 000E:  MOVWF  1F
 000F:  BSF    03.5
 0010:  MOVF   05,W
 0011:  IORLW  06
 0012:  MOVWF  05
 0013:  MOVLW  03
 0014:  MOVWF  77
 0015:  DECFSZ 77,F
 0016:  GOTO   015
 0017:  BCF    03.5
 0018:  MOVF   1F,W
 0019:  BCF    0C.6
 
 | 
 
 I know this is a very simple problem, but I can't figure whats going wrong. The circuit is: Pot 10K on A2, LDR on A1, and a led on A5
 Nothing happens in Proteus, too...
 
 
  _________________
 */
 |  | 
	
		|  | 
	
		| PCM programmer 
 
 
 Joined: 06 Sep 2003
 Posts: 21708
 
 
 
			    
 
 |  | 
	
		|  | 
	
		| temtronic 
 
 
 Joined: 01 Jul 2010
 Posts: 9587
 Location: Greensville,Ontario
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Thu Mar 15, 2018 2:12 pm |   |  
				| 
 |  
				| or look at the pinout diagrams... they clearly show with arrows possible data directions..
 |  | 
	
		|  | 
	
		| tenebris 
 
 
 Joined: 15 Mar 2018
 Posts: 2
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Thu Mar 15, 2018 8:35 pm |   |  
				| 
 |  
				| thank you all _________________
 */
 |  | 
	
		|  | 
	
		|  |