CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Comparator 16F628A not working

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
tenebris



Joined: 15 Mar 2018
Posts: 2

View user's profile Send private message

Comparator 16F628A not working
PostPosted: Thu Mar 15, 2018 8:51 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Mar 15, 2018 10:59 am     Reply with quote

Look at this table in the 16F628A data sheet, on page 13:
Quote:
TABLE 3-2: PIC16F627A/628A/648A PINOUT DESCRIPTION

What does it list in the "Output Type" column for RA5 ?

Data sheet:
http://ww1.microchip.com/downloads/en/DeviceDoc/40044G.pdf
temtronic



Joined: 01 Jul 2010
Posts: 9241
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Mar 15, 2018 2:12 pm     Reply with quote

or look at the pinout diagrams...
they clearly show with arrows possible data directions..
tenebris



Joined: 15 Mar 2018
Posts: 2

View user's profile Send private message

PostPosted: Thu Mar 15, 2018 8:35 pm     Reply with quote

thank you all
_________________
*/
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group