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

Read PIN in PIC 16F628A

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







Read PIN in PIC 16F628A
PostPosted: Sun Sep 24, 2006 9:10 am     Reply with quote

i Need read input pins in PIC16F628A, I used pin BIT_TEST(*5,1). For example PIN A1. With this formate i didnt se in my firmware the diference when i phisical input 5V ou 0V. i tried the comand input(a,pin_a1) but dont running too.

you can help me?
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Sun Sep 24, 2006 9:38 am     Reply with quote

Quote:

i Need read input pins in PIC16F628A, I used pin BIT_TEST(*5,1). For example PIN A1.


In all the PIC16 series, Port A is the Analog Port connected to the analog to digital converters or analog comparators.
By default, after power up this port is configured as analog, unless you configure this port as digital with the following line:
setup_adc_ports(NO_ANALOG);

Then to read an input:
Code:

        if(input(PIN_A1)) 
          { ...do this  }
        else
          { ...do that  }   


Humberto
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Sep 24, 2006 1:47 pm     Reply with quote

Quote:
setup_adc_ports(NO_ANALOG);

That function isn't supported for the 16F628A, because it doesn't have an ADC.


Quote:
I need read input pins in PIC16F628A, I used pin BIT_TEST(*5,1).

The comparator should be turned off by the start-up code which
is inserted by the compiler. But it's possible that if you have an
older version of the compiler the start-up code may be incorrect.

Post your compiler version. This is a 4-digit number, such as 3.191,
or 3.236, or 3.249, etc. You can find it at the top of the .LST file.
The .LST file will be in your project directory.
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Sun Sep 24, 2006 4:16 pm     Reply with quote

Quote:

That function isn't supported for the 16F628A, because it doesn't have an ADC.

Yap, you are rigth PCM programmer, I mention it: "analog to digital converters or
analog comparators" but made a mistake in the way to turn off such module:
setup_adc_ports(NO_ANALOG);
instead of:
setup_comparator(NC_NC_NC_NC);


Humberto
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